From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: ray.ni@intel.com) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by groups.io with SMTP; Mon, 24 Jun 2019 19:00:26 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jun 2019 19:00:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,413,1557212400"; d="scan'208";a="188117414" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga002.fm.intel.com with ESMTP; 24 Jun 2019 19:00:25 -0700 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 24 Jun 2019 19:00:25 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 24 Jun 2019 19:00:24 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.185]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.89]) with mapi id 14.03.0439.000; Tue, 25 Jun 2019 10:00:23 +0800 From: "Ni, Ray" To: "devel@edk2.groups.io" , "dwmw2@infradead.org" CC: Laszlo Ersek Subject: Re: [edk2-devel] [PATCH 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription() Thread-Topic: [edk2-devel] [PATCH 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription() Thread-Index: AQHVKIEsOoJnReRigk2/hjVfL/JtpqaroLPA Date: Tue, 25 Jun 2019 02:00:22 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C1EDD71@SHSMSX104.ccr.corp.intel.com> References: <20190621223156.701502-1-dwmw2@infradead.org> <20190621223156.701502-4-dwmw2@infradead.org> In-Reply-To: <20190621223156.701502-4-dwmw2@infradead.org> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: ray.ni@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable David, I am afraid it will cause issues when exposing EfiBootManagerGetBootDescri= ption(). If you check the implementation, this API visits mPlatformBootDescriptionH= andlers. mPlatformBootDescriptionHandlers is modified by another already-exposed AP= I EfiBootManagerRegisterBootDescriptionHandler(). The *Register* API is to provide a capability to PlatformBootManagerLib to= create boot option description for special/platform-specific boot options. But the implicit requirement is boot option description can only be retrie= ved within BdsDxe driver because only BdsDxe driver links to PlatformBootManagerLib. Thanks, Ray > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of David > Woodhouse > Sent: Saturday, June 22, 2019 6:32 AM > To: devel@edk2.groups.io > Cc: Laszlo Ersek ; Ni, Ray > Subject: [edk2-devel] [PATCH 4/7] MdeModulePkg/UefiBootManagerLib: > export EfiBootManagerGetBootDescription() >=20 > It would be useful for LegacyBiosDxe to be able to get descriptive names= for > block devices, for legacy boot options. It gets a bit confusing when the= y're all > called "Harddisk". >=20 > Since we have a collection of the special cases for various types of dev= ice > already in BmGetBootDescription(), let's export that with a minor tweak = to > let the caller set the "UEFI " vs. "Legacy " prefix. >=20 > There's no way we want to reproduce all those device-specific special ca= ses > again in the LegacyBiosDxe. It's bad enough that they exist in > UefiBootManagerLib in the first place, instead of being in a protocol pr= ovided > by the individual disk drivers themselves. >=20 > Signed-off-by: David Woodhouse > --- > .../Include/Library/UefiBootManagerLib.h | 16 ++++++++++++ > .../UefiBootManagerLib/BmBootDescription.c | 26 ++++++++++++++++--- > 2 files changed, 38 insertions(+), 4 deletions(-) >=20 > diff --git a/MdeModulePkg/Include/Library/UefiBootManagerLib.h > b/MdeModulePkg/Include/Library/UefiBootManagerLib.h > index 0b69a6021d..a9d6bfda88 100644 > --- a/MdeModulePkg/Include/Library/UefiBootManagerLib.h > +++ b/MdeModulePkg/Include/Library/UefiBootManagerLib.h > @@ -249,6 +249,22 @@ EfiBootManagerFindLoadOption ( > IN UINTN Count > ); >=20 > +/** > + Return the boot description for the controller. > + > + @param Prefix String prefix (e.g "UEFI " or "Legacy ")= . > + @param Handle Controller handle. > + > + @return The description string. > +**/ > +CHAR16 * > +EFIAPI > +EfiBootManagerGetBootDescription ( > + IN CHAR16 *Prefix, > + IN EFI_HANDLE Handle > + ); > + > + > // > // Boot Manager hot key library functions. > // > diff --git > a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c > b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c > index aa891feb17..dd4d160f31 100644 > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c > @@ -758,12 +758,15 @@ BM_GET_BOOT_DESCRIPTION > mBmBootDescriptionHandlers[] =3D { > /** > Return the boot description for the controller. >=20 > + @param Prefix String prefix (e.g "UEFI " or "Legacy ")= . > @param Handle Controller handle. >=20 > @return The description string. > **/ > CHAR16 * > -BmGetBootDescription ( > +EFIAPI > +EfiBootManagerGetBootDescription ( > + IN CHAR16 *Prefix, > IN EFI_HANDLE Handle > ) > { > @@ -785,10 +788,10 @@ BmGetBootDescription ( > // Avoid description confusion between UEFI & Legacy boot option = by > adding "UEFI " prefix > // ONLY for core provided boot description handler. > // > - Temp =3D AllocatePool (StrSize (DefaultDescription) + sizeof > (mBmUefiPrefix)); > + Temp =3D AllocatePool (StrSize (DefaultDescription) + StrSize > + (Prefix)); > ASSERT (Temp !=3D NULL); > - StrCpyS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPre= fix)) / > sizeof (CHAR16), mBmUefiPrefix); > - StrCatS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPre= fix)) / > sizeof (CHAR16), DefaultDescription); > + StrCpyS (Temp, (StrSize (DefaultDescription) + StrSize (Prefix)) = / sizeof > (CHAR16), Prefix); > + StrCatS (Temp, (StrSize (DefaultDescription) + StrSize (Prefix)) > + / sizeof (CHAR16), DefaultDescription); > FreePool (DefaultDescription); > DefaultDescription =3D Temp; > break; > @@ -814,6 +817,21 @@ BmGetBootDescription ( > return DefaultDescription; > } >=20 > +/** > + Return the boot description for the controller, for UEFI boot. > + > + @param Handle Controller handle. > + > + @return The description string. > +**/ > +CHAR16 * > +BmGetBootDescription ( > + IN EFI_HANDLE Handle > + ) > +{ > + return EfiBootManagerGetBootDescription(mBmUefiPrefix, Handle); } > + > /** > Enumerate all boot option descriptions and append " 2"/" 3"/... to ma= ke > unique description. > -- > 2.21.0 >=20 >=20 >=20