From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mx.groups.io with SMTP id smtpd.web11.460.1624402117012921392 for ; Tue, 22 Jun 2021 15:48:37 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=BRCZer4Z; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: guo.dong@intel.com) IronPort-SDR: ijPJi1sFxFMUCfRGufAUastOkj/hy63FVTKdz/KuW1CwTQBZJrP7UWAyy1zwDShYKaT1iB/Phj P2QxYoHyq3pA== X-IronPort-AV: E=McAfee;i="6200,9189,10023"; a="194462807" X-IronPort-AV: E=Sophos;i="5.83,292,1616482800"; d="scan'208";a="194462807" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2021 15:48:34 -0700 IronPort-SDR: qyhnYLbQFIcYPdJFJNcizGbzOAWNXVGIZlDsoOjGf3tWRvVtCPU0/Q8Clmve7fPvfVnvM2zV5i H2By9UJ3nacg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,292,1616482800"; d="scan'208";a="555935531" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga004.jf.intel.com with ESMTP; 22 Jun 2021 15:48:34 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX603.amr.corp.intel.com (10.22.229.16) 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 15:48:34 -0700 Received: from orsmsx612.amr.corp.intel.com (10.22.229.25) by ORSMSX612.amr.corp.intel.com (10.22.229.25) 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 15:48:34 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx612.amr.corp.intel.com (10.22.229.25) 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 15:48:34 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.49) 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; Tue, 22 Jun 2021 15:48:33 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a1SM0smfPLqOH9M7DYtBVv1hM7c50c664j59kALmXXRLdbd45t1Hv0/+flWHJAY4Nd0rPpIXAYfBebIEC7f2nwa8HcTPCJVZHn1JIpNeOrOfLh7a+cnxLmoPCwlb/FCMglomEAFPEZpcrY1z3xGdOYZavLAMSzH3imu6rE4ouZOau7hA620kddrrtgQhL0wjS6L09gaykjK7pbB8M2WZwIlDJLba1VptiaDb8mUr7ngPmb7coVFE0Gnxcn3qK6ptMyzgYxPtzmsgNLHTJokJmnsM4fkd0qWUol0mX4JkWo/lRS54DMbUtKDc5y8HB1C9QE9XruKrjAQ8bdrdpPfpZw== 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=3w+V1Ue+9AZHHt+rfwGd/hX9PHfNCRTJT5Fv/FnbBRw=; b=eZtw4mrRwNmAsVCZkp3fOMr8yj/jyFRHaRKYOmtu/SuihgGMcsugAu/Q6y70eazlryzKnfWahez33teGxIue12j0oJbuJOx+Qtp5xotSgfIOlbGKVGjsC9r5h/Ziwh4+cR6URUzyQoyGi9rwmWj5/C6rIJDsHQeZMyE6nrvezE3mf+8cTavqtaIdUn9dTglL3v8h6Gct1i59NTcdQ+9wqWxRe05gb25LFTlboPvvSzpY/YA3+cYN9HQeho38aFrk1h44lNXfckSS/E/zJEmfEfRVJUA+x8HCBpliSu2z3Njw9K7Yy6l0hXpk/KwBU2JDlhUw0Bfvm/mDh6FVmoKSJQ== 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=3w+V1Ue+9AZHHt+rfwGd/hX9PHfNCRTJT5Fv/FnbBRw=; b=BRCZer4ZZaqEGtOJkS+8On93oqvVPOQ4V4sooYhhWJeGwMUaVtvNdSmeRsUTTm0WE3KQxEwIYacrGshxs3N3PO8CrdGZ3lNWyhDE07H6BGAvnWKhEvBiOOUcz2Yok0RscOqDjzXkxg5LyB/perYjpGZ7oQAfqExyrb4gSAgTP2c= Received: from BYAPR11MB3622.namprd11.prod.outlook.com (2603:10b6:a03:fe::30) by BYAPR11MB2630.namprd11.prod.outlook.com (2603:10b6:a02:c2::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.22; Tue, 22 Jun 2021 22:48:31 +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 22:48:31 +0000 From: "Guo Dong" To: "Liu, Zhiguang" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "You, Benjamin" , "Ni, Ray" Subject: Re: [PATCH 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload Thread-Topic: [PATCH 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload Thread-Index: AQHXZeuRnETr5YLD5UOa1c12lgrUb6sgifwg Date: Tue, 22 Jun 2021 22:48:31 +0000 Message-ID: References: <20210620154702.2681-1-zhiguang.liu@intel.com> <20210620154702.2681-2-zhiguang.liu@intel.com> In-Reply-To: <20210620154702.2681-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: 423ad33b-3dfb-4e1e-0ada-08d935cfdc46 x-ms-traffictypediagnostic: BYAPR11MB2630: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6790; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: U0DReXeoDa6l/L/rXbS/L6CaJNuAKQcrFF4AJLSojwGkrjA5ccH0FnWFprT0sukfRyrGAhQhBWaf+5yFP/+w/pu1fUnvWhS8rdEYh2zu8Di7Fbi2n8v6DdpzU/kWI6oE7Tlzqvkrvc0sWzVWReOp7aYV3Ag0XryzPsSHUGV4wDLUwSKalX1Fttvlkj7HIVsr94US2BLFcYQGl+0yhCGvhEUqFIPtWdNhKWBeEIlDgpBbskFD2wnpzdvYFUwgyRUn2Uuk+4UiuFAYI/6aA3I5u62pM09mj0xN+0kCQM8b6AEmZwkW0vYK7W8yyVz9/aOjT8rn182l9tXMJSJsicXrTmPLMry9S5Rsu8vq128Dvx7cId71KXIWSB7LZD+eQQlZ+OYepPDcBuz7hZ9KFomq05GAFnyXcxlBLmdG0Saoillj8Tuv3cJZ2ha+L4OseOdo1u8nSMhWmUU5MfjtIfpoBVeSC2S5b2BMNpaKvbQ9mtTXY8AkNmPSTjdYsNWSQw2hbLLzDp4CIKn75h1Xr0z8Hr24GV36gmkd5Vmh7IgZvv3l69pB0VPQ5gJGmWz269lfVaAoDqfXmAXWqGQ9P1mH3ttdjLB7FXGOKf0g2PG2dQ4= 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:(39860400002)(396003)(136003)(376002)(366004)(346002)(83380400001)(53546011)(8676002)(38100700002)(26005)(110136005)(6506007)(122000001)(7696005)(316002)(186003)(66946007)(30864003)(4326008)(76116006)(64756008)(54906003)(8936002)(9686003)(66556008)(107886003)(52536014)(71200400001)(66476007)(33656002)(2906002)(478600001)(66446008)(86362001)(55016002)(5660300002)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?kHdqhNqifOJjZGYtxxC5QAJfgPcWnOR7nqMzDXfLRMIwrg+H1ZZA9FPHkOpH?= =?us-ascii?Q?xRw+2FDikyzvkmaIeJcOMrdAXZiHTEFnPZlpHHEGN5FJpCT02cKCh1vlUiJV?= =?us-ascii?Q?/e3J06N0/mLa29CdEm5FDYGifXyV6beRth9/GzjEPvQDjVL6hUdR3bDjnA/+?= =?us-ascii?Q?u4SSsLZAAJUNFYRM/4gxcTxa6e4fBgrhsUo1Uqe7F8kLwdENIXv3aCxz7m9b?= =?us-ascii?Q?ftwOIYbBROoqztxb1KRqK9TVHn8geixAEt5yFjvRcscfkCpiaYCIfLLUY8EG?= =?us-ascii?Q?HWFSdEjAgrO2C6bPdZdc4jYO0Vz4KqZEdmaxMGqxUvgYj8Ll/zLRyeuWQo0C?= =?us-ascii?Q?3LZnucI47KLG5geLFxuOSTWqKPsfsMnQG7MwvrPcVRfmJxPJehkdWQZiYYkR?= =?us-ascii?Q?eoO+cT78MX2vG2EK9gDc2c8AFShEajYKaNB1FWFwL+k1igUdpHv3fPr0M79r?= =?us-ascii?Q?CFOFKIG7XVdbR0Xh6FuJcvBrwezZrAYhAYkYr9BZxcS9tAQAx2x9YRhW7xxw?= =?us-ascii?Q?dcnPyiM5fHFfK4HvwYomqy2JjRkCa6j6H4+SrrUANEwtZdF1umGLVIFN0vJV?= =?us-ascii?Q?pqNVEyord3hWnHFbb04sfga5IyEWrMKBExZWCuQ5wdzGtizDr+FziWuBps7Y?= =?us-ascii?Q?rFjDmwYNSjg1JfApLYhncvinX6Gduhpgp5b+sp2LibkaSSfshUDXrflRkOND?= =?us-ascii?Q?xMoUtNf/J9KPx+cpCs6hzMSeuAWYKgXkj6IEB0uupwKfWQw1aTWeRylFl75J?= =?us-ascii?Q?+IvLIBnIw/qTFUlA6bvu2z3BEA16bUaKOOBtkzOY6j7KfgB1AHHNLgYBgjAr?= =?us-ascii?Q?6iG7h27OnUS/+oFlDpHNpPwx20uT3CWrRWJgAguRiWyDLFcm/jaE4j2cB9IU?= =?us-ascii?Q?QBPCFqCOP9D18gCnNQr9TcmzvsYJsOHXP+safmMT/y0TWQBXXsslRzERj342?= =?us-ascii?Q?k9P5QH/UJT9GedwYamAI4yc9alFKOALZ0DzglQzojV4WBgsyb6Q8LrW5kViw?= =?us-ascii?Q?WanTQZZPk+xpDXwvAGqTLw7sGXbdBqdNqqrdI1aAfCUP/fvgcyLbjoEcMLTN?= =?us-ascii?Q?gQRpEnwDlx6puhXCKdl28lIpKpYnSAh7xFsyXet7FU9I3C/FKxU2S8VteQN3?= =?us-ascii?Q?U/N1HBIo+1KzjGi4nSkwJolJ+k7ayb1BfqS/CKG0cW6qX7NL5HLPizRAoWIb?= =?us-ascii?Q?UhvL6uG069yf5QtlgehxDEISYH/uv9f+XP7PvOpsEossIuNF/XsQjKgGZSau?= =?us-ascii?Q?oudyuD5KVVA7UGLoFiiHPd+2XYKBAtxM5G4WK3HlCcVKtejqedZBjHb9/poU?= =?us-ascii?Q?GSouoQP/B08C+yar6p3fnpE4?= 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: 423ad33b-3dfb-4e1e-0ada-08d935cfdc46 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jun 2021 22:48:31.8646 (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: BOgaxeiGuDNfmnKvwnKDEmYBi6iF1123dVSGWjWn0KkgYsi0c9X7w0ggFNK3OHha9lMxEHCyLT72/DK6S10KNA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB2630 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 Could you add description why you need add new library DxeHobLib + DxeHobLi= stLib for DXE drivers instead of using MdePkg/Library/DxeHobLib/DxeHobLib.i= nf? And please check if UefiLib is still required for new DxeHobLib since it is= listed in the INF file. BTW, it looks there are some comments updated in the HobLib from MdePkg. Ma= ybe sync the changes to new Hob. Thanks, Guo > -----Original Message----- > From: Liu, Zhiguang > Sent: Sunday, June 20, 2021 8:47 AM > To: devel@edk2.groups.io > Cc: Ma, Maurice ; Dong, Guo > ; You, Benjamin ; Ni, Ray > > Subject: [PATCH 01/12] UefiPayloadPkg: Add HobLib for UniversalPayload >=20 > 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 > 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 | 40 > ++++++++++++++++++++++++++++++++++++++++ > UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni | 17 > +++++++++++++++++ > 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, 843 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..a146befd25 > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.inf > @@ -0,0 +1,40 @@ > +## @file >=20 > +# Instance of HOB Library using HOB list from EFI Configuration Table. >=20 > +# >=20 > +# HOB Library implementation that retrieves the HOB List >=20 > +# from the System Configuration Table in the EFI System Table. >=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 > + UefiLib >=20 > + DxeHobListLib >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni > b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni > new file mode 100644 > index 0000000000..f1a18b7984 > --- /dev/null > +++ b/UefiPayloadPkg/Library/DxeHobLib/DxeHobLib.uni > @@ -0,0 +1,17 @@ > +// /** @file >=20 > +// Instance of HOB Library using HOB list from EFI Configuration Table. >=20 > +// >=20 > +// HOB Library implementation that retrieves the HOB List >=20 > +// from the System Configuration Table in the EFI System Table. >=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 "Instance of HOB > Library using HOB list from EFI Configuration Table" >=20 > + >=20 > +#string STR_MODULE_DESCRIPTION #language en-US "The HOB Library > implementation that retrieves the HOB List from the System Configuration > Table in the EFI System Table." >=20 > + >=20 > diff --git a/UefiPayloadPkg/Library/DxeHobLib/HobLib.c > b/UefiPayloadPkg/Library/DxeHobLib/HobLib.c > new file mode 100644 > index 0000000000..8a2e773c59 > --- /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 such a HOB from the starting HOB pointer does not exist, it will re= turn > 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 such a HOB from the starting HOB pointer does not exist, it will re= turn > 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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI = HOB > 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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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() because PEI HOB is read-only for DXE p= hase. >=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.16.2.windows.1