From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.131.1624491957820826361 for ; Wed, 23 Jun 2021 16:45:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=rve1zZdi; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: guo.dong@intel.com) IronPort-SDR: c1ghw0R98alPNeUOg7DNp9bCW8B/00EuRuNrRhnDk7tSl7586WZcCJJ3Duu16sCtnETd+KEF60 JdUI9QoKhXGw== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="187052281" X-IronPort-AV: E=Sophos;i="5.83,295,1616482800"; d="scan'208";a="187052281" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 16:45:55 -0700 IronPort-SDR: D9VIWfk7AyO7nVhecRsHvziDq3hj3qhKjNl1vAhw4UErmXNHMaBa21QWjoewz8Fh7EFb01Jsty 8MFqmd/JDgOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,295,1616482800"; d="scan'208";a="445122578" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by orsmga007.jf.intel.com with ESMTP; 23 Jun 2021 16:45:55 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX605.amr.corp.intel.com (10.22.229.18) 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 16:45:54 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX611.amr.corp.intel.com (10.22.229.24) 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 16:45:54 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx605.amr.corp.intel.com (10.22.229.18) 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 16:45:54 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.100) 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 16:45:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FUVooP0rpFtOBUPzLPvp8xb5mqj7mAwKYPXHmdBAmVGwx4sGLpTY9+tCZSYVpkkJTVBe89FEdFWxB2F/pm2C6opcf6cOMp2DJowm8pTKfbcuXgiN+yySzD8QT2cdsBt3M2kQo+L70pcMA+4+xcrbYKbrFv+KzbMYDL0DNmFlLFBjY6ekN6+syuh8co1oWGXaaa15IkWBbFZvQgh6f8NH7eDe1kOxkInMq82Djnzhc5HX+/EqSC8Ludhk3NbMbdWl9CxXlXTb0WR9ojFpnuoXGvYo6A9Nia6Ule2PYTTTc32n/qgGBR7+DER82rDw3Vm37I7RCdLmCnVvzbNjgOp/1A== 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=fe41SqToAlbDrBQIRWxiBaeOCooXVuN12BmWaGYZNJ0=; b=AgliKqWkQLQe0h/ZSUwlAp/tmYzKZHU8IVorLiQBzMKG0U0uAWbMsaHfTZQgRKye2pJVnxetCkMmEQWqob1syLnW0DNqidGrl/zZUr4SaDGhVAdBG0PKniH+ZWVrvy4wfdUf8e0JYhjdH0K6OxfENDS3YUrFMUo32BoDRFfFjxITg0uPDRZZWeH/hGyzpZz6kFei7jGUV6wEBWv69ucxwerXedSA2yE9YoRBNO3AFsS0Cq83mJ0PljFCqRBiFirtiw1cO9YkOUGyDXiSik7iw4xTinolnAUseJ9X9NmHb0riOD6VdYxCvPsWMucZ9upxHnISl/ke82GGLY4VxQ7mXQ== 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=fe41SqToAlbDrBQIRWxiBaeOCooXVuN12BmWaGYZNJ0=; b=rve1zZdihyV2utD2FxBUTnpxEdUoj7G+kwJi7fPGXD49HFM0bLe9/wOcXA77JRiH47xw7Vh8srDJ0/4RbdY/JUBnSMEKPG0CSfWXORGC5yjJlt627JxQJfAFgQMiwvM/O3XnC8+ChNJHaYdPuPOKvxf+Dh5kFE85tCg6jHYzao8= Received: from BYAPR11MB3622.namprd11.prod.outlook.com (2603:10b6:a03:fe::30) by BYAPR11MB3445.namprd11.prod.outlook.com (2603:10b6:a03:77::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.23; Wed, 23 Jun 2021 23:45:51 +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; Wed, 23 Jun 2021 23:45:51 +0000 From: "Guo Dong" To: "Liu, Zhiguang" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "You, Benjamin" , "Ni, Ray" Subject: Re: [Patch V2 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload Thread-Topic: [Patch V2 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload Thread-Index: AQHXZ9raMq+etdl4gEOh+o9P+7KMlqsiRA1w Date: Wed, 23 Jun 2021 23:45:51 +0000 Message-ID: References: <20210623025235.3311-1-zhiguang.liu@intel.com> <20210623025235.3311-2-zhiguang.liu@intel.com> In-Reply-To: <20210623025235.3311-2-zhiguang.liu@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: bf4f1807-8eca-4a3b-17d6-08d936a10906 x-ms-traffictypediagnostic: BYAPR11MB3445: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7691; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2qNVYq5xuJ0DwCVkPHCSS5dBETnVnnfnWrvS1G/19PJ1eqK9TLA70NVzSeWPO0yE3SEK+KmdmebFhZ9lAHBHdkJA/n1O8J7FFP502GVVGTW+HCUSB9DSGLl4FytscoX5eIAwF3evibpz2fMk0Ak5pKqCyoaDYSkj+uIRsQWnJQpJZMBWHD59v30ZK6PqiD8ZBNF9X/u7SudmXTfdeQiP0gSiQx8hpHSLL0Mpuncat7iF1QQ5RYcsyKiqgx+r+JXvLjEFP3IBcXsNEqB5qgUep6joRTq7pO4dXOma9WcXtKB2YQtuL1CGt5UR9Zioq6D2ZiqGLGQUOOajkpYdIA/qlq1jASPpMpxOGKTTqBkLwhH7L87j3nrd1z2A3X5Ocxa15U68/1YzQNbfjiuhaO6M33CMoDBF4BJAwy9iTJHbku6uFi7PSw1h+47d/lPCOSCTrgMCwcdUqz29OLklgDcD6PlnugwTKZ2zaMGQp9sv5xXZ9zYsCJ+IP+3QrD/ZHrCpkcd2AQCSvKtncNIIFs+mZTEFwWSf4FQ+s2pxM+XZRBStlQndpZITwe0YmuY9UJznXOYO967OGbfSDUmyib5JDwOxvLPI18MX7j19oFtCFNQ= 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)(396003)(376002)(346002)(136003)(39860400002)(186003)(26005)(107886003)(2906002)(66946007)(53546011)(30864003)(76116006)(9686003)(478600001)(4326008)(71200400001)(86362001)(83380400001)(66476007)(5660300002)(6506007)(38100700002)(122000001)(64756008)(66556008)(52536014)(66446008)(55016002)(8936002)(110136005)(33656002)(7696005)(316002)(54906003)(8676002)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2hp17w42RRZhY+6Oou2TtEsssroI3Wa/oWPi6FOWDlZrtUKRLHJWCuusmpcB?= =?us-ascii?Q?enRctWW0+JJljc39bl3kiBq6xfLeaVmA6/8Vt1XXzzAYHHBt8rVLgWAC64hU?= =?us-ascii?Q?gaNLyvWizF3ewIk4ARACC6FJdQPzE2y85UqJeDBWIOyxkcCpqEA0G2DWSzlj?= =?us-ascii?Q?GfAfHprChe9F2KAwmbQ2HP/2c/bpmEYxxns7J+vYxb8XRchBFdwWUgsASKHh?= =?us-ascii?Q?ohS/M2zn66OEFS68qMRWg/SE1PBzXi0ux5De/KmdZDq7m5wKeFOBnudDa1WQ?= =?us-ascii?Q?ZnM0y4jhvLJC6aCDQTLJckriG3A+6uEWZULVXlv10iTLkbOGvHAO+iHj0Sqo?= =?us-ascii?Q?+vaFiSCRtHSDWrQ3ec9RD3ZUTBbb/5lm/YDyIXcCr9ZkbdBg4HWV7PWJcsbf?= =?us-ascii?Q?qzxumQ7GamcMGDK82yIDyBIHy/k6uI0zQ8loMiW2yhSTuaiWax8L+dUuQ4jU?= =?us-ascii?Q?7XcYqoF9IuLYOuz1tvttPIjY4SkB3KbzBim86AAvJ2cCb0ghzIiKt3uCe+0Q?= =?us-ascii?Q?R93mLnlxkheLIF/Zs2XrXw0WN+LC2+zAsclm3Dx7Jgf4VGYcWwEaPzDuQ7Vb?= =?us-ascii?Q?eZsUchiGEyVnLURo1tlr0IrmPsQPkv03sc22WHP+4wDMDMX84d8upv8wiDSc?= =?us-ascii?Q?lBNGj7U8rYz0crtEiJSBA0U4CwPKvXen5vmnbLzHsATVsyB8W1HdD7Q/Yz1R?= =?us-ascii?Q?kRnMH6bzNZ/JpAaXzzTe661JtnW3IeGf0HjQ60H9uB4ZCkwCz+rhzw8UPtno?= =?us-ascii?Q?viWjxCn2Gs9gEG+2bML+D+HAG3zb2zp7+XLBD0VfqYmabkCDHwC9N+rqO17M?= =?us-ascii?Q?GHvUChelbCf7XzI+/lWe1r8Ndpuct0duoR3svnS/XTq9h2ULiJdHtJBtmqH7?= =?us-ascii?Q?XT2emg7XUYvDVRmwaqDwWAXprnpcTvhyDJU6uf8Fd8dgYN8Q2Jy0/D2OoJ8j?= =?us-ascii?Q?cQPxyVX2pEAJLE4D5xFCF8VoPu7m66niYuRIYABK6YHFqkGnEcNfZBVQdvD7?= =?us-ascii?Q?n2urwVJtZnshfposjiL5J+kGyYw91x5di2H7+3y37TdgFJBc9tfhzRUSXApZ?= =?us-ascii?Q?hLZSIuBjThn4m4lR+S+GfszlLErpi8n9+X8vTLyA0lWgIudiLDZfilqfPt+b?= =?us-ascii?Q?LH9RZaYiBmTYW8mjcgIGjARVkJ9R5Dbve844s97YgNNsIv8/KCJ4JSm+wf6n?= =?us-ascii?Q?AX3b4J/6DF60o0XurpTzfTl1K4L51SllDNSnGTtTR0NdNkz2AOynHRo2Ulka?= =?us-ascii?Q?G9YZ1vgZZyDxOys8pCWf/DLnaZtLAGS/4p3Z0AuMiih/wIJYvJind+7e1Y9K?= =?us-ascii?Q?Ecoc7nJT6w9mKQ4QcMrcxuMN?= 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: bf4f1807-8eca-4a3b-17d6-08d936a10906 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jun 2021 23:45:51.6495 (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: IUsWATg5RxTgbqObmH4yrrjQCgoO24dhngi2wSjoqpuwNfnDDG9JT/+ea/GJZ7tJEkjarMuUiTfO3mOoWdpXlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3445 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: Liu, Zhiguang > Sent: Tuesday, June 22, 2021 7:52 PM > To: devel@edk2.groups.io > Cc: Ma, Maurice ; Dong, Guo > ; You, Benjamin ; Ni, Ray > > Subject: [Patch V2 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload >=20 > V1: > For payload entry, use PayloadEntryHobLib as HobLib and payload entry > should initialize hob base. > For DxeCore, use new added DxeHobLib as HobLib, and DxeCore will > initialize hob base. > For Dxe Driver, use new added DxeHobLib as HobLib, and use DxeHobListLib > to initialize hob base. >=20 > V2: > Remove the UefiLib since it won't be needed. > Adding a new library DxeHobLib + DxeHobListLib instead of using the > DxeHobLib.inf in MdePkg is because the constructor needed be separated > from DxeHobLib. > If not, when building UefiPayloadPkg, the dependency chain is as below: > DebugLib -> SerialPortLib -> PlatformHookLib -> HobLib -> DebugLib > Each library has a constructor, and this becomes a constructor circle. > To break the circle, separate the constructor from the HobLib as a new > DxeHobListLib, which won't depend on DebugLib. >=20 > Cc: Maurice Ma > Cc: Guo Dong > Cc: Benjamin You > Signed-off-by: Ray Ni > Signed-off-by: Zhiguang Liu > --- > UefiPayloadPkg/Include/Library/DxeHobListLib.h | 27 > +++++++++++++++++++++++++++ > UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf | 36 > ++++++++++++++++++++++++++++++++++++ > UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni | 16 > ++++++++++++++++ > UefiPayloadPkg/Library/DxeHobLib/HobLib.c | 597 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > +++++++++++++++++ > UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.c | 66 > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > ++++++++ > UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf | 35 > +++++++++++++++++++++++++++++++++++ > UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c | 20 > ++++++++++++++++++++ > UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.inf | 28 > ++++++++++++++++++++++++++++ > UefiPayloadPkg/Library/{HobLib =3D> PayloadEntryHobLib}/Hob.c | 2= +- > UefiPayloadPkg/Library/{HobLib =3D> PayloadEntryHobLib}/HobLib.inf | 2= +- > UefiPayloadPkg/UefiPayloadPkg.dsc | 15 += ++++++++++---- > 11 files changed, 838 insertions(+), 6 deletions(-) >=20 > diff --git a/UefiPayloadPkg/Include/Library/DxeHobListLib.h > b/UefiPayloadPkg/Include/Library/DxeHobListLib.h > new file mode 100644 > index 0000000000..7e9b23f6d7 > --- /dev/null > +++ b/UefiPayloadPkg/Include/Library/DxeHobListLib.h > @@ -0,0 +1,27 @@ > +/** @file >=20 > + Provides a service to retrieve a pointer to the start of HOB list. >=20 > + Only available to DXE module types. >=20 > + >=20 > + This library does not contain any functions or macros. It simply expo= rts a > global >=20 > + pointer to the start of HOB list as defined in the Platform Initializa= tion > Driver >=20 > + Execution Environment Core Interface Specification. The library > constructor must >=20 > + initialize this global pointer to the start of HOB list, so it is avai= lable at the >=20 > + module's entry point. Since there is overhead in looking up the point= er to > the start >=20 > + of HOB list, only those modules that actually require access to the HO= B list >=20 > + should use this library. >=20 > + >=20 > +Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > +SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#ifndef __DXE_HOB_LIST_LIB_H__ >=20 > +#define __DXE_HOB_LIST_LIB_H__ >=20 > + >=20 > +/// >=20 > +/// Cache copy of the start of HOB list >=20 > +/// >=20 > +extern VOID *gHobList; >=20 > + >=20 > +#endif >=20 > + >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf > b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf > new file mode 100644 > index 0000000000..ff334a0d41 > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf > @@ -0,0 +1,36 @@ > +## @file >=20 > +# HOB Library implementation for Payload Phase. >=20 > +# >=20 > +# Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D DxeHobLib >=20 > + MODULE_UNI_FILE =3D DxeHobLib.uni >=20 > + FILE_GUID =3D 1a15b8b3-3e8a-4698-87b9-65aad9993b5= 2 >=20 > + MODULE_TYPE =3D DXE_DRIVER >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D HobLib|DXE_DRIVER DXE_RUNTIME_DRIVE= R > SMM_CORE DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER >=20 > + >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 EBC >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + HobLib.c >=20 > + >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + UefiPayloadPkg/UefiPayloadPkg.dec >=20 > + >=20 > + >=20 > +[LibraryClasses] >=20 > + BaseMemoryLib >=20 > + DebugLib >=20 > + DxeHobListLib >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni > b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni > new file mode 100644 > index 0000000000..4e02e9c2ae > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni > @@ -0,0 +1,16 @@ > +// /** @file >=20 > +// HOB Library implementation for Payload Phase. >=20 > +// >=20 > +// The Hoblist will be set by DxeHobListLib or other modules. >=20 > +// >=20 > +// Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > +// >=20 > +// SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +// >=20 > +// **/ >=20 > + >=20 > + >=20 > +#string STR_MODULE_ABSTRACT #language en-US "HOB Library > implementation for Payload Phase." >=20 > + >=20 > +#string STR_MODULE_DESCRIPTION #language en-US "The HOB Library > implementation for Payload Phase that doesn't contain HobLibConstructor" >=20 > + >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobLib/HobLib.c > b/UefiPayloadPkg/Library/DxeHobLib/HobLib.c > new file mode 100644 > index 0000000000..5d5ede0c17 > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobLib/HobLib.c > @@ -0,0 +1,597 @@ > +/** @file >=20 > + HOB Library implementation for Payload Phase. >=20 > + >=20 > +Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > +SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > +#include >=20 > + >=20 > +#include >=20 > +#include >=20 > +#include >=20 > +#include >=20 > + >=20 > +/** >=20 > + Returns the pointer to the HOB list. >=20 > + >=20 > + This function returns the pointer to first HOB in the list. >=20 > + For PEI phase, the PEI service GetHobList() can be used to retrieve th= e > pointer >=20 > + to the HOB list. For the DXE phase, the HOB list pointer can be retri= eved > through >=20 > + the EFI System Table by looking up theHOB list GUID in the System > Configuration Table. >=20 > + Since the System Configuration Table does not exist that the time the = DXE > Core is >=20 > + launched, the DXE Core uses a global variable from the DXE Core Entry > Point Library >=20 > + to manage the pointer to the HOB list. >=20 > + >=20 > + If the pointer to the HOB list is NULL, then ASSERT(). >=20 > + >=20 > + @return The pointer to the HOB list. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +GetHobList ( >=20 > + VOID >=20 > + ) >=20 > +{ >=20 > + ASSERT (gHobList !=3D NULL); >=20 > + return gHobList; >=20 > +} >=20 > + >=20 > +/** >=20 > + Returns the next instance of a HOB type from the starting HOB. >=20 > + >=20 > + This function searches the first instance of a HOB type from the start= ing > HOB pointer. >=20 > + If there does not exist such HOB type from the starting HOB pointer, i= t will > return NULL. >=20 > + In contrast with macro GET_NEXT_HOB(), this function does not skip the > starting HOB pointer >=20 > + unconditionally: it returns HobStart back if HobStart itself meets the > requirement; >=20 > + caller is required to use GET_NEXT_HOB() if it wishes to skip current > HobStart. >=20 > + >=20 > + If HobStart is NULL, then ASSERT(). >=20 > + >=20 > + @param Type The HOB type to return. >=20 > + @param HobStart The starting HOB pointer to search from. >=20 > + >=20 > + @return The next instance of a HOB type from the starting HOB. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +GetNextHob ( >=20 > + IN UINT16 Type, >=20 > + IN CONST VOID *HobStart >=20 > + ) >=20 > +{ >=20 > + EFI_PEI_HOB_POINTERS Hob; >=20 > + >=20 > + ASSERT (HobStart !=3D NULL); >=20 > + >=20 > + Hob.Raw =3D (UINT8 *) HobStart; >=20 > + // >=20 > + // Parse the HOB list until end of list or matching type is found. >=20 > + // >=20 > + while (!END_OF_HOB_LIST (Hob)) { >=20 > + if (Hob.Header->HobType =3D=3D Type) { >=20 > + return Hob.Raw; >=20 > + } >=20 > + Hob.Raw =3D GET_NEXT_HOB (Hob); >=20 > + } >=20 > + return NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + Returns the first instance of a HOB type among the whole HOB list. >=20 > + >=20 > + This function searches the first instance of a HOB type among the whol= e > HOB list. >=20 > + If there does not exist such HOB type in the HOB list, it will return = NULL. >=20 > + >=20 > + If the pointer to the HOB list is NULL, then ASSERT(). >=20 > + >=20 > + @param Type The HOB type to return. >=20 > + >=20 > + @return The next instance of a HOB type from the starting HOB. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +GetFirstHob ( >=20 > + IN UINT16 Type >=20 > + ) >=20 > +{ >=20 > + VOID *HobList; >=20 > + >=20 > + HobList =3D GetHobList (); >=20 > + return GetNextHob (Type, HobList); >=20 > +} >=20 > + >=20 > +/** >=20 > + Returns the next instance of the matched GUID HOB from the starting HO= B. >=20 > + >=20 > + This function searches the first instance of a HOB from the starting H= OB > pointer. >=20 > + Such HOB should satisfy two conditions: >=20 > + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name > equals to the input Guid. >=20 > + If there does not exist such HOB from the starting HOB pointer, it wil= l > return NULL. >=20 > + Caller is required to apply GET_GUID_HOB_DATA () and > GET_GUID_HOB_DATA_SIZE () >=20 > + to extract the data section and its size information, respectively. >=20 > + In contrast with macro GET_NEXT_HOB(), this function does not skip the > starting HOB pointer >=20 > + unconditionally: it returns HobStart back if HobStart itself meets the > requirement; >=20 > + caller is required to use GET_NEXT_HOB() if it wishes to skip current > HobStart. >=20 > + >=20 > + If Guid is NULL, then ASSERT(). >=20 > + If HobStart is NULL, then ASSERT(). >=20 > + >=20 > + @param Guid The GUID to match with in the HOB list. >=20 > + @param HobStart A pointer to a Guid. >=20 > + >=20 > + @return The next instance of the matched GUID HOB from the starting > HOB. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +GetNextGuidHob ( >=20 > + IN CONST EFI_GUID *Guid, >=20 > + IN CONST VOID *HobStart >=20 > + ) >=20 > +{ >=20 > + EFI_PEI_HOB_POINTERS GuidHob; >=20 > + >=20 > + GuidHob.Raw =3D (UINT8 *) HobStart; >=20 > + while ((GuidHob.Raw =3D GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, > GuidHob.Raw)) !=3D NULL) { >=20 > + if (CompareGuid (Guid, &GuidHob.Guid->Name)) { >=20 > + break; >=20 > + } >=20 > + GuidHob.Raw =3D GET_NEXT_HOB (GuidHob); >=20 > + } >=20 > + return GuidHob.Raw; >=20 > +} >=20 > + >=20 > +/** >=20 > + Returns the first instance of the matched GUID HOB among the whole HOB > list. >=20 > + >=20 > + This function searches the first instance of a HOB among the whole HOB= list. >=20 > + Such HOB should satisfy two conditions: >=20 > + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name > equals to the input Guid. >=20 > + If there does not exist such HOB from the starting HOB pointer, it wil= l > return NULL. >=20 > + Caller is required to apply GET_GUID_HOB_DATA () and > GET_GUID_HOB_DATA_SIZE () >=20 > + to extract the data section and its size information, respectively. >=20 > + >=20 > + If the pointer to the HOB list is NULL, then ASSERT(). >=20 > + If Guid is NULL, then ASSERT(). >=20 > + >=20 > + @param Guid The GUID to match with in the HOB list. >=20 > + >=20 > + @return The first instance of the matched GUID HOB among the whole > HOB list. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +GetFirstGuidHob ( >=20 > + IN CONST EFI_GUID *Guid >=20 > + ) >=20 > +{ >=20 > + VOID *HobList; >=20 > + >=20 > + HobList =3D GetHobList (); >=20 > + return GetNextGuidHob (Guid, HobList); >=20 > +} >=20 > + >=20 > +/** >=20 > + Get the system boot mode from the HOB list. >=20 > + >=20 > + This function returns the system boot mode information from the >=20 > + PHIT HOB in HOB list. >=20 > + >=20 > + If the pointer to the HOB list is NULL, then ASSERT(). >=20 > + >=20 > + @param VOID >=20 > + >=20 > + @return The Boot Mode. >=20 > + >=20 > +**/ >=20 > +EFI_BOOT_MODE >=20 > +EFIAPI >=20 > +GetBootModeHob ( >=20 > + VOID >=20 > + ) >=20 > +{ >=20 > + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; >=20 > + >=20 > + HandOffHob =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); >=20 > + >=20 > + return HandOffHob->BootMode; >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a HOB for a loaded PE32 module. >=20 > + >=20 > + This function builds a HOB for a loaded PE32 module. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If ModuleName is NULL, then ASSERT(). >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param ModuleName The GUID File Name of the module. >=20 > + @param MemoryAllocationModule The 64 bit physical address of the > module. >=20 > + @param ModuleLength The length of the module in bytes. >=20 > + @param EntryPoint The 64 bit physical address of the mod= ule entry > point. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildModuleHob ( >=20 > + IN CONST EFI_GUID *ModuleName, >=20 > + IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, >=20 > + IN UINT64 ModuleLength, >=20 > + IN EFI_PHYSICAL_ADDRESS EntryPoint >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a HOB that describes a chunk of system memory with Owner GUID. >=20 > + >=20 > + This function builds a HOB that describes a chunk of system memory. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param ResourceType The type of resource described by this HOB= . >=20 > + @param ResourceAttribute The resource attributes of the memory > described by this HOB. >=20 > + @param PhysicalStart The 64 bit physical address of memory desc= ribed > by this HOB. >=20 > + @param NumberOfBytes The length of the memory described by this > HOB in bytes. >=20 > + @param OwnerGUID GUID for the owner of this resource. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildResourceDescriptorWithOwnerHob ( >=20 > + IN EFI_RESOURCE_TYPE ResourceType, >=20 > + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, >=20 > + IN EFI_PHYSICAL_ADDRESS PhysicalStart, >=20 > + IN UINT64 NumberOfBytes, >=20 > + IN EFI_GUID *OwnerGUID >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a HOB that describes a chunk of system memory. >=20 > + >=20 > + This function builds a HOB that describes a chunk of system memory. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param ResourceType The type of resource described by this HOB= . >=20 > + @param ResourceAttribute The resource attributes of the memory > described by this HOB. >=20 > + @param PhysicalStart The 64 bit physical address of memory desc= ribed > by this HOB. >=20 > + @param NumberOfBytes The length of the memory described by this > HOB in bytes. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildResourceDescriptorHob ( >=20 > + IN EFI_RESOURCE_TYPE ResourceType, >=20 > + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, >=20 > + IN EFI_PHYSICAL_ADDRESS PhysicalStart, >=20 > + IN UINT64 NumberOfBytes >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a customized HOB tagged with a GUID for identification and retu= rns >=20 > + the start address of GUID HOB data. >=20 > + >=20 > + This function builds a customized HOB tagged with a GUID for identific= ation >=20 > + and returns the start address of GUID HOB data so that caller can fill= the > customized data. >=20 > + The HOB Header and Name field is already stripped. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If Guid is NULL, then ASSERT(). >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). >=20 > + HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is > 0xFFF8. >=20 > + >=20 > + @param Guid The GUID to tag the customized HOB. >=20 > + @param DataLength The size of the data payload for the GUID HOB. >=20 > + >=20 > + @retval NULL The GUID HOB could not be allocated. >=20 > + @retval others The start address of GUID HOB data. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +BuildGuidHob ( >=20 > + IN CONST EFI_GUID *Guid, >=20 > + IN UINTN DataLength >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > + return NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a customized HOB tagged with a GUID for identification, copies = the > input data to the HOB >=20 > + data field, and returns the start address of the GUID HOB data. >=20 > + >=20 > + This function builds a customized HOB tagged with a GUID for identific= ation > and copies the input >=20 > + data to the HOB data field and returns the start address of the GUID H= OB > data. It can only be >=20 > + invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HO= B is > read-only for DXE phase. >=20 > + The HOB Header and Name field is already stripped. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If Guid is NULL, then ASSERT(). >=20 > + If Data is NULL and DataLength > 0, then ASSERT(). >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). >=20 > + HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is > 0xFFF8. >=20 > + >=20 > + @param Guid The GUID to tag the customized HOB. >=20 > + @param Data The data to be copied into the data field of the= GUID > HOB. >=20 > + @param DataLength The size of the data payload for the GUID HOB. >=20 > + >=20 > + @retval NULL The GUID HOB could not be allocated. >=20 > + @retval others The start address of GUID HOB data. >=20 > + >=20 > +**/ >=20 > +VOID * >=20 > +EFIAPI >=20 > +BuildGuidDataHob ( >=20 > + IN CONST EFI_GUID *Guid, >=20 > + IN VOID *Data, >=20 > + IN UINTN DataLength >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > + return NULL; >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a Firmware Volume HOB. >=20 > + >=20 > + This function builds a Firmware Volume HOB. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + If the FvImage buffer is not at its required alignment, then ASSERT(). >=20 > + >=20 > + @param BaseAddress The base address of the Firmware Volume. >=20 > + @param Length The size of the Firmware Volume in bytes. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildFvHob ( >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a EFI_HOB_TYPE_FV2 HOB. >=20 > + >=20 > + This function builds a EFI_HOB_TYPE_FV2 HOB. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + If the FvImage buffer is not at its required alignment, then ASSERT(). >=20 > + >=20 > + @param BaseAddress The base address of the Firmware Volume. >=20 > + @param Length The size of the Firmware Volume in bytes. >=20 > + @param FvName The name of the Firmware Volume. >=20 > + @param FileName The name of the file. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildFv2Hob ( >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length, >=20 > + IN CONST EFI_GUID *FvName, >=20 > + IN CONST EFI_GUID *FileName >=20 > + ) >=20 > +{ >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a EFI_HOB_TYPE_FV3 HOB. >=20 > + >=20 > + This function builds a EFI_HOB_TYPE_FV3 HOB. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + If the FvImage buffer is not at its required alignment, then ASSERT(). >=20 > + >=20 > + @param BaseAddress The base address of the Firmware Volume. >=20 > + @param Length The size of the Firmware Volume in bytes= . >=20 > + @param AuthenticationStatus The authentication status. >=20 > + @param ExtractedFv TRUE if the FV was extracted as a file w= ithin >=20 > + another firmware volume. FALSE otherwise= . >=20 > + @param FvName The name of the Firmware Volume. >=20 > + Valid only if IsExtractedFv is TRUE. >=20 > + @param FileName The name of the file. >=20 > + Valid only if IsExtractedFv is TRUE. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildFv3Hob ( >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length, >=20 > + IN UINT32 AuthenticationStatus, >=20 > + IN BOOLEAN ExtractedFv, >=20 > + IN CONST EFI_GUID *FvName, OPTIONAL >=20 > + IN CONST EFI_GUID *FileName OPTIONAL >=20 > + ) >=20 > +{ >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a Capsule Volume HOB. >=20 > + >=20 > + This function builds a Capsule Volume HOB. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If the platform does not support Capsule Volume HOBs, then ASSERT(). >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param BaseAddress The base address of the Capsule Volume. >=20 > + @param Length The size of the Capsule Volume in bytes. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildCvHob ( >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a HOB for the CPU. >=20 > + >=20 > + This function builds a HOB for the CPU. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param SizeOfMemorySpace The maximum physical memory > addressability of the processor. >=20 > + @param SizeOfIoSpace The maximum physical I/O addressability of= the > processor. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildCpuHob ( >=20 > + IN UINT8 SizeOfMemorySpace, >=20 > + IN UINT8 SizeOfIoSpace >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a HOB for the Stack. >=20 > + >=20 > + This function builds a HOB for the stack. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param BaseAddress The 64 bit physical address of the Stack. >=20 > + @param Length The length of the stack in bytes. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildStackHob ( >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a HOB for the BSP store. >=20 > + >=20 > + This function builds a HOB for BSP store. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param BaseAddress The 64 bit physical address of the BSP. >=20 > + @param Length The length of the BSP store in bytes. >=20 > + @param MemoryType Type of memory allocated by this HOB. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildBspStoreHob ( >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length, >=20 > + IN EFI_MEMORY_TYPE MemoryType >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > + >=20 > +/** >=20 > + Builds a HOB for the memory allocation. >=20 > + >=20 > + This function builds a HOB for the memory allocation. >=20 > + It can only be invoked during PEI phase; >=20 > + for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE pha= se. >=20 > + >=20 > + If there is no additional space for HOB creation, then ASSERT(). >=20 > + >=20 > + @param BaseAddress The 64 bit physical address of the memory. >=20 > + @param Length The length of the memory allocation in bytes. >=20 > + @param MemoryType Type of memory allocated by this HOB. >=20 > + >=20 > +**/ >=20 > +VOID >=20 > +EFIAPI >=20 > +BuildMemoryAllocationHob ( >=20 > + IN EFI_PHYSICAL_ADDRESS BaseAddress, >=20 > + IN UINT64 Length, >=20 > + IN EFI_MEMORY_TYPE MemoryType >=20 > + ) >=20 > +{ >=20 > + // >=20 > + // PEI HOB is read only for DXE phase >=20 > + // >=20 > + ASSERT (FALSE); >=20 > +} >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.c > b/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.c > new file mode 100644 > index 0000000000..8bb31b3f9c > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.c > @@ -0,0 +1,66 @@ > +/** @file >=20 > + This library retrieve the EFI_BOOT_SERVICES pointer from EFI system ta= ble > in >=20 > + library's constructor. >=20 > + >=20 > + Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > + >=20 > +#include >=20 > + >=20 > +VOID *gHobList =3D NULL; >=20 > + >=20 > +/** >=20 > + Local implementation of GUID comparasion that doesn't depend on > DebugLib::ASSERT(). >=20 > + >=20 > + This function compares Guid1 to Guid2. If the GUIDs are identical the= n > TRUE is returned. >=20 > + If there are any bit differences in the two GUIDs, then FALSE is retur= ned. >=20 > + >=20 > + @param Guid1 A pointer to a 128 bit GUID. >=20 > + @param Guid2 A pointer to a 128 bit GUID. >=20 > + >=20 > + @retval TRUE Guid1 and Guid2 are identical. >=20 > + @retval FALSE Guid1 and Guid2 are not identical. >=20 > +**/ >=20 > +BOOLEAN >=20 > +LocalCompareGuid ( >=20 > + IN CONST GUID *Guid1, >=20 > + IN CONST GUID *Guid2 >=20 > + ) >=20 > +{ >=20 > + UINT64 *Left; >=20 > + UINT64 *Right; >=20 > + >=20 > + Left =3D (UINT64 *) Guid1; >=20 > + Right =3D (UINT64 *) Guid2; >=20 > + >=20 > + return (BOOLEAN) (Left[0] =3D=3D Right[0] && Left[1] =3D=3D Right[1]); >=20 > +} >=20 > + >=20 > +/** >=20 > + @param ImageHandle The firmware allocated handle for the EFI image. >=20 > + @param SystemTable A pointer to the EFI System Table. >=20 > + >=20 > + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. >=20 > + >=20 > +**/ >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +DxeHobListLibConstructor ( >=20 > + IN EFI_HANDLE ImageHandle, >=20 > + IN EFI_SYSTEM_TABLE *SystemTable >=20 > + ) >=20 > +{ >=20 > + UINTN Index; >=20 > + >=20 > + for (Index =3D 0; Index < SystemTable->NumberOfTableEntries; Index++) = { >=20 > + if (LocalCompareGuid (&gEfiHobListGuid, &SystemTable- > >ConfigurationTable[Index].VendorGuid)) { >=20 > + gHobList =3D SystemTable->ConfigurationTable[Index].VendorTable; >=20 > + return EFI_SUCCESS; >=20 > + } >=20 > + } >=20 > + >=20 > + return EFI_NOT_FOUND; >=20 > +} >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf > b/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf > new file mode 100644 > index 0000000000..1115949556 > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf > @@ -0,0 +1,35 @@ > +## @file >=20 > +# UEFI Boot Services Table Library implementation. >=20 > +# >=20 > +# Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D UefiPayloadInitHobLib >=20 > + FILE_GUID =3D ff5c7a21-ab7a-4366-8616-11c6e53247b= 6 >=20 > + MODULE_TYPE =3D UEFI_DRIVER >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D DxeHobListLib|DXE_DRIVER > DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION > UEFI_DRIVER SMM_CORE >=20 > + >=20 > + CONSTRUCTOR =3D DxeHobListLibConstructor >=20 > + >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 EBC >=20 > +# >=20 > + >=20 > +[Sources] >=20 > + DxeHobListLib.c >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + UefiPayloadPkg/UefiPayloadPkg.dec >=20 > + >=20 > +[Guids] >=20 > + gEfiHobListGuid ## CONSUMES >=20 > + >=20 > + >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c > b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c > new file mode 100644 > index 0000000000..92d3e17ef0 > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.c > @@ -0,0 +1,20 @@ > +/** @file >=20 > + This library retrieve the EFI_BOOT_SERVICES pointer from EFI system ta= ble > in >=20 > + library's constructor. >=20 > + >=20 > + Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > + SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > + >=20 > +**/ >=20 > + >=20 > + >=20 > +#include >=20 > + >=20 > +EFI_STATUS >=20 > +EFIAPI >=20 > +DxeHobListLibNullConstructor ( >=20 > + VOID >=20 > + ) >=20 > +{ >=20 > + return EFI_SUCCESS; >=20 > +} >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.i= nf > b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.inf > new file mode 100644 > index 0000000000..f17e5ebdbd > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull.inf > @@ -0,0 +1,28 @@ > +## @file >=20 > +# UEFI Boot Services Table Library implementation. >=20 > +# >=20 > +# Copyright (c) 2021, Intel Corporation. All rights reserved.
>=20 > +# >=20 > +# SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > +# >=20 > +# >=20 > +## >=20 > + >=20 > +[Defines] >=20 > + INF_VERSION =3D 0x00010005 >=20 > + BASE_NAME =3D DxeHobListLibNull >=20 > + MODULE_TYPE =3D BASE >=20 > + FILE_GUID =3D 060876c2-0e4e-4c63-8996-6af3710cfa6= 4 >=20 > + VERSION_STRING =3D 1.0 >=20 > + LIBRARY_CLASS =3D DxeHobListLib >=20 > + CONSTRUCTOR =3D DxeHobListLibNullConstructor >=20 > + >=20 > +# >=20 > +# VALID_ARCHITECTURES =3D IA32 X64 EBC >=20 > +# >=20 > + >=20 > +[Packages] >=20 > + MdePkg/MdePkg.dec >=20 > + >=20 > +[Sources] >=20 > + DxeHobListLibNull.c >=20 > diff --git a/UefiPayloadPkg/Library/HobLib/Hob.c > b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c > similarity index 96% > rename from UefiPayloadPkg/Library/HobLib/Hob.c > rename to UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c > index c0b4cc0b0f..23a749edf1 100644 > --- a/UefiPayloadPkg/Library/HobLib/Hob.c > +++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/Hob.c > @@ -1,7 +1,7 @@ > /** @file >=20 >=20 >=20 > Copyright (c) 2010, Apple Inc. All rights reserved.
>=20 > - Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.
>=20 > + Copyright (c) 2017 - 2021, Intel Corporation. All rights reserved.
>=20 >=20 >=20 > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 >=20 >=20 > diff --git a/UefiPayloadPkg/Library/HobLib/HobLib.inf > b/UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf > similarity index 87% > rename from UefiPayloadPkg/Library/HobLib/HobLib.inf > rename to UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf > index 030e22a810..cbb4f02efc 100644 > --- a/UefiPayloadPkg/Library/HobLib/HobLib.inf > +++ b/UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf > @@ -1,6 +1,6 @@ > #/** @file >=20 > # >=20 > -# Copyright (c) 2018 - 2020, Intel Corporation. All rights reserved. >=20 > +# Copyright (c) 2018 - 2021, Intel Corporation. All rights reserved. >=20 > # Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
>=20 > # >=20 > # SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc > b/UefiPayloadPkg/UefiPayloadPkg.dsc > index 21b360256b..d8277efccd 100644 > --- a/UefiPayloadPkg/UefiPayloadPkg.dsc > +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc > @@ -27,6 +27,7 @@ >=20 >=20 > DEFINE SOURCE_DEBUG_ENABLE =3D FALSE >=20 > DEFINE PS2_KEYBOARD_ENABLE =3D FALSE >=20 > + DEFINE UNIVERSAL_PAYLOAD =3D FALSE >=20 >=20 >=20 > # >=20 > # SBL: UEFI payload for Slim Bootloader >=20 > @@ -146,6 +147,13 @@ >=20 > PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/Base > PeCoffGetEntryPointLib.inf >=20 >=20 > CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCac > heMaintenanceLib.inf >=20 > SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf >=20 > + DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLib/DxeHobListLib.inf >=20 > + >=20 > +!if $(UNIVERSAL_PAYLOAD) =3D=3D TRUE >=20 > + HobLib|UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf >=20 > +!else >=20 > + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 > +!endif >=20 >=20 >=20 > # >=20 > # UEFI & PI >=20 > @@ -221,10 +229,12 @@ >=20 > VariablePolicyHelperLib|MdeModulePkg/Library/VariablePolicyHelperLib/Va > riablePolicyHelperLib.inf >=20 >=20 >=20 > [LibraryClasses.common.SEC] >=20 > - HobLib|UefiPayloadPkg/Library/HobLib/HobLib.inf >=20 > + HobLib|UefiPayloadPkg/Library/PayloadEntryHobLib/HobLib.inf >=20 > PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf >=20 > + > DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull > .inf >=20 >=20 >=20 > [LibraryClasses.common.DXE_CORE] >=20 > + > DxeHobListLib|UefiPayloadPkg/Library/DxeHobListLibNull/DxeHobListLibNull > .inf >=20 > PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf >=20 > HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf >=20 >=20 > MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLi > b/DxeCoreMemoryAllocationLib.inf >=20 > @@ -238,7 +248,6 @@ >=20 >=20 > [LibraryClasses.common.DXE_DRIVER] >=20 > PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 >=20 > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf >=20 >=20 > ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeE > xtractGuidedSectionLib.inf >=20 >=20 > ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/Dx > eReportStatusCodeLib.inf >=20 > @@ -251,7 +260,6 @@ >=20 >=20 > [LibraryClasses.common.DXE_RUNTIME_DRIVER] >=20 > PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 >=20 > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf >=20 >=20 > ReportStatusCodeLib|MdeModulePkg/Library/RuntimeDxeReportStatusCod > eLib/RuntimeDxeReportStatusCodeLib.inf >=20 >=20 > VariablePolicyLib|MdeModulePkg/Library/VariablePolicyLib/VariablePolicyLi > bRuntimeDxe.inf >=20 > @@ -260,7 +268,6 @@ > PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf >=20 >=20 > MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemo > ryAllocationLib.inf >=20 >=20 > ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/Dx > eReportStatusCodeLib.inf >=20 > - HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf >=20 >=20 >=20 >=20 > ########################################################## > ###################### >=20 > # >=20 > -- > 2.30.0.windows.2