From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web08.2677.1624507157205374214 for ; Wed, 23 Jun 2021 20:59:17 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=zveLAGTB; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: guo.dong@intel.com) IronPort-SDR: tYogc+R2Vk7t4pJFpqYoBgXSsWoq3RXzIcVrOX33gk39RbM43k0/0ot3gBdTf0+1H5d67nllsv b6QlagcBotAg== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="293018759" X-IronPort-AV: E=Sophos;i="5.83,295,1616482800"; d="scan'208";a="293018759" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 20:59:15 -0700 IronPort-SDR: /UXp+/MknCkTrWU+sKq+0XaogUdyPKwUH3JHkrq078Bx0xVdH1ycgbf9Z4RZ176Ohus51Glxkd eEr5OgkcnLtQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,295,1616482800"; d="scan'208";a="453265910" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP; 23 Jun 2021 20:59:14 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Wed, 23 Jun 2021 20:59:13 -0700 Received: from fmsmsx606.amr.corp.intel.com (10.18.126.86) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Wed, 23 Jun 2021 20:59:13 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4 via Frontend Transport; Wed, 23 Jun 2021 20:59:13 -0700 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.173) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Wed, 23 Jun 2021 20:59:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QxEfqgh/urt8TLO3Z7Kaj85HBCG83Axcn4GTnNA/wuO6gYa307XndJ6aa15R8T6H+Fgk9rNHsJwGtdpuoUydT8IMEWWhiPXlHtEz5Sx51DHNRH28XoZjc3GbHoIJ0wi6SL8J2mTeA3Vl0svebERtBTsZl+c/rLh0rVFCLrh/lig7hXHQGHF94645I1Q6RHckZFkia8YJbJd79GOv1X2FqvxJGZf6Z1Pzb/6QPnPu4awqRODfpnLxVQaDnJkGg/PK0U3rrPIhDtGrQ8zVae3eCNmsR6kdH87yvFp9Q3I9abYE7foSHOoMRUJttXHIN0asq/fhxQ5DFuSBcqbfFqoOcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GUgG7pm99AoVoweCK1+xX/kWcAMNxGleFt2jaVepOig=; b=YZqVyhcVr6LIJaqZs2cIQi6cuxVRhib8MnBgNMXN1HCVuYved0b3D4Lz50W9CZVePfCBNsJBVjourp1pFG0ZU4KdCI1AuB2rtsODcIo+v5sVF6laA+ADWR7u+HDiHtbsiLmj3RYf7BRMedMuyhwGHXnhJQpNgxQGr0ZNez0I8sYLICnnuRVdAJrfZpiq7Ge19zFhVdY8dahHXxe/SXgw2ECv9LXAtqxkxVJz5eAlNfL7ygaPl3wi0fZK4yrfDQMEQNFuJ5r3LSZe4JggDo47QJ5buH9esmjRlyhBHIUpLuaoGDo1lZK53s5nZWYf8YhA/ZIIkYTdCjSGo7agTRy8XQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GUgG7pm99AoVoweCK1+xX/kWcAMNxGleFt2jaVepOig=; b=zveLAGTBAmAX0v1lRzLVFIYPV0XExn7noba5CEP152CGTebUhZxMnCuUWmYnVrL8defpaRpF3Tby5+I0z97Oy03PRTZxkTUssDIh08+I4fWT/3ycmzX+tJZXgy/ivIBI0TJvpdgjihSyNKSlsM2nTqiJ2JoSTFYC4iE+PRkJrzs= Received: from BYAPR11MB3622.namprd11.prod.outlook.com (2603:10b6:a03:fe::30) by SJ0PR11MB4862.namprd11.prod.outlook.com (2603:10b6:a03:2de::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Thu, 24 Jun 2021 03:59:12 +0000 Received: from BYAPR11MB3622.namprd11.prod.outlook.com ([fe80::247b:262c:b8da:710b]) by BYAPR11MB3622.namprd11.prod.outlook.com ([fe80::247b:262c:b8da:710b%7]) with mapi id 15.20.4242.023; Thu, 24 Jun 2021 03:59:12 +0000 From: "Guo Dong" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "You, Benjamin" Subject: Re: [Patch V2 2/2] UefiPayloadPkg: consume the BootManagerMenuFile HOB Thread-Topic: [Patch V2 2/2] UefiPayloadPkg: consume the BootManagerMenuFile HOB Thread-Index: AQHXZ9yTS6zbOeHAvUKvJrilyBIcG6siitRg Date: Thu, 24 Jun 2021 03:59:12 +0000 Message-ID: References: <20210623030424.2096-1-dun.tan@intel.com> <20210623030424.2096-3-dun.tan@intel.com> In-Reply-To: <20210623030424.2096-3-dun.tan@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [68.104.146.79] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 64fd9984-db0a-4b6d-969e-08d936c46d2c x-ms-traffictypediagnostic: SJ0PR11MB4862: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:370; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Uj5Pt/L/3yBfrk8t3+RxwULitKw/mQchWUXTpIC3mTEAD5X0Q1MMv5lBQhTRlMtWm6aFPEnyxTHWSc15judSIZI7zLAPlaI8g2z9YeJP08cEfS0VFIbGnKXIZcToUtRrX8jSqMzG8i3UdQe9bwSzexDj8OU3t+7Uo8KumYWDLPuulAdR0Sj+X4dPsNQS8mwkMIXAMEOSgfxST8Q6YKaZOnZ4Pt6/5GdygB2YKLmgciYXmGRcE1xGBxV2LUJuwWr6klyUyrorzsA8lp2kYiD9ywldWNkR4PnYuDKcPFx9KE3MDWKpwgcYsG+zRdpwbg8SuXDIw7OBQOEBS1RJZiXHo7MaAvsK6R1Kxxv6EqOCtKWzb6dRXxloBq5ybCiFsQvquw/+9MmYzKybkXxDjW0izW3gs6Vx3MrAMovz9AVyrlj3v1KroVMJ1gIkVq0XIw3k2uy332gy/9+hT1v9R6sbuAJMlwS90L9xbnmksASclWDsG8Jl45Mu1/KO3pixa2n6d/IUlWkVkQuTQ7OYA50THmqC8eo4EN9u1Bl69d6Mhxb5NZC7e+eo7f+2JKjty2bbSX9EcgO5q/azvwxNHAl3HULkIoiJZfJCR2m3326CYPI= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR11MB3622.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(136003)(396003)(39860400002)(346002)(376002)(2906002)(186003)(26005)(107886003)(76116006)(52536014)(4326008)(38100700002)(86362001)(7696005)(66946007)(66476007)(122000001)(5660300002)(8936002)(9686003)(33656002)(110136005)(6506007)(71200400001)(478600001)(66556008)(55016002)(8676002)(66446008)(64756008)(53546011)(54906003)(83380400001)(316002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?07K49zFg+fuRC/4B/l4udCPiX1NcPbJDo+oZ6h+9HwK2pQ/knrD+qFUEJjNR?= =?us-ascii?Q?9coiw5CqQnE2vpa/hVrC2YA5o0QzGZtsyXJsIo7Pas85rjEDgnWHmcDNCMxF?= =?us-ascii?Q?8Y+KpyUI/5Cvat77JxgpoJttjQyyih5FtbxuvtBrP8W/fOWwQ4rxj259+B82?= =?us-ascii?Q?boA8dSB2VPgiDDuO3N9oLje0d9vf5w+92MuSzLCL/MYEfQmOM5dJbPMyMLsd?= =?us-ascii?Q?inirPl4UyxXF8JSEeg54z0Tr1bhqy/DYTqWR1RvO8XuJ7W7ICfciNnliyzLI?= =?us-ascii?Q?PVFD6HYH1dGN/5F68WWymRssEhz3l3RCy53qHFDbMwU/4WQ53fJkQ/DJkEuO?= =?us-ascii?Q?XOmGLAr1RNYWlMzFRY2MrdEs6v4IfJ9eY9c6VTZuRs9J8lRRHP+D7JEMKoVu?= =?us-ascii?Q?ueWl2wN5nEgzU5jCHRUKydwmYF1JfMiMVUg/zK7QtBjatcxgjR8JWW/sW7F8?= =?us-ascii?Q?iQTSJGp7uHDrfVlu8kS6TKWx2bcwaZjh3zt03X5Vgp+GvDQF9qPj9kCyVYl5?= =?us-ascii?Q?nNSBItcBRLlLcPWXkLxirCeaLGCx1wnomVm/4mahDd8Cn2FoDa00PUuvBO3z?= =?us-ascii?Q?+uSyl7pgI7P3GO4PRDQL6b4AcNn1ATeddA8WgiXENmvtOBlNg2gBySz0Pxbr?= =?us-ascii?Q?MjyeWljohbQdSLRiyfc5pHi5KT0roFQ7A823UrCgxmn6WokpF2vkm+QAbNHr?= =?us-ascii?Q?MVRJEIqg6hcUHoN5qgmOnYIaI+AIGDSnFT49O16L8RYqAWTv9C0GOab7OK+R?= =?us-ascii?Q?BKn+z/r/87t27mc1QsymNObmcDe/F3Ir1ghaHD9a82fkMfZD1h3ZRSeONHon?= =?us-ascii?Q?BE7ISi/1AzNHhudNjTFd7D7JZ4xIe3Y1f+mUhAxQDdhdFhd4ZO1Te4KE/w++?= =?us-ascii?Q?NpHZ6R01r16v4krtZZPrsKq9lM5WOlgpK2X9hkfnCI0xoZqnefBXKbM4sVN/?= =?us-ascii?Q?L19zguUv5zCY1EfHNr327uFSay8GyhjZaf7u3Ga3+MCL43snI3WCMu/I3/SJ?= =?us-ascii?Q?+bTv5ESYj/E+8ymv0GLYSV2P8+yX2SGZhTQF35GdarXXtlgJY6sQ3ddGR7iT?= =?us-ascii?Q?Vxo6sNXMICI8ZypW/Ikal+000YJT1RGqR5zURspLNXWImnckF/jXEyRuenwj?= =?us-ascii?Q?d1hSXA6lKR+lVERm41b10IThGn540xk0t4+uTdu3J9G0MvlL65q3uvbVgo/g?= =?us-ascii?Q?lzs29zq9Rn4tO/B5hrsT90jr8dLL1wXCC5CsaV6wuC7da9a+FABEe8XsL3Ns?= =?us-ascii?Q?6fzqtF7OAZrMMmlUxooy3nUVOFzpDCO5baWD4SPYnXsPy6Pcimn55ukRvT95?= =?us-ascii?Q?iwkFlhQIoRmY/mI2EcLZTnLr?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3622.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64fd9984-db0a-4b6d-969e-08d936c46d2c X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Jun 2021 03:59:12.1675 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ESl34q3xu5Ml+ouhCak8bXVaswMvwTaV3r+oJNeK/sfjD55HJ0/r3GoSHEqnBKt79VAWLFrZB7evdVRaxITzvw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR11MB4862 Return-Path: guo.dong@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Guo Dong > -----Original Message----- > From: Tan, Dun > Sent: Tuesday, June 22, 2021 8:04 PM > To: devel@edk2.groups.io > Cc: Ma, Maurice ; Dong, Guo > ; You, Benjamin ; Tan, > Dun > Subject: [Patch V2 2/2] UefiPayloadPkg: consume the BootManagerMenuFile > HOB >=20 > Consume the BootManagerMenuFile HOB in PlatformBootManagerLib > This Lib is in UefiPayloadPkg >=20 > Cc: Maurice Ma > Cc: Guo Dong > Cc: Benjamin You >=20 > Signed-off-by: DunTan > --- > UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c > | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ >=20 > UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.i > nf | 5 ++++- > UefiPayloadPkg/UefiPayloadPkg.dsc = | 2 +- > 3 files changed, 57 insertions(+), 2 deletions(-) >=20 > diff --git > a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c > b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c > index fce48d26a1..c4d317fa9e 100644 > --- > a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c > +++ > b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c > @@ -10,6 +10,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > #include "PlatformBootManager.h" > #include "PlatformConsole.h" > #include > +#include > +#include >=20 >=20 > UNIVERSAL_PAYLOAD_PLATFORM_BOOT_MANAGER_OVERRIDE_PROTOCO > L *mUniversalPayloadPlatformBootManagerOverrideInstance =3D NULL; >=20 > @@ -286,3 +288,53 @@ PlatformBootManagerUnableToBoot ( > return; > } >=20 > +/** > + Get/update PcdBootManagerMenuFile from GUID HOB which will be > assigned in bootloader. > + > + @param ImageHandle The firmware allocated handle for the EFI image. > + @param SystemTable A pointer to the EFI System Table. > + > + @retval EFI_SUCCESS The entry point is executed successfully. > + @retval other Some error occurs. > + > +**/ > +EFI_STATUS > +EFIAPI > +PlatformBootManagerLibConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > +) > +{ > + EFI_STATUS Status; > + UINTN Size; > + VOID *GuidHob; > + UNIVERSAL_PAYLOAD_GENERIC_HEADER *GenericHeader; > + UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU > *BootManagerMenuFile; > + > + GuidHob =3D GetFirstGuidHob (&gEdkiiBootManagerMenuFileGuid); > + > + if (GuidHob =3D=3D NULL) { > + // > + // If the HOB is not create, the default value of PcdBootManagerMenu= File > will be used. > + // > + return EFI_SUCCESS; > + } > + > + GenericHeader =3D (UNIVERSAL_PAYLOAD_GENERIC_HEADER *) > GET_GUID_HOB_DATA (GuidHob); > + if ((sizeof (UNIVERSAL_PAYLOAD_GENERIC_HEADER) > > GET_GUID_HOB_DATA_SIZE (GuidHob)) || (GenericHeader->Length > > GET_GUID_HOB_DATA_SIZE (GuidHob))) { > + return EFI_NOT_FOUND; > + } > + if (GenericHeader->Revision =3D=3D > UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU_REVISION) { > + BootManagerMenuFile =3D > (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU *) GET_GUID_HOB_DATA > (GuidHob); > + if (BootManagerMenuFile->Header.Length < > UNIVERSAL_PAYLOAD_SIZEOF_THROUGH_FIELD > (UNIVERSAL_PAYLOAD_BOOT_MANAGER_MENU, FileName)) { > + return EFI_NOT_FOUND; > + } > + Size =3D sizeof (BootManagerMenuFile->FileName); > + Status =3D PcdSetPtrS (PcdBootManagerMenuFile, &Size, > &BootManagerMenuFile->FileName); > + ASSERT_EFI_ERROR (Status); > + } else { > + return EFI_NOT_FOUND; > + } > + > + return EFI_SUCCESS; > +} > diff --git > a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi > b.inf > b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi > b.inf > index 600a535282..9c4a9da943 100644 > --- > a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi > b.inf > +++ > b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi > b.inf > @@ -13,7 +13,7 @@ > MODULE_TYPE =3D DXE_DRIVER > VERSION_STRING =3D 1.0 > LIBRARY_CLASS =3D PlatformBootManagerLib|DXE_DRIVER > - > + CONSTRUCTOR =3D PlatformBootManagerLibConstructor >=20 > # > # The following information is for reference only and not required by th= e > build tools. > @@ -46,9 +46,11 @@ > HiiLib > PrintLib > PlatformHookLib > + HobLib >=20 > [Guids] > gEfiEndOfDxeEventGroupGuid > + gEdkiiBootManagerMenuFileGuid >=20 > [Protocols] > gEfiGenericMemTestProtocolGuid ## CONSUMES > @@ -70,3 +72,4 @@ > gEfiMdePkgTokenSpaceGuid.PcdUartDefaultDataBits > gEfiMdePkgTokenSpaceGuid.PcdUartDefaultParity > gEfiMdePkgTokenSpaceGuid.PcdUartDefaultStopBits > + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile > diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc > b/UefiPayloadPkg/UefiPayloadPkg.dsc > index 21b360256b..e46b867d30 100644 > --- a/UefiPayloadPkg/UefiPayloadPkg.dsc > +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc > @@ -289,7 +289,6 @@ > !endif > gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseMemory|FALSE > gEfiMdeModulePkgTokenSpaceGuid.PcdUse1GPageTable|TRUE > - gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, > 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0= x66, > 0x23, 0x31 } >=20 >=20 > !if $(SOURCE_DEBUG_ENABLE) > @@ -297,6 +296,7 @@ > !endif >=20 > [PcdsPatchableInModule.common] > + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, > 0xaa, 0x2c, 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0= x66, > 0x23, 0x31 } > gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x7 > gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x8000004F > !if $(SOURCE_DEBUG_ENABLE) > -- > 2.31.1.windows.1