From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 80EBF21122E5D for ; Thu, 6 Sep 2018 10:17:41 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Sep 2018 10:17:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,338,1531810800"; d="scan'208";a="68077346" Received: from orsmsx101.amr.corp.intel.com ([10.22.225.128]) by fmsmga007.fm.intel.com with ESMTP; 06 Sep 2018 10:17:30 -0700 Received: from orsmsx115.amr.corp.intel.com (10.22.240.11) by ORSMSX101.amr.corp.intel.com (10.22.225.128) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 6 Sep 2018 10:17:30 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.72]) by ORSMSX115.amr.corp.intel.com ([169.254.4.230]) with mapi id 14.03.0319.002; Thu, 6 Sep 2018 10:17:30 -0700 From: "Kinney, Michael D" To: Laszlo Ersek , "Ni, Ruiyu" , Andrew Fish , "Kinney, Michael D" CC: Leif Lindholm , "edk2-devel@lists.01.org" , "Carsey, Jaben" , Alexander Graf , Heinrich Schuchardt , AKASHI Takahiro Thread-Topic: portability of ShellPkg Thread-Index: AQHURVE9z2x7px67VUWNRtniMms9Q6Ti/ukAgAB7mwCAAAFsUA== Date: Thu, 6 Sep 2018 17:17:29 +0000 Message-ID: References: <20180905172546.hxc2vqn6pgmr2zqs@bivouac.eciton.net> <8f700131-c4da-59bf-e1d3-0f4000e65215@redhat.com> <4C4EEEA0-8656-49D5-9DEE-8A810F6D8FC2@apple.com> <14abfd24-94eb-53f0-8ed6-721cbbc55137@Intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.22.254.140] MIME-Version: 1.0 Subject: Re: portability of ShellPkg X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2018 17:17:41 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Ray, I have a few ideas here. 1) Add a new UefiHobLib instance that is only for=20 use by UEFI Drivers and UEFI Applications. It fails gracefully if the HOB List is not in the UEFI System Configuration Table. BootMode if HobList is not present can be BOOT_WITH_FULL_CONFIGURATION. 2) Remove ASSERT() from the CONSTRUCTOR and a return NULL from the Get*() functions if mHobList is NULL. BootMode can be BOOT_WITH_FULL_CONFIGURATION if mHobList is NULL. 3) Update UEFI Shell to not use the UefiBootManagerLib. This would add duplicate code to the UEFI Shell. 4) Update UefiBootManagerLib to not use the HobLib. Instead look for HobList in UEFI System Configuration Table and fail gracefully if it is not present. This would add some duplicate code to the=20 UefiBootManagerLib to parse the Hob List. Best regards, Mike > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Thursday, September 6, 2018 2:57 AM > To: Ni, Ruiyu ; Andrew Fish > > Cc: Leif Lindholm ; edk2- > devel@lists.01.org; Carsey, Jaben > ; Alexander Graf > ; Heinrich Schuchardt > ; AKASHI Takahiro > ; Kinney, Michael D > > Subject: Re: portability of ShellPkg >=20 > On 09/06/18 04:34, Ni, Ruiyu wrote: > > On 9/6/2018 3:47 AM, Andrew Fish wrote: > >> > >> Laszlo, > >> > >> gEfiMemoryTypeInformationGuid is an edk2/MdeModulePkg > concept used to > >> give the DXE Core hints on how to reduce > fragmentation in the memory > >> map. Typically there is code in PEI that creates a > HOB and may consume > >> a variable written by the BDS. This library seems to > be the generic > >> way to do it on an edk2 platform. > >> > >> Thus this library is not just PI but edk2 > MdeModulePkg specific in > >> some of its assumptions. In general this > UefiBootManagerLib seems > >> focused on construction and edk2 BDS. It would > probably make more > >> sense to break out the UEFI Spec related bits so they > could be used in > >> generic UEFI Applications. > >> > >> Thanks, > >> > >> Andrew Fish > >> > >> > > > > Andrew, > > I agree refactoring UefiBootManagerLib to separate the > pure UEFI, pure > > PI and EDKII specific looks much more cleaner. > > So far the PI related bits in UefiBootManagerLib may > include: > > 1. Hob access for S4 support (memory type information > HOB). > > 2. Boot from Firmware Volume support. > > > > But that requires introducing two or more library > classes so affecting > > all existing platforms. EfiCreateEventLegacyBootEx() > in UefiLib also > > touches PI event gEfiEventLegacyBootGuid. > > > > And I think the value of refactor might be small. > > > > I think root cause of this problem is not > UefiBootManagerLib includes > > PI, it's the assertion in DxeHobLib. > > So I am thinking maybe a very light fix is to remove > the constructor of > > DxeHobLib. > > > > I talked with Liming about this and he suggested that > instead of > > removing the constructor, it's safer to just remove > the assertion in the > > constructor. Because removing the constructor of > HobLib may cause > > AutoGen process generates a different order of library > constructors > > calling sequence, which may break the platform. > > > > So I propose to just remove the assertion in DxeHobLib > constructor. > > Thoughts? >=20 > I think keeping the constructor itself is important and > a good idea. >=20 > I also think that we should *perhaps* keep the assertion > *somewhere*, > just not in the constructor. Because, at least some of > the HobLib APIs > cannot return errors (and their callers expect them to > succeed at all > times). This suggests we should still trip assertions > when a HobLib API > is called *in practice* on a non-PI UEFI platform. >=20 > Thanks > Laszlo