From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EA5331A1E0F for ; Fri, 30 Sep 2016 07:25:14 -0700 (PDT) Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EA75C03070A; Fri, 30 Sep 2016 14:25:14 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-73.phx2.redhat.com [10.3.116.73]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8UEPC55002266; Fri, 30 Sep 2016 10:25:12 -0400 To: "Cohen, Eugene" , "edk2-devel@lists.01.org" , "Kinney, Michael D" , "Yao, Jiewen" , "Andrew Fish (afish@apple.com)" References: From: Laszlo Ersek Message-ID: <9877647c-b348-2a36-9ac0-b520a82260d1@redhat.com> Date: Fri, 30 Sep 2016 16:25:11 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 30 Sep 2016 14:25:14 +0000 (UTC) Subject: Re: RFC: ProtocolLib for cross DXE and SMM Protocol and Handle Services X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Sep 2016 14:25:15 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 09/30/16 16:13, Cohen, Eugene wrote: > Request for Comments... > > Both UEFI/DXE and SMM support the protocol / handle database concept. > Some protocol definitions are able used in both environments with > different implementations behind them. > > We'd like to create a library that could be used in either DXE or SMM > making use of protocol and handle services. For example, we'd like > to be able to do a LocateProtocol for a certain protocol and make use > of the protocol regardless of the environment we're executing in. > > In order to create a neutral API for protocol and handle services > from either environment, I'm proposing that we create a "ProtocolLib" > that abstracts protocol install, uninstall, HandleProtocol, install > notification, LocateHandle and LocateProtocol implementations - > basically all the protocol and handle services common across UEFI > Boot Services and SMST. A DXE instance of ProtocolLib would direct > functions through the Boot Services table and an SMM instance of > ProtocolLib would go through the SMST. (We also would like to > maintain separation between DXE and SMM in support of the PI 1.5 > Standalone SMM model which is easy to achieve with separate library > instances.) > > We have a similar model already with the MemoryAllocationLib so this > would follow in its footsteps. > > > Please share your thoughts... As far as I know: - the DXE and SMM protocol databases are distinct, - the same protocol GUID may or may not be installed (on one or more) handle(s) in either, - even if a protocol GUID exists uniquely in exactly one of those databases, the locator function would have to return which database the GUID was found. My point is that every wrapper function that returns a protocol interface (or several protocol interfaces), or handles, each such return value will likely have to be qualified with the database where it was found. (This is not meant as an argument against the library, just a remark about the proposed APIs, as I see them.) Thanks Laszlo