From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web10.199.1624403483370329104 for ; Tue, 22 Jun 2021 16:11:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=Jo8YAwpJ; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: guo.dong@intel.com) IronPort-SDR: 7HGqu27VYQrA5ZmkuWvsmOLPeUWWguc6HNRX9luCg9bJq207YTJPIswxYHcv1BiwYwChFPLS0W ARExcIsBWUmg== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="268297972" X-IronPort-AV: E=Sophos;i="5.83,292,1616482800"; d="scan'208";a="268297972" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 16:11:20 -0700 IronPort-SDR: z1iwxaZhRmF7PYnMFy2ypxwZDfTETJkHQaVJc5yqkzjPSW0XkNz2PKZ2cdUidgvH/xha+u3Jiy GgLEDKj02VDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,292,1616482800"; d="scan'208";a="490465172" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga002.fm.intel.com with ESMTP; 22 Jun 2021 16:11:20 -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; Tue, 22 Jun 2021 16:11:19 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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 via Frontend Transport; Tue, 22 Jun 2021 16:11:19 -0700 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.174) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.4; Tue, 22 Jun 2021 16:11:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m4U380V2eklyMjtMVsCHCifubKrlNsdqmvs4xuCdIfteFCuMqGOgXZrqa5l2cw00MVCtrrUm/8lmPl3Gnuchrbgh7Gly9yh/ocib0gsj4dCPVQAc8blu1HjXzvfpxD94SpqPRXoVK1LqJx+sYKn8a84TJ/Roa0JImAwfkjl7V+jpqDQXXHu5ku2jMIF+zdJ2E1yOYuWR/lII4+A2+KNph+sj9iUx+5D7OR8S7Ggu1hkD0pE6WQlwegY9OEFUkpyL/UxOnr1mbNyKvwfidtS093Uena6Linb4QezDKUeuEwitmwTrCmSabUZjJzj1h/AeVPGy1Sd07l67pDxvFX8y1A== 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=bHWXp+ZBZOwYWRTenvvYoSclcN8M7Hb1+aH/d5GXbdI=; b=R7V8UY2sNWMCbvyrDcSLg2rapeRO19xbUxClSr+yH5TdONG/rg4nlhxEdToCQYdlVX2+2ybOJsRp9Qn2Q5N3LJpMdch8gmn3jwaIVmsYO2BxwKlnTLKq/k1rhQKqV3Ojkf+pmv52zlcgG8p4i7erLfRrm/fUOF62ovqxttsAkdRUbP5NKayArYweICiTEKrImSSvxI80kAQS9TS7UHr7HQu/Zfz0EBz4DobzRraGpIGOdGZVQBF29VGTzWy9t6IK/Bl4A3JXrbgtt0whiGj/K0uY2zQKBYkZ7PI3wf0tlzIEfh0gL7IImsX+aQfJEbSUN+4CNoSJJhFTljmLU9GPxw== 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=bHWXp+ZBZOwYWRTenvvYoSclcN8M7Hb1+aH/d5GXbdI=; b=Jo8YAwpJQ///w9HhnmcIAZ0NRI3OhNI4aDwFAq4d6Cb/pgt7/eI6BQsHwuzUPK6bZLcEwy+n4oK+mHtDCnBQIllAYKV7JF6xbq1XIfhFZxRNfojuKHCX4cLBX4HIDqgdrgpFHFCJ5059XlhcE7CkIPw68TqFnLI2B6fK11s1qig= Received: from BYAPR11MB3622.namprd11.prod.outlook.com (2603:10b6:a03:fe::30) by BYAPR11MB3815.namprd11.prod.outlook.com (2603:10b6:a03:fa::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.23; Tue, 22 Jun 2021 23:11:18 +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; Tue, 22 Jun 2021 23:11:18 +0000 From: "Guo Dong" To: "Tan, Dun" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "You, Benjamin" Subject: Re: [PATCH 2/2] UefiPayloadPkg: consume the BootManagerMenuFile HOB Thread-Topic: [PATCH 2/2] UefiPayloadPkg: consume the BootManagerMenuFile HOB Thread-Index: AQHXZnoLh4e6o4cm+02VegZQTLF1oKsgqUWA Date: Tue, 22 Jun 2021 23:11:17 +0000 Message-ID: References: <20210621084633.1593-1-dun.tan@intel.com> <20210621084633.1593-3-dun.tan@intel.com> In-Reply-To: <20210621084633.1593-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: b5f52a22-9229-49d9-28f8-08d935d30aa7 x-ms-traffictypediagnostic: BYAPR11MB3815: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:341; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: t1R7010ubllzn1Q48eJKafs0bb3rT2RCdtRU31nmdukc40+3ZYA/3bW8iiPSklm80q+HNmtWyo4ouCBUtHM0vDLvYBSlX190kQxQIn3ezuzGXUcexHej/2yYFofGgAPha5CXbqGplHgcKDOU2wncwR6FfkHjfNrfJWlbttNhANrUX8kqKI4xfS+C67VKIqF5BbTGKkZch5aVAT2f2hzOmss1eAx8vuwvNRO33Tp5vWkEzEioPCirngIyFXwhljdFD1Hh627fKfLZI5mrv8WUZwmCqShcg5FQY2y7hMu8KFVY0Ztmkf1gfyrZwmpdPqS9plYSLvuFCyiVNweFWvfqa/bakgvDrUZ1VyfstA1nYT2DpOge+lDJTr4V0Ywhz2FAmDwh4NxvPQhyM72a4bcTx66p6SAnjmmE73VGZ0fZ90igAXFQC5wyZyr+uVDhrlRck1tzKQVNzexHRcE+sYhL6eje2nbavfm6dgrmIp618/Z93KbnUnLCEctep8vLLzR3AXVU4WwI/yztZL9qSj8Vx8yXzNA2M3n2AdX3dEuf4vv4qwBCYXtXGHiG01/jAO3nckRiJQaVRsdnVcHtVhwhmlZISSFaGAwP961hXusKtrw= 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:(396003)(346002)(136003)(366004)(39860400002)(376002)(26005)(52536014)(122000001)(83380400001)(316002)(107886003)(8676002)(478600001)(186003)(4326008)(5660300002)(7696005)(33656002)(8936002)(6506007)(55016002)(66476007)(64756008)(76116006)(66446008)(66946007)(9686003)(66556008)(86362001)(110136005)(54906003)(71200400001)(53546011)(2906002)(38100700002);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?9TZs1vL7WbJdAqQmVopj4UV9BRakkjyrFfhvN0hS+mbN+9/QVYBwp/UM4Bmt?= =?us-ascii?Q?TvOqwmMygpPnKk3KgeaRR/XofJ7YbJmhTnS3uJVMFQ3Fd96j/+cSsVHa4Egl?= =?us-ascii?Q?F56/HaZthvvHzOYTiqtOTGEy6dfP9Kc/VMj2+jZlvI+8cATfRhAgg6OUzS1u?= =?us-ascii?Q?oWxmWIXhLXa0752+MEylof0+bclKMc428WuPkp9Abjt1PKb8UKb30NvOZVsR?= =?us-ascii?Q?HSkC4Pecw4IBv7GToqRLYLPx5gLea0dYVWVJ9iVEs3db4/XcwzdS0y1lsGvv?= =?us-ascii?Q?gDDYDPdM7CEnL+JNZAuVoV8Bd5HB024WRpRQrmeN9GhczeMKvc+KjHvZuO+2?= =?us-ascii?Q?AmM0s9Kg7xxkSSltdAWb5oES4VpqZ/7O/KVflpYD3zIexXSLIzwa5FhPaqS/?= =?us-ascii?Q?/4YqyqQafcbnIWaBLocY2+QHnN7TJmysvnVlmG4o7LVmv+p63MZsdSFmz7uQ?= =?us-ascii?Q?MUjPq2glb6X2u7sD2YSR244L5PaljNRzFH7w0x0UpxGYoI3vB+SbwX067OMi?= =?us-ascii?Q?TufKLjLmLwzcMe0ofJhUi5NmZ4Y+ETSgrCsEXWwZKHnv8PCplSm+RnhNp+u8?= =?us-ascii?Q?IsLKhBAJYCCo+/k9TdsfvMQ3lmDh7IaazbR3gCjha3dd3Gw4I9LNHgxBQhST?= =?us-ascii?Q?PmcBZbzWYxtkeMTRVS+lXjSWJShi2QcBcKut0bz/UQy4DOCZ7909Iw2ibREQ?= =?us-ascii?Q?iCDV+Q4e61ZCOH6+Ndg9I+2W3/bKP/Ztna3eLRqmhXd8/0c/jC1fzspRo5I3?= =?us-ascii?Q?YeZk6Z/rgYk1CBnrdiztzOJE2zW+VhwqxEasC8hx3IkcPqDyQXVe3LkihwY8?= =?us-ascii?Q?CQmKOEfbteuAB08MlqgJteBaedTl+Ar1licCBg+IRkOKt9/3gCIano04XMRw?= =?us-ascii?Q?YeIeJ2uPUHhuacBbt39w1+2Lft8riZJ8itPn0Mqu5QMwffoU2U5/zSNl8Hdu?= =?us-ascii?Q?bcy9xtPfT9/EkMglC66QjQUpZrhNn5h7PkwWE8YpkiovLjvEwW0+P0hNxYAC?= =?us-ascii?Q?8zWhNm7Ucvx8AD7Fz7R3BkuB3rBu1VTFWyOOEoPn4XRX3gAiHUnhEr8+IYdQ?= =?us-ascii?Q?rIik8kq1fKPkq0BHSSVKH3d1Fej52XkxneHJv5WaNI5hhYEHs/fXXMTprNOp?= =?us-ascii?Q?gOZU67aESJuVsA8d4BH58fPjREIcz2NbqdSMS4bMYEUtdA9m9/nL4P8BCQxF?= =?us-ascii?Q?YNTWY8vx4UxdAcniYLwGFXTnjlaXbZgUkODCy4hRzw7aeMz1ob8Qlnoc4nsR?= =?us-ascii?Q?2RmPcJ71pA32/p2TpVLqO6y0ePLzd6bavEpJsLg2jz32Y8EvpN8DHFkjfoIQ?= =?us-ascii?Q?XLpTJDXIB/Yag2pj0JmJTp/u?= 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: b5f52a22-9229-49d9-28f8-08d935d30aa7 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jun 2021 23:11:18.1135 (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: yAWvqRZR3ATq02mQjZJep0ptMyYQ38rKMu5N5J56Y7teY3wE3dzllqOFTzQ0dIHtmIpPxY2VbS8l2kVS2A0sVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3815 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 Please check the comments below. > -----Original Message----- > From: Tan, Dun > Sent: Monday, June 21, 2021 1:47 AM > To: devel@edk2.groups.io > Cc: Ma, Maurice ; Dong, Guo > ; You, Benjamin ; Tan, > Dun > Subject: [PATCH 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 > | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ >=20 > UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.i > nf | 5 ++++- > UefiPayloadPkg/UefiPayloadPkg.dsc = | 2 +- > 3 files changed, 56 insertions(+), 2 deletions(-) >=20 > diff --git > a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c > b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManager.c > index fce48d26a1..afd9664959 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,52 @@ PlatformBootManagerUnableToBoot ( > return; > } >=20 > +/** > + Get/update PcdBootManagerMenuFile from GUID HOB which will be > assigned in bootloader. > + > + @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; > + Status =3D EFI_SUCCESS; It looks the Status initialization was not necessary, please double check a= nd remove it. And please add function parameter description in function comments. > + GuidHob =3D GetFirstGuidHob > (&gUniversalPayloadBootManagerMenuFileGuid); > + // > + // Find the buffer information and update PCDs > + // > + if (GuidHob =3D=3D NULL) { > + // > + // If the HOB is not create, the default value of PcdBootManagerMenu= File > will be used. > + // > + return EFI_SUCCESS; > + } > + It is more clear if moving the comment message " Find the buffer informatio= n and update PCDs" to here. > + 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); > + } else { > + return EFI_NOT_FOUND; > + } > + > + ASSERT_EFI_ERROR (Status); > + return EFI_SUCCESS; > +} > diff --git > a/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi > b.inf > b/UefiPayloadPkg/Library/PlatformBootManagerLib/PlatformBootManagerLi > b.inf > index 600a535282..9c4943a0e0 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 > + gUniversalPayloadBootManagerMenuFileGuid >=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