From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.88, mailfrom: ray.ni@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by groups.io with SMTP; Wed, 26 Jun 2019 19:12:30 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jun 2019 19:12:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,422,1557212400"; d="scan'208";a="337424155" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga005.jf.intel.com with ESMTP; 26 Jun 2019 19:12:30 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 26 Jun 2019 19:12:30 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 26 Jun 2019 19:12:29 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.185]) by SHSMSX153.ccr.corp.intel.com ([169.254.12.76]) with mapi id 14.03.0439.000; Thu, 27 Jun 2019 10:12:27 +0800 From: "Ni, Ray" To: "devel@edk2.groups.io" , "dwmw2@infradead.org" CC: Laszlo Ersek Subject: Re: [edk2-devel] [PATCH v2 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription() Thread-Topic: [edk2-devel] [PATCH v2 4/7] MdeModulePkg/UefiBootManagerLib: export EfiBootManagerGetBootDescription() Thread-Index: AQHVK0wQFlkWhoaK506WWsteRM6ZVaauxK+w Date: Thu, 27 Jun 2019 02:12:27 +0000 Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C1F24C1@SHSMSX104.ccr.corp.intel.com> References: <20190625114859.795331-1-dwmw2@infradead.org> <20190625114859.795331-4-dwmw2@infradead.org> In-Reply-To: <20190625114859.795331-4-dwmw2@infradead.org> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzIwYTAxMDAtOGE0OC00MTkzLThkMDgtMTlmMjQxZGUxNGRhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRTg4eHlIVlNETHF3SFhkUzVjWjNKWTBWVjdjVTVlK3RyeTFZV2pIdlFxSWhMMHFBKzdzY1I0M3pNVmwrSHlFTiJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.600.7 dlp-reaction: no-action 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 agree to expose *GetBootDescription() API. But can you remove the 1st parameter Prefix and let caller to pre-pend it = after calling this API? > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > David Woodhouse > Sent: Tuesday, June 25, 2019 7:49 PM > To: devel@edk2.groups.io > Cc: Laszlo Ersek ; Ni, Ray > Subject: [edk2-devel] [PATCH v2 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 > provided by the individual disk drivers themselves. >=20 > Signed-off-by: David Woodhouse > Reviewed-by: Laszlo Ersek > --- > .../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..06edba8b4d 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