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.web12.11449.1611664750054852653 for ; Tue, 26 Jan 2021 04:39:10 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=pePvTPLt; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: jiewen.yao@intel.com) IronPort-SDR: iJ3jGJ+pddPscjK6u/yWPD+6DfhkZQoNZAxs4nKPicgci9EKnx3ZrTsPG5ZKlZ15rVjYQ42PA6 AYyMA929yx8w== X-IronPort-AV: E=McAfee;i="6000,8403,9875"; a="167565404" X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208,217";a="167565404" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 04:39:07 -0800 IronPort-SDR: vQEJQRpPNG0tR6C0O74ajiHPdOexC3S7QrOH+vefkIHkIOt4Pm5kVu4GrpLLvUfcTBISYmZ+Gj ByeA8PlTGtMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,375,1602572400"; d="scan'208,217";a="361967117" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2021 04:39:06 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 26 Jan 2021 04:39:06 -0800 Received: from fmsmsx601.amr.corp.intel.com (10.18.126.81) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 26 Jan 2021 04:39:05 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 26 Jan 2021 04:39:05 -0800 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.48) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 26 Jan 2021 04:39:05 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ANn9rRoNKVxZ2NrgCzFvZT5xTNiH7NNYtsM/jFBlRikZMxBTLIQOoKI6/2VSAsGpj19qpYy1YzCNgSSChKEc+LUMFv3Ud2xzHXNFkycU65bNQyDBXRxokILLBBcfIj9IY7iQdsAPme11NMhe43y3ZhpOnKlMlRdQebkOD+Nzimlf5JLjrZ/dgXm2+w4gtivhN/mM7ZraTzQgzO/t5lWPGTcFVEGF2TI5SaarY2Rf/i/eZky8XUccWdx8jyOfqTnrdM+972JEqqBI8Me63/UtVVI0AL7EZEbqjoJGZ85/z4JA01ageUsJy9U/pQtIlIYs4N9ZHTjNP03v3xkWAhBEZA== 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=1jHkvel4H9a4qYWIEwDLobrp3nfQvVXkesoO90O70OA=; b=WyiG9B8Ba4Oyaw/hg4jmBqgd94D3o+kX8xvHlneYFlSglNhPC+OF1fbel2AjhgZt7W6nARa1iDywKLvIcdPXJX7jwst+5dW96uON8zxd5ut7a2eFPvYL6li5bylDiDIJ3HtUWDR4vuSTrA7Zj8YjlvCWYelkpFDUFnWBqNkHfy0Ku2w+DBy1xNl/FSyqg2r2Yij6uQXFyGjMgy3da8zPy7x43rZF44KFNQovCNoxM68XnRMeMsiKkD9pYU55ErVnE5F8O7SsQT01t03GlBCpaZojrysA+As0kij4qcGbny+4N2+FJQp0ja+v9t3kRqbY2I2B+8q6LPuIdRZc6dVJvQ== 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=1jHkvel4H9a4qYWIEwDLobrp3nfQvVXkesoO90O70OA=; b=pePvTPLt0V5bJdrYzUs+hszwKhfOrrtGkU7+zGk4GNsgYUP0ltCNKYYJasRqPFYj/+42rA9V0WAnrjFZl9KrLnD8s1/MTzzgGV7vwvODwQE2tOqD9df7NMbaop4QJwLA7PCFyOF6w6dnRKSL0nEmGezCmwkySsl/JIzSRg6aChU= Received: from BY5PR11MB4166.namprd11.prod.outlook.com (2603:10b6:a03:191::25) by BYAPR11MB3542.namprd11.prod.outlook.com (2603:10b6:a03:b2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Tue, 26 Jan 2021 12:39:04 +0000 Received: from BY5PR11MB4166.namprd11.prod.outlook.com ([fe80::5983:f233:56d6:8132]) by BY5PR11MB4166.namprd11.prod.outlook.com ([fe80::5983:f233:56d6:8132%4]) with mapi id 15.20.3784.019; Tue, 26 Jan 2021 12:39:04 +0000 From: "Yao, Jiewen" To: "devel@edk2.groups.io" , "kun.q@outlook.com" , Ard Biesheuvel , Sami Mujawar , Supreeth Venkatesh Subject: Re: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Thread-Topic: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Thread-Index: AQHW6sVngRv4uFWfLE+W4Ur49PxunaoxVMeigAiWDMA= Date: Tue, 26 Jan 2021 12:39:03 +0000 Message-ID: References: <20210114223400.2596-1-kun.q@outlook.com>,<165A3A1108D15505.7065@groups.io> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.198] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1b1a7611-5119-43b1-11b7-08d8c1f75d60 x-ms-traffictypediagnostic: BYAPR11MB3542: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5797; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 4c4QkFFRpHiJax/hLKOa0p0mDBgUpbnsYqrjivvG3zyibFZySDJqFa3xiUOEQDMVH0MC5YUlRg98caNuACQZqMVYWBPZvM1eLyi3uCK00Ilg9YOrX8j9SsyAv0uxl2EZRAg76Ce9D0WuqQXqjKAnsMKeNZJohHhsBOMpxEK97sMlEQueUSYckvCSh4amUSDMmez+J/WN+IMeRnjO6NrykkfzpiF1tMXrTTWt8IIj/CDlXFvD0fzGo0DvuEVteqkGfw+uIDDBRVpPfNiMKhsndyzcX6WhDgYHNiMJsFELylWMBWIP7HWW6HRCwCGm2flkbQKsUyR5csrPtC63MIVkHCddCAm3oxzz4js3EKTVVrAc4fr3XpVPFqzBohljvgvJA2hlxLUuIBPARWk8Fzm2FClQz3i1chFegTiMnlUglhmb1GZ65PBgS0hqUD4LGGx0lpLhsNlEvToIJi41EvrkMQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR11MB4166.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(39860400002)(366004)(396003)(136003)(376002)(346002)(5660300002)(83380400001)(66946007)(45080400002)(64756008)(86362001)(30864003)(76116006)(166002)(7696005)(76236003)(8676002)(33656002)(478600001)(55016002)(2906002)(8936002)(26005)(71200400001)(53546011)(110136005)(9686003)(186003)(6506007)(52536014)(66556008)(66446008)(316002)(66476007)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?rww8zNvTsFWyjXyFZrhueKHA3ww5lAzr5aOdFPjLVVnHGb2gOaxJXnNDBGjR?= =?us-ascii?Q?zmMoTR+UejG+DAS9o4AdpbCGpHhU8QOkLDzrYRobnhv8ThdDz5HlpYknIuY6?= =?us-ascii?Q?0m+gvPCAoIoHx2fjn+QmSPH3KDjuRi1xoFrqMFSBChsHIrCgl4OJX4z8GYRZ?= =?us-ascii?Q?utZHqd3kSKlIhElsKLA/eZa3qdh+hUf54Y3nB6yN2EIZdGn3Ev7UQZvzRn21?= =?us-ascii?Q?R3MkNPeM5xRXTaWE7MN3o1wjbP/mETLKQa1mUyP4+2jyjsVy1F55WLZXxeeF?= =?us-ascii?Q?xuI4QieRoodEBffF0jTx61A+99PVjCHv3AzEyu5t39YAjZLOHaaFTpXe0qj3?= =?us-ascii?Q?Dc+CsSila/Yo7Wu7oruu92LeCuosh5/HoK9QEmbLKP2xBra3J0O7KO9VPhs+?= =?us-ascii?Q?ElQLrO2LUexvrUnexGsUM3qgyL+VpCNOUP0Hpxlx58KlrECGpuoG5JZVcANZ?= =?us-ascii?Q?l2T1IJrCAwIYgyIkyaEGZYO/+/cONQcyzE4md/JZP8YbL9zl8DB2csTStlGf?= =?us-ascii?Q?WmmrQPlajCrhGsJGihxhSV6mmtT3xrcC4+KLm1OZf/DkM4VWEvLVF/mepGJT?= =?us-ascii?Q?KI+DM0AC7EESJz7jcjfJs64+mNmnQLzm2KllHDptBSumtmPxNy3BxRSXoLzF?= =?us-ascii?Q?ZJZsWYmPfREh02iGz5Js1CzWnZMtUt73w7ulU740gl6wa7kNMYd6qIdIU3dJ?= =?us-ascii?Q?X2CZbEgvevcoDSkrkif7cNIoiGuXumV2XqCN2Wt+gXD4Jt/+4hCkkKoq+VHx?= =?us-ascii?Q?2+bInngqJHRR4ZyG1j2TKRXoRR4DRYDSQzhUcc78nqY7UNnEJdMuD4tMuAne?= =?us-ascii?Q?8MP4bIALcyCszWlp5p4g1X2/g7ohiq6kABkTXg4fefD+hnP/acZwIDPiafTs?= =?us-ascii?Q?zFbJXeYaqGwFjWOS8uBzaMQQBukrVY5QS57edImmKHWiLlqVGgHBI3TIOIEh?= =?us-ascii?Q?O1q5ZMDnPK2IcIKY/jdRnYVV5KQfREcgtV+Dvoy7lTish8vRNPvqpFLRxNlq?= =?us-ascii?Q?gawe41rJ6GYr0pcIT15GN8cVrfR2oCRJll9P4uKE41t9SxFHgVZmFCROjH/l?= =?us-ascii?Q?ZsLZTEpo?= x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BY5PR11MB4166.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b1a7611-5119-43b1-11b7-08d8c1f75d60 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2021 12:39:03.9145 (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: 2pq7PjeI3HvOw6hq3HT/zOrFgbHy8J7lnAKPX6mPeIThCPMAd6On8468/iX2UXQVE32w5hv88yM4+zGjPoaIgw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR11MB3542 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BY5PR11MB41667AD3744F0007A2EB0E608CBC9BY5PR11MB4166namp_" --_000_BY5PR11MB41667AD3744F0007A2EB0E608CBC9BY5PR11MB4166namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Jiewen Yao From: devel@edk2.groups.io On Behalf Of Kun Qin Sent: Thursday, January 21, 2021 9:35 AM To: devel@edk2.groups.io; Ard Biesheuvel ; Sami Mu= jawar ; Yao, Jiewen ; Supreeth = Venkatesh Subject: Re: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCo= reHobLib: Extend support for x64 Mm Core Hi Jiewen/Ard/Sami/Supreeth, I updated this patch in v2 to centralize common implementations for certai= n library functions. Do you by any chance have more comments on this patch?= Any input is appreciated. Regards, Kun From: Kun Qin Sent: Thursday, January 14, 2021 14:34 To: devel@edk2.groups.io Cc: Ard Biesheuvel; Sami Mujawar; Jiewen Yao; Supreeth Venka= tesh Subject: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneMmCoreHo= bLib: Extend support for x64 Mm Core This change adds support of x64 version of StandaloneMmCoreHobLib. It brings in global variable "gHobList" through StandaloneMmCoreEntryPoint, imports implementation from DxeCoreHobLib.inf to support x64 Mm Core and moved shared functional plementations into a common file. Cc: Ard Biesheuvel > Cc: Sami Mujawar > Cc: Jiewen Yao > Cc: Supreeth Venkatesh > Signed-off-by: Kun Qin > --- Notes: v3: - Pertains gHobList for AARCH64 instance. v2: - Moved common function implementations into Common.c [Jiewen] StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =3D> AArch64}/Standalone= MmCoreHobLib.c | 272 ------------------ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c = | 291 +++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHobLib= .c | 298 ++++++++++++++++++++ StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf= | 11 +- 4 files changed, 597 insertions(+), 275 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo= reHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal= oneMmCoreHobLib.c similarity index 55% rename from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCor= eHobLib.c rename to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standalon= eMmCoreHobLib.c index e3d4743b63f2..0ec2d4ad6f6b 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLi= b.c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmC= oreHobLib.c @@ -21,188 +21,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // VOID *gHobList =3D NULL; -/** - Returns the pointer to the HOB list. - - This function returns the pointer to first HOB in the list. - If the pointer to the HOB list is NULL, then ASSERT(). - - @return The pointer to the HOB list. - -**/ -VOID * -EFIAPI -GetHobList ( - VOID - ) -{ - ASSERT (gHobList !=3D NULL); - return gHobList; -} - -/** - Returns the next instance of a HOB type from the starting HOB. - - This function searches the first instance of a HOB type from the starti= ng HOB pointer. - If there does not exist such HOB type from the starting HOB pointer, it= will return NULL. - In contrast with macro GET_NEXT_HOB(), this function does not skip the = starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the = requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current H= obStart. - - If HobStart is NULL, then ASSERT(). - - @param Type The HOB type to return. - @param HobStart The starting HOB pointer to search from. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetNextHob ( - IN UINT16 Type, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS Hob; - - ASSERT (HobStart !=3D NULL); - - Hob.Raw =3D (UINT8 *) HobStart; - // - // Parse the HOB list until end of list or matching type is found. - // - while (!END_OF_HOB_LIST (Hob)) { - if (Hob.Header->HobType =3D=3D Type) { - return Hob.Raw; - } - Hob.Raw =3D GET_NEXT_HOB (Hob); - } - return NULL; -} - -/** - Returns the first instance of a HOB type among the whole HOB list. - - This function searches the first instance of a HOB type among the whole= HOB list. - If there does not exist such HOB type in the HOB list, it will return N= ULL. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param Type The HOB type to return. - - @return The next instance of a HOB type from the starting HOB. - -**/ -VOID * -EFIAPI -GetFirstHob ( - IN UINT16 Type - ) -{ - VOID *HobList; - - HobList =3D GetHobList (); - return GetNextHob (Type, HobList); -} - -/** - Returns the next instance of the matched GUID HOB from the starting HOB= . - - This function searches the first instance of a HOB from the starting HO= B pointer. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals t= o the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will ret= urn NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_= SIZE () - to extract the data section and its size information, respectively. - In contrast with macro GET_NEXT_HOB(), this function does not skip the = starting HOB pointer - unconditionally: it returns HobStart back if HobStart itself meets the = requirement; - caller is required to use GET_NEXT_HOB() if it wishes to skip current H= obStart. - - If Guid is NULL, then ASSERT(). - If HobStart is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - @param HobStart A pointer to a Guid. - - @return The next instance of the matched GUID HOB from the starting HOB= . - -**/ -VOID * -EFIAPI -GetNextGuidHob ( - IN CONST EFI_GUID *Guid, - IN CONST VOID *HobStart - ) -{ - EFI_PEI_HOB_POINTERS GuidHob; - - GuidHob.Raw =3D (UINT8 *) HobStart; - while ((GuidHob.Raw =3D GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHo= b.Raw)) !=3D NULL) { - if (CompareGuid (Guid, &GuidHob.Guid->Name)) { - break; - } - GuidHob.Raw =3D GET_NEXT_HOB (GuidHob); - } - return GuidHob.Raw; -} - -/** - Returns the first instance of the matched GUID HOB among the whole HOB = list. - - This function searches the first instance of a HOB among the whole HOB = list. - Such HOB should satisfy two conditions: - its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to= the input Guid. - If such a HOB from the starting HOB pointer does not exist, it will ret= urn NULL. - Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_= SIZE () - to extract the data section and its size information, respectively. - - If the pointer to the HOB list is NULL, then ASSERT(). - If Guid is NULL, then ASSERT(). - - @param Guid The GUID to match with in the HOB list. - - @return The first instance of the matched GUID HOB among the whole HOB = list. - -**/ -VOID * -EFIAPI -GetFirstGuidHob ( - IN CONST EFI_GUID *Guid - ) -{ - VOID *HobList; - - HobList =3D GetHobList (); - return GetNextGuidHob (Guid, HobList); -} - -/** - Get the system boot mode from the HOB list. - - This function returns the system boot mode information from the - PHIT HOB in HOB list. - - If the pointer to the HOB list is NULL, then ASSERT(). - - @param VOID - - @return The Boot Mode. - -**/ -EFI_BOOT_MODE -EFIAPI -GetBootModeHob ( - VOID - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - - HandOffHob =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); - - return HandOffHob->BootMode; -} - VOID * CreateHob ( IN UINT16 HobType, @@ -510,93 +328,3 @@ BuildMemoryAllocationHob ( // ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Re= served)); } - -/** - Builds a HOB that describes a chunk of system memory with Owner GUID. - - This function builds a HOB that describes a chunk of system memory. - If there is no additional space for HOB creation, then ASSERT(). - - @param ResourceType The type of resource described by this HOB. - @param ResourceAttribute The resource attributes of the memory descr= ibed by this HOB. - @param PhysicalStart The 64 bit physical address of memory descr= ibed by this HOB. - @param NumberOfBytes The length of the memory described by this = HOB in bytes. - @param OwnerGUID GUID for the owner of this resource. - -**/ -VOID -EFIAPI -BuildResourceDescriptorWithOwnerHob ( - IN EFI_RESOURCE_TYPE ResourceType, - IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, - IN EFI_PHYSICAL_ADDRESS PhysicalStart, - IN UINT64 NumberOfBytes, - IN EFI_GUID *OwnerGUID - ) -{ - ASSERT (FALSE); -} - -/** - Builds a Capsule Volume HOB. - - This function builds a Capsule Volume HOB. - If the platform does not support Capsule Volume HOBs, then ASSERT(). - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The base address of the Capsule Volume. - @param Length The size of the Capsule Volume in bytes. - -**/ -VOID -EFIAPI -BuildCvHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - ASSERT (FALSE); -} - - -/** - Builds a HOB for the BSP store. - - This function builds a HOB for BSP store. - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the BSP. - @param Length The length of the BSP store in bytes. - @param MemoryType Type of memory allocated by this HOB. - -**/ -VOID -EFIAPI -BuildBspStoreHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length, - IN EFI_MEMORY_TYPE MemoryType - ) -{ - ASSERT (FALSE); -} - -/** - Builds a HOB for the Stack. - - This function builds a HOB for the stack. - If there is no additional space for HOB creation, then ASSERT(). - - @param BaseAddress The 64 bit physical address of the Stack. - @param Length The length of the stack in bytes. - -**/ -VOID -EFIAPI -BuildStackHob ( - IN EFI_PHYSICAL_ADDRESS BaseAddress, - IN UINT64 Length - ) -{ - ASSERT (FALSE); -} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c b/Sta= ndaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c new file mode 100644 index 000000000000..8c535032315a --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c @@ -0,0 +1,291 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include +#include + +#include + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + If the pointer to the HOB list is NULL, then ASSERT(). + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +GetHobList ( + VOID + ) +{ + ASSERT (gHobList !=3D NULL); + return gHobList; +} + +/** + Returns the next instance of a HOB type from the starting HOB. + + This function searches the first instance of a HOB type from the starti= ng HOB pointer. + If there does not exist such HOB type from the starting HOB pointer, it= will return NULL. + In contrast with macro GET_NEXT_HOB(), this function does not skip the = starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the = requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current H= obStart. + + If HobStart is NULL, then ASSERT(). + + @param Type The HOB type to return. + @param HobStart The starting HOB pointer to search from. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetNextHob ( + IN UINT16 Type, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS Hob; + + ASSERT (HobStart !=3D NULL); + + Hob.Raw =3D (UINT8 *) HobStart; + // + // Parse the HOB list until end of list or matching type is found. + // + while (!END_OF_HOB_LIST (Hob)) { + if (Hob.Header->HobType =3D=3D Type) { + return Hob.Raw; + } + Hob.Raw =3D GET_NEXT_HOB (Hob); + } + return NULL; +} + +/** + Returns the first instance of a HOB type among the whole HOB list. + + This function searches the first instance of a HOB type among the whole= HOB list. + If there does not exist such HOB type in the HOB list, it will return N= ULL. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param Type The HOB type to return. + + @return The next instance of a HOB type from the starting HOB. + +**/ +VOID * +EFIAPI +GetFirstHob ( + IN UINT16 Type + ) +{ + VOID *HobList; + + HobList =3D GetHobList (); + return GetNextHob (Type, HobList); +} + +/** + Returns the next instance of the matched GUID HOB from the starting HOB= . + + This function searches the first instance of a HOB from the starting HO= B pointer. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equals t= o the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will ret= urn NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_= SIZE () + to extract the data section and its size information, respectively. + In contrast with macro GET_NEXT_HOB(), this function does not skip the = starting HOB pointer + unconditionally: it returns HobStart back if HobStart itself meets the = requirement; + caller is required to use GET_NEXT_HOB() if it wishes to skip current H= obStart. + + If Guid is NULL, then ASSERT(). + If HobStart is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + @param HobStart A pointer to a Guid. + + @return The next instance of the matched GUID HOB from the starting HOB= . + +**/ +VOID * +EFIAPI +GetNextGuidHob ( + IN CONST EFI_GUID *Guid, + IN CONST VOID *HobStart + ) +{ + EFI_PEI_HOB_POINTERS GuidHob; + + GuidHob.Raw =3D (UINT8 *) HobStart; + while ((GuidHob.Raw =3D GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHo= b.Raw)) !=3D NULL) { + if (CompareGuid (Guid, &GuidHob.Guid->Name)) { + break; + } + GuidHob.Raw =3D GET_NEXT_HOB (GuidHob); + } + return GuidHob.Raw; +} + +/** + Returns the first instance of the matched GUID HOB among the whole HOB = list. + + This function searches the first instance of a HOB among the whole HOB = list. + Such HOB should satisfy two conditions: + its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to= the input Guid. + If such a HOB from the starting HOB pointer does not exist, it will ret= urn NULL. + Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_= SIZE () + to extract the data section and its size information, respectively. + + If the pointer to the HOB list is NULL, then ASSERT(). + If Guid is NULL, then ASSERT(). + + @param Guid The GUID to match with in the HOB list. + + @return The first instance of the matched GUID HOB among the whole HOB = list. + +**/ +VOID * +EFIAPI +GetFirstGuidHob ( + IN CONST EFI_GUID *Guid + ) +{ + VOID *HobList; + + HobList =3D GetHobList (); + return GetNextGuidHob (Guid, HobList); +} + +/** + Get the system boot mode from the HOB list. + + This function returns the system boot mode information from the + PHIT HOB in HOB list. + + If the pointer to the HOB list is NULL, then ASSERT(). + + @param VOID + + @return The Boot Mode. + +**/ +EFI_BOOT_MODE +EFIAPI +GetBootModeHob ( + VOID + ) +{ + EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; + + HandOffHob =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList (); + + return HandOffHob->BootMode; +} + + +/** + Builds a HOB that describes a chunk of system memory with Owner GUID. + + This function builds a HOB that describes a chunk of system memory. + If there is no additional space for HOB creation, then ASSERT(). + + @param ResourceType The type of resource described by this HOB. + @param ResourceAttribute The resource attributes of the memory descr= ibed by this HOB. + @param PhysicalStart The 64 bit physical address of memory descr= ibed by this HOB. + @param NumberOfBytes The length of the memory described by this = HOB in bytes. + @param OwnerGUID GUID for the owner of this resource. + +**/ +VOID +EFIAPI +BuildResourceDescriptorWithOwnerHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes, + IN EFI_GUID *OwnerGUID + ) +{ + ASSERT (FALSE); +} + +/** + Builds a Capsule Volume HOB. + + This function builds a Capsule Volume HOB. + If the platform does not support Capsule Volume HOBs, then ASSERT(). + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The base address of the Capsule Volume. + @param Length The size of the Capsule Volume in bytes. + +**/ +VOID +EFIAPI +BuildCvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + ASSERT (FALSE); +} + + +/** + Builds a HOB for the BSP store. + + This function builds a HOB for BSP store. + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the BSP. + @param Length The length of the BSP store in bytes. + @param MemoryType Type of memory allocated by this HOB. + +**/ +VOID +EFIAPI +BuildBspStoreHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN EFI_MEMORY_TYPE MemoryType + ) +{ + ASSERT (FALSE); +} + +/** + Builds a HOB for the Stack. + + This function builds a HOB for the stack. + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the Stack. + @param Length The length of the stack in bytes. + +**/ +VOID +EFIAPI +BuildStackHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + ASSERT (FALSE); +} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone= MmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standal= oneMmCoreHobLib.c new file mode 100644 index 000000000000..61afe8706486 --- /dev/null +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreH= obLib.c @@ -0,0 +1,298 @@ +/** @file + HOB Library implementation for Standalone MM Core. + +Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+ +SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include +#include + +#include + +/** + Builds a HOB for a loaded PE32 module. + + This function builds a HOB for a loaded PE32 module. + It can only be invoked during PEI phase; + for MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If ModuleName is NULL, then ASSERT(). + If there is no additional space for HOB creation, then ASSERT(). + + @param ModuleName The GUID File Name of the module. + @param MemoryAllocationModule The 64 bit physical address of the modu= le. + @param ModuleLength The length of the module in bytes. + @param EntryPoint The 64 bit physical address of the modu= le entry point. + +**/ +VOID +EFIAPI +BuildModuleHob ( + IN CONST EFI_GUID *ModuleName, + IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule, + IN UINT64 ModuleLength, + IN EFI_PHYSICAL_ADDRESS EntryPoint + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB that describes a chunk of system memory. + + This function builds a HOB that describes a chunk of system memory. + It can only be invoked during PEI phase; + for MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If there is no additional space for HOB creation, then ASSERT(). + + @param ResourceType The type of resource described by this HOB. + @param ResourceAttribute The resource attributes of the memory descr= ibed by this HOB. + @param PhysicalStart The 64 bit physical address of memory descr= ibed by this HOB. + @param NumberOfBytes The length of the memory described by this = HOB in bytes. + +**/ +VOID +EFIAPI +BuildResourceDescriptorHob ( + IN EFI_RESOURCE_TYPE ResourceType, + IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute, + IN EFI_PHYSICAL_ADDRESS PhysicalStart, + IN UINT64 NumberOfBytes + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + Builds a customized HOB tagged with a GUID for identification and retur= ns + the start address of GUID HOB data. + + This function builds a customized HOB tagged with a GUID for identifica= tion + and returns the start address of GUID HOB data so that caller can fill = the customized data. + The HOB Header and Name field is already stripped. + It can only be invoked during PEI phase. + For MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If Guid is NULL, then ASSERT(). + If there is no additional space for HOB creation, then ASSERT(). + If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). + HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0= xFFF8. + + @param Guid The GUID to tag the customized HOB. + @param DataLength The size of the data payload for the GUID HOB. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidHob ( + IN CONST EFI_GUID *Guid, + IN UINTN DataLength + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); + return NULL; +} + +/** + Builds a customized HOB tagged with a GUID for identification, copies t= he input data to the HOB + data field, and returns the start address of the GUID HOB data. + + This function builds a customized HOB tagged with a GUID for identifica= tion and copies the input + data to the HOB data field and returns the start address of the GUID HO= B data. It can only be + invoked during PEI phase; for MM phase, it will ASSERT() because PEI HO= B is read-only for MM phase. + The HOB Header and Name field is already stripped. + It can only be invoked during PEI phase. + For MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If Guid is NULL, then ASSERT(). + If Data is NULL and DataLength > 0, then ASSERT(). + If there is no additional space for HOB creation, then ASSERT(). + If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT(). + HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0= xFFF8. + + @param Guid The GUID to tag the customized HOB. + @param Data The data to be copied into the data field of the = GUID HOB. + @param DataLength The size of the data payload for the GUID HOB. + + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. + +**/ +VOID * +EFIAPI +BuildGuidDataHob ( + IN CONST EFI_GUID *Guid, + IN VOID *Data, + IN UINTN DataLength + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); + return NULL; +} + +/** + Builds a Firmware Volume HOB. + + This function builds a Firmware Volume HOB. + It can only be invoked during PEI phase; + for MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + +**/ +VOID +EFIAPI +BuildFvHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + Builds a EFI_HOB_TYPE_FV2 HOB. + + This function builds a EFI_HOB_TYPE_FV2 HOB. + It can only be invoked during PEI phase; + for MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param FvName The name of the Firmware Volume. + @param FileName The name of the file. + +**/ +VOID +EFIAPI +BuildFv2Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN CONST EFI_GUID *FvName, + IN CONST EFI_GUID *FileName + ) +{ + ASSERT (FALSE); +} + +/** + Builds a EFI_HOB_TYPE_FV3 HOB. + + This function builds a EFI_HOB_TYPE_FV3 HOB. + It can only be invoked during PEI phase; + for MM phase, it will ASSERT() since PEI HOB is read-only for MM phase. + + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). + + @param BaseAddress The base address of the Firmware Volume. + @param Length The size of the Firmware Volume in bytes. + @param AuthenticationStatus The authentication status. + @param ExtractedFv TRUE if the FV was extracted as a file wi= thin + another firmware volume. FALSE otherwise. + @param FvName The name of the Firmware Volume. + Valid only if IsExtractedFv is TRUE. + @param FileName The name of the file. + Valid only if IsExtractedFv is TRUE. + +**/ +VOID +EFIAPI +BuildFv3Hob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN UINT32 AuthenticationStatus, + IN BOOLEAN ExtractedFv, + IN CONST EFI_GUID *FvName, OPTIONAL + IN CONST EFI_GUID *FileName OPTIONAL + ) +{ + ASSERT (FALSE); +} + +/** + Builds a HOB for the CPU. + + This function builds a HOB for the CPU. + It can only be invoked during PEI phase; + for MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If there is no additional space for HOB creation, then ASSERT(). + + @param SizeOfMemorySpace The maximum physical memory addressability = of the processor. + @param SizeOfIoSpace The maximum physical I/O addressability of = the processor. + +**/ +VOID +EFIAPI +BuildCpuHob ( + IN UINT8 SizeOfMemorySpace, + IN UINT8 SizeOfIoSpace + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB for the memory allocation. + + This function builds a HOB for the memory allocation. + It can only be invoked during PEI phase; + for MM phase, it will ASSERT() because PEI HOB is read-only for MM phas= e. + + If there is no additional space for HOB creation, then ASSERT(). + + @param BaseAddress The 64 bit physical address of the memory. + @param Length The length of the memory allocation in bytes. + @param MemoryType Type of memory allocated by this HOB. + +**/ +VOID +EFIAPI +BuildMemoryAllocationHob ( + IN EFI_PHYSICAL_ADDRESS BaseAddress, + IN UINT64 Length, + IN EFI_MEMORY_TYPE MemoryType + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo= reHobLib.inf b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmC= oreHobLib.inf index 0046cd804def..a2559920e887 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLi= b.inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLi= b.inf @@ -22,16 +22,21 @@ [Defines] LIBRARY_CLASS =3D HobLib|MM_CORE_STANDALONE # -# VALID_ARCHITECTURES =3D AARCH64 +# VALID_ARCHITECTURES =3D X64 AARCH64 # -[Sources.Common] - StandaloneMmCoreHobLib.c +[Sources.common] + Common.c + +[Sources.X64] + X64/StandaloneMmCoreHobLib.c [Sources.AARCH64] + AArch64/StandaloneMmCoreHobLib.c AArch64/StandaloneMmCoreHobLibInternal.c [Packages] MdePkg/MdePkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec [LibraryClasses] -- 2.30.0.windows.1 --_000_BY5PR11MB41667AD3744F0007A2EB0E608CBC9BY5PR11MB4166namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>= ;

 

From: devel@edk2.groups.io <devel@edk2.gr= oups.io> On Behalf Of Kun Qin
Sent: Thursday, January 21, 2021 9:35 AM
To: devel@edk2.groups.io; Ard Biesheuvel <ard.biesheuvel@arm.com= >; Sami Mujawar <sami.mujawar@arm.com>; Yao, Jiewen <jiewen.yao= @intel.com>; Supreeth Venkatesh <supreeth.venkatesh@arm.com>
Subject: Re: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: Standal= oneMmCoreHobLib: Extend support for x64 Mm Core

 

Hi Jiewen/Ard/Sami/Supreeth,

 

I updated this patch in v2 to centralize common imp= lementations for certain library functions. Do you by any chance have more = comments on this patch? Any input is appreciated.

 

Regards,

Kun

 

From: K= un Qin
Sent: Thursday, January 14, 2021 14:34
To: devel@edk2.groups.io
Cc:
Ard Biesheuvel; <= a href=3D"mailto:sami.mujawar@arm.com"> Sami Mujawar; Jiewen Yao; = Supreeth Venkatesh
Subject: [edk2-devel] [PATCH v3 03/18] StandaloneMmPkg: StandaloneM= mCoreHobLib: Extend support for x64 Mm Core

 

This change adds sup= port of x64 version of StandaloneMmCoreHobLib. It
brings in global variable "gHobList" through StandaloneMmCoreEnt= ryPoint,
imports implementation from DxeCoreHobLib.inf to support x64 Mm Core and moved shared functional plementations into a common file.

Cc: Ard Biesheuvel <ard.biesh= euvel@arm.com>
Cc: Sami Mujawar <sami.mujawar@= arm.com>
Cc: Jiewen Yao <jiewen.yao@inte= l.com>
Cc: Supreeth Venkatesh <s= upreeth.venkatesh@arm.com>

Signed-off-by: Kun Qin <kun.q@outl= ook.com>
---

Notes:
    v3:
    - Pertains gHobList for AARCH64 instance.
   
    v2:
    - Moved common function implementations into Common.c [= Jiewen]

 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =3D> AArch64}/St= andaloneMmCoreHobLib.c | 272 ------------------
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c  &= nbsp;           &nbs= p;            &= nbsp;   | 291 +++++++++++++++++++
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreH= obLib.c           | 298 += +++++++++++++++++++
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLi= b.inf           &nbs= p; |  11 +-
 4 files changed, 597 insertions(+), 275 deletions(-)

diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo= reHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standal= oneMmCoreHobLib.c
similarity index 55%
rename from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCor= eHobLib.c
rename to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standalon= eMmCoreHobLib.c
index e3d4743b63f2..0ec2d4ad6f6b 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLi= b.c
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmC= oreHobLib.c
@@ -21,188 +21,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 //
 VOID *gHobList =3D NULL;
 
-/**
-  Returns the pointer to the HOB list.
-
-  This function returns the pointer to first HOB in the list.
-  If the pointer to the HOB list is NULL, then ASSERT().
-
-  @return The pointer to the HOB list.
-
-**/
-VOID *
-EFIAPI
-GetHobList (
-  VOID
-  )
-{
-  ASSERT (gHobList !=3D NULL);
-  return gHobList;
-}
-
-/**
-  Returns the next instance of a HOB type from the starting HOB.
-
-  This function searches the first instance of a HOB type from the s= tarting HOB pointer.
-  If there does not exist such HOB type from the starting HOB pointe= r, it will return NULL.
-  In contrast with macro GET_NEXT_HOB(), this function does not skip= the starting HOB pointer
-  unconditionally: it returns HobStart back if HobStart itself meets= the requirement;
-  caller is required to use GET_NEXT_HOB() if it wishes to skip curr= ent HobStart.
-
-  If HobStart is NULL, then ASSERT().
-
-  @param  Type        &= nbsp; The HOB type to return.
-  @param  HobStart      The starting H= OB pointer to search from.
-
-  @return The next instance of a HOB type from the starting HOB.
-
-**/
-VOID *
-EFIAPI
-GetNextHob (
-  IN UINT16         &nb= sp;       Type,
-  IN CONST VOID         = ;    *HobStart
-  )
-{
-  EFI_PEI_HOB_POINTERS  Hob;
-
-  ASSERT (HobStart !=3D NULL);
-
-  Hob.Raw =3D (UINT8 *) HobStart;
-  //
-  // Parse the HOB list until end of list or matching type is found.=
-  //
-  while (!END_OF_HOB_LIST (Hob)) {
-    if (Hob.Header->HobType =3D=3D Type) {
-      return Hob.Raw;
-    }
-    Hob.Raw =3D GET_NEXT_HOB (Hob);
-  }
-  return NULL;
-}
-
-/**
-  Returns the first instance of a HOB type among the whole HOB list.=
-
-  This function searches the first instance of a HOB type among the = whole HOB list.
-  If there does not exist such HOB type in the HOB list, it will ret= urn NULL.
-
-  If the pointer to the HOB list is NULL, then ASSERT().
-
-  @param  Type        &= nbsp; The HOB type to return.
-
-  @return The next instance of a HOB type from the starting HOB.
-
-**/
-VOID *
-EFIAPI
-GetFirstHob (
-  IN UINT16         &nb= sp;       Type
-  )
-{
-  VOID      *HobList;
-
-  HobList =3D GetHobList ();
-  return GetNextHob (Type, HobList);
-}
-
-/**
-  Returns the next instance of the matched GUID HOB from the startin= g HOB.
-
-  This function searches the first instance of a HOB from the starti= ng HOB pointer.
-  Such HOB should satisfy two conditions:
-  its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equ= als to the input Guid.
-  If such a HOB from the starting HOB pointer does not exist, it wil= l return NULL.
-  Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_= DATA_SIZE ()
-  to extract the data section and its size information, respectively= .
-  In contrast with macro GET_NEXT_HOB(), this function does not skip= the starting HOB pointer
-  unconditionally: it returns HobStart back if HobStart itself meets= the requirement;
-  caller is required to use GET_NEXT_HOB() if it wishes to skip curr= ent HobStart.
-
-  If Guid is NULL, then ASSERT().
-  If HobStart is NULL, then ASSERT().
-
-  @param  Guid        &= nbsp; The GUID to match with in the HOB list.
-  @param  HobStart      A pointer to a= Guid.
-
-  @return The next instance of the matched GUID HOB from the startin= g HOB.
-
-**/
-VOID *
-EFIAPI
-GetNextGuidHob (
-  IN CONST EFI_GUID         = *Guid,
-  IN CONST VOID         = ;    *HobStart
-  )
-{
-  EFI_PEI_HOB_POINTERS  GuidHob;
-
-  GuidHob.Raw =3D (UINT8 *) HobStart;
-  while ((GuidHob.Raw =3D GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, G= uidHob.Raw)) !=3D NULL) {
-    if (CompareGuid (Guid, &GuidHob.Guid->Name)) {<= br> -      break;
-    }
-    GuidHob.Raw =3D GET_NEXT_HOB (GuidHob);
-  }
-  return GuidHob.Raw;
-}
-
-/**
-  Returns the first instance of the matched GUID HOB among the whole= HOB list.
-
-  This function searches the first instance of a HOB among the whole= HOB list.
-  Such HOB should satisfy two conditions:
-  its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equa= ls to the input Guid.
-  If such a HOB from the starting HOB pointer does not exist, it wil= l return NULL.
-  Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_= DATA_SIZE ()
-  to extract the data section and its size information, respectively= .
-
-  If the pointer to the HOB list is NULL, then ASSERT().
-  If Guid is NULL, then ASSERT().
-
-  @param  Guid        &= nbsp; The GUID to match with in the HOB list.
-
-  @return The first instance of the matched GUID HOB among the whole= HOB list.
-
-**/
-VOID *
-EFIAPI
-GetFirstGuidHob (
-  IN CONST EFI_GUID         = *Guid
-  )
-{
-  VOID      *HobList;
-
-  HobList =3D GetHobList ();
-  return GetNextGuidHob (Guid, HobList);
-}
-
-/**
-  Get the system boot mode from the HOB list.
-
-  This function returns the system boot mode information from the -  PHIT HOB in HOB list.
-
-  If the pointer to the HOB list is NULL, then ASSERT().
-
-  @param  VOID
-
-  @return The Boot Mode.
-
-**/
-EFI_BOOT_MODE
-EFIAPI
-GetBootModeHob (
-  VOID
-  )
-{
-  EFI_HOB_HANDOFF_INFO_TABLE    *HandOffHob;
-
-  HandOffHob =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
-
-  return HandOffHob->BootMode;
-}
-
 VOID *
 CreateHob (
   IN  UINT16    HobType,
@@ -510,93 +328,3 @@ BuildMemoryAllocationHob (
   //
   ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->Al= locDescriptor.Reserved));
 }
-
-/**
-  Builds a HOB that describes a chunk of system memory with Owner GU= ID.
-
-  This function builds a HOB that describes a chunk of system memory= .
-  If there is no additional space for HOB creation, then ASSERT(). -
-  @param  ResourceType       = ; The type of resource described by this HOB.
-  @param  ResourceAttribute   The resource attributes= of the memory described by this HOB.
-  @param  PhysicalStart       The= 64 bit physical address of memory described by this HOB.
-  @param  NumberOfBytes       The= length of the memory described by this HOB in bytes.
-  @param  OwnerGUID       &n= bsp;   GUID for the owner of this resource.
-
-**/
-VOID
-EFIAPI
-BuildResourceDescriptorWithOwnerHob (
-  IN EFI_RESOURCE_TYPE       &nbs= p;    ResourceType,
-  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
-  IN EFI_PHYSICAL_ADDRESS       &= nbsp; PhysicalStart,
-  IN UINT64         &nb= sp;            = NumberOfBytes,
-  IN EFI_GUID         &= nbsp;           *OwnerGUI= D
-  )
-{
-  ASSERT (FALSE);
-}
-
-/**
-  Builds a Capsule Volume HOB.
-
-  This function builds a Capsule Volume HOB.
-  If the platform does not support Capsule Volume HOBs, then ASSERT(= ).
-  If there is no additional space for HOB creation, then ASSERT(). -
-  @param  BaseAddress   The base address of the Capsu= le Volume.
-  @param  Length        The = size of the Capsule Volume in bytes.
-
-**/
-VOID
-EFIAPI
-BuildCvHob (
-  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
-  IN UINT64         &nb= sp;            Lengt= h
-  )
-{
-  ASSERT (FALSE);
-}
-
-
-/**
-  Builds a HOB for the BSP store.
-
-  This function builds a HOB for BSP store.
-  If there is no additional space for HOB creation, then ASSERT(). -
-  @param  BaseAddress   The 64 bit physical address o= f the BSP.
-  @param  Length        The = length of the BSP store in bytes.
-  @param  MemoryType    Type of memory allocated= by this HOB.
-
-**/
-VOID
-EFIAPI
-BuildBspStoreHob (
-  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
-  IN UINT64         &nb= sp;            Lengt= h,
-  IN EFI_MEMORY_TYPE        =      MemoryType
-  )
-{
-  ASSERT (FALSE);
-}
-
-/**
-  Builds a HOB for the Stack.
-
-  This function builds a HOB for the stack.
-  If there is no additional space for HOB creation, then ASSERT(). -
-  @param  BaseAddress   The 64 bit physical address o= f the Stack.
-  @param  Length        The = length of the stack in bytes.
-
-**/
-VOID
-EFIAPI
-BuildStackHob (
-  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
-  IN UINT64         &nb= sp;            Lengt= h
-  )
-{
-  ASSERT (FALSE);
-}
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c b/Sta= ndaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c
new file mode 100644
index 000000000000..8c535032315a
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/Common.c
@@ -0,0 +1,291 @@
+/** @file
+  HOB Library implementation for Standalone MM Core.
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR&= gt;
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> +
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiMm.h>
+
+#include <Library/HobLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/StandaloneMmCoreEntryPoint.h>
+
+#include <Guid/MemoryAllocationHob.h>
+
+/**
+  Returns the pointer to the HOB list.
+
+  This function returns the pointer to first HOB in the list.
+  If the pointer to the HOB list is NULL, then ASSERT().
+
+  @return The pointer to the HOB list.
+
+**/
+VOID *
+EFIAPI
+GetHobList (
+  VOID
+  )
+{
+  ASSERT (gHobList !=3D NULL);
+  return gHobList;
+}
+
+/**
+  Returns the next instance of a HOB type from the starting HOB.
+
+  This function searches the first instance of a HOB type from the s= tarting HOB pointer.
+  If there does not exist such HOB type from the starting HOB pointe= r, it will return NULL.
+  In contrast with macro GET_NEXT_HOB(), this function does not skip= the starting HOB pointer
+  unconditionally: it returns HobStart back if HobStart itself meets= the requirement;
+  caller is required to use GET_NEXT_HOB() if it wishes to skip curr= ent HobStart.
+
+  If HobStart is NULL, then ASSERT().
+
+  @param  Type        &= nbsp; The HOB type to return.
+  @param  HobStart      The starting H= OB pointer to search from.
+
+  @return The next instance of a HOB type from the starting HOB.
+
+**/
+VOID *
+EFIAPI
+GetNextHob (
+  IN UINT16         &nb= sp;       Type,
+  IN CONST VOID         = ;    *HobStart
+  )
+{
+  EFI_PEI_HOB_POINTERS  Hob;
+
+  ASSERT (HobStart !=3D NULL);
+
+  Hob.Raw =3D (UINT8 *) HobStart;
+  //
+  // Parse the HOB list until end of list or matching type is found.=
+  //
+  while (!END_OF_HOB_LIST (Hob)) {
+    if (Hob.Header->HobType =3D=3D Type) {
+      return Hob.Raw;
+    }
+    Hob.Raw =3D GET_NEXT_HOB (Hob);
+  }
+  return NULL;
+}
+
+/**
+  Returns the first instance of a HOB type among the whole HOB list.=
+
+  This function searches the first instance of a HOB type among the = whole HOB list.
+  If there does not exist such HOB type in the HOB list, it will ret= urn NULL.
+
+  If the pointer to the HOB list is NULL, then ASSERT().
+
+  @param  Type        &= nbsp; The HOB type to return.
+
+  @return The next instance of a HOB type from the starting HOB.
+
+**/
+VOID *
+EFIAPI
+GetFirstHob (
+  IN UINT16         &nb= sp;       Type
+  )
+{
+  VOID      *HobList;
+
+  HobList =3D GetHobList ();
+  return GetNextHob (Type, HobList);
+}
+
+/**
+  Returns the next instance of the matched GUID HOB from the startin= g HOB.
+
+  This function searches the first instance of a HOB from the starti= ng HOB pointer.
+  Such HOB should satisfy two conditions:
+  its HOB type is EFI_HOB_TYPE_GUID_EXTENSION, and its GUID Name equ= als to the input Guid.
+  If such a HOB from the starting HOB pointer does not exist, it wil= l return NULL.
+  Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_= DATA_SIZE ()
+  to extract the data section and its size information, respectively= .
+  In contrast with macro GET_NEXT_HOB(), this function does not skip= the starting HOB pointer
+  unconditionally: it returns HobStart back if HobStart itself meets= the requirement;
+  caller is required to use GET_NEXT_HOB() if it wishes to skip curr= ent HobStart.
+
+  If Guid is NULL, then ASSERT().
+  If HobStart is NULL, then ASSERT().
+
+  @param  Guid        &= nbsp; The GUID to match with in the HOB list.
+  @param  HobStart      A pointer to a= Guid.
+
+  @return The next instance of the matched GUID HOB from the startin= g HOB.
+
+**/
+VOID *
+EFIAPI
+GetNextGuidHob (
+  IN CONST EFI_GUID         = *Guid,
+  IN CONST VOID         = ;    *HobStart
+  )
+{
+  EFI_PEI_HOB_POINTERS  GuidHob;
+
+  GuidHob.Raw =3D (UINT8 *) HobStart;
+  while ((GuidHob.Raw =3D GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, G= uidHob.Raw)) !=3D NULL) {
+    if (CompareGuid (Guid, &GuidHob.Guid->Name)) {<= br> +      break;
+    }
+    GuidHob.Raw =3D GET_NEXT_HOB (GuidHob);
+  }
+  return GuidHob.Raw;
+}
+
+/**
+  Returns the first instance of the matched GUID HOB among the whole= HOB list.
+
+  This function searches the first instance of a HOB among the whole= HOB list.
+  Such HOB should satisfy two conditions:
+  its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equa= ls to the input Guid.
+  If such a HOB from the starting HOB pointer does not exist, it wil= l return NULL.
+  Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_= DATA_SIZE ()
+  to extract the data section and its size information, respectively= .
+
+  If the pointer to the HOB list is NULL, then ASSERT().
+  If Guid is NULL, then ASSERT().
+
+  @param  Guid        &= nbsp; The GUID to match with in the HOB list.
+
+  @return The first instance of the matched GUID HOB among the whole= HOB list.
+
+**/
+VOID *
+EFIAPI
+GetFirstGuidHob (
+  IN CONST EFI_GUID         = *Guid
+  )
+{
+  VOID      *HobList;
+
+  HobList =3D GetHobList ();
+  return GetNextGuidHob (Guid, HobList);
+}
+
+/**
+  Get the system boot mode from the HOB list.
+
+  This function returns the system boot mode information from the +  PHIT HOB in HOB list.
+
+  If the pointer to the HOB list is NULL, then ASSERT().
+
+  @param  VOID
+
+  @return The Boot Mode.
+
+**/
+EFI_BOOT_MODE
+EFIAPI
+GetBootModeHob (
+  VOID
+  )
+{
+  EFI_HOB_HANDOFF_INFO_TABLE    *HandOffHob;
+
+  HandOffHob =3D (EFI_HOB_HANDOFF_INFO_TABLE *) GetHobList ();
+
+  return HandOffHob->BootMode;
+}
+
+
+/**
+  Builds a HOB that describes a chunk of system memory with Owner GU= ID.
+
+  This function builds a HOB that describes a chunk of system memory= .
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  ResourceType       = ; The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes= of the memory described by this HOB.
+  @param  PhysicalStart       The= 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The= length of the memory described by this HOB in bytes.
+  @param  OwnerGUID       &n= bsp;   GUID for the owner of this resource.
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorWithOwnerHob (
+  IN EFI_RESOURCE_TYPE       &nbs= p;    ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS       &= nbsp; PhysicalStart,
+  IN UINT64         &nb= sp;            = NumberOfBytes,
+  IN EFI_GUID         &= nbsp;           *OwnerGUI= D
+  )
+{
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a Capsule Volume HOB.
+
+  This function builds a Capsule Volume HOB.
+  If the platform does not support Capsule Volume HOBs, then ASSERT(= ).
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  BaseAddress   The base address of the Capsu= le Volume.
+  @param  Length        The = size of the Capsule Volume in bytes.
+
+**/
+VOID
+EFIAPI
+BuildCvHob (
+  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
+  IN UINT64         &nb= sp;            Lengt= h
+  )
+{
+  ASSERT (FALSE);
+}
+
+
+/**
+  Builds a HOB for the BSP store.
+
+  This function builds a HOB for BSP store.
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  BaseAddress   The 64 bit physical address o= f the BSP.
+  @param  Length        The = length of the BSP store in bytes.
+  @param  MemoryType    Type of memory allocated= by this HOB.
+
+**/
+VOID
+EFIAPI
+BuildBspStoreHob (
+  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
+  IN UINT64         &nb= sp;            Lengt= h,
+  IN EFI_MEMORY_TYPE        =      MemoryType
+  )
+{
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a HOB for the Stack.
+
+  This function builds a HOB for the stack.
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  BaseAddress   The 64 bit physical address o= f the Stack.
+  @param  Length        The = length of the stack in bytes.
+
+**/
+VOID
+EFIAPI
+BuildStackHob (
+  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
+  IN UINT64         &nb= sp;            Lengt= h
+  )
+{
+  ASSERT (FALSE);
+}
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standalone= MmCoreHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/Standal= oneMmCoreHobLib.c
new file mode 100644
index 000000000000..61afe8706486
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreH= obLib.c
@@ -0,0 +1,298 @@
+/** @file
+  HOB Library implementation for Standalone MM Core.
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR&= gt;
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR> +
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <PiMm.h>
+
+#include <Library/HobLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseMemoryLib.h>
+
+#include <Guid/MemoryAllocationHob.h>
+
+/**
+  Builds a HOB for a loaded PE32 module.
+
+  This function builds a HOB for a loaded PE32 module.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If ModuleName is NULL, then ASSERT().
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  ModuleName       &= nbsp;      The GUID File Name of the module.
+  @param  MemoryAllocationModule  The 64 bit physical addr= ess of the module.
+  @param  ModuleLength       = ;     The length of the module in bytes.
+  @param  EntryPoint       &= nbsp;      The 64 bit physical address of the modu= le entry point.
+
+**/
+VOID
+EFIAPI
+BuildModuleHob (
+  IN CONST EFI_GUID         = *ModuleName,
+  IN EFI_PHYSICAL_ADDRESS   MemoryAllocationModule,
+  IN UINT64         &nb= sp;       ModuleLength,
+  IN EFI_PHYSICAL_ADDRESS   EntryPoint
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a HOB that describes a chunk of system memory.
+
+  This function builds a HOB that describes a chunk of system memory= .
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  ResourceType       = ; The type of resource described by this HOB.
+  @param  ResourceAttribute   The resource attributes= of the memory described by this HOB.
+  @param  PhysicalStart       The= 64 bit physical address of memory described by this HOB.
+  @param  NumberOfBytes       The= length of the memory described by this HOB in bytes.
+
+**/
+VOID
+EFIAPI
+BuildResourceDescriptorHob (
+  IN EFI_RESOURCE_TYPE       &nbs= p;    ResourceType,
+  IN EFI_RESOURCE_ATTRIBUTE_TYPE  ResourceAttribute,
+  IN EFI_PHYSICAL_ADDRESS       &= nbsp; PhysicalStart,
+  IN UINT64         &nb= sp;            = NumberOfBytes
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a customized HOB tagged with a GUID for identification and = returns
+  the start address of GUID HOB data.
+
+  This function builds a customized HOB tagged with a GUID for ident= ification
+  and returns the start address of GUID HOB data so that caller can = fill the customized data.
+  The HOB Header and Name field is already stripped.
+  It can only be invoked during PEI phase.
+  For MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If Guid is NULL, then ASSERT().
+  If there is no additional space for HOB creation, then ASSERT(). +  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASS= ERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength= is 0xFFF8.
+
+  @param  Guid        &= nbsp; The GUID to tag the customized HOB.
+  @param  DataLength    The size of the data pay= load for the GUID HOB.
+
+  @retval  NULL        = The GUID HOB could not be allocated.
+  @retval  others       The start= address of GUID HOB data.
+
+**/
+VOID *
+EFIAPI
+BuildGuidHob (
+  IN CONST EFI_GUID        &= nbsp;     *Guid,
+  IN UINTN         &nbs= p;             = DataLength
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+  return NULL;
+}
+
+/**
+  Builds a customized HOB tagged with a GUID for identification, cop= ies the input data to the HOB
+  data field, and returns the start address of the GUID HOB data. +
+  This function builds a customized HOB tagged with a GUID for ident= ification and copies the input
+  data to the HOB data field and returns the start address of the GU= ID HOB data.  It can only be
+  invoked during PEI phase; for MM phase, it will ASSERT() because P= EI HOB is read-only for MM phase.
+  The HOB Header and Name field is already stripped.
+  It can only be invoked during PEI phase.
+  For MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If Guid is NULL, then ASSERT().
+  If Data is NULL and DataLength > 0, then ASSERT().
+  If there is no additional space for HOB creation, then ASSERT(). +  If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASS= ERT().
+  HobLength is UINT16 and multiples of 8 bytes, so the max HobLength= is 0xFFF8.
+
+  @param  Guid        &= nbsp; The GUID to tag the customized HOB.
+  @param  Data        &= nbsp; The data to be copied into the data field of the GUID HOB.
+  @param  DataLength    The size of the data pay= load for the GUID HOB.
+
+  @retval  NULL        = The GUID HOB could not be allocated.
+  @retval  others       The start= address of GUID HOB data.
+
+**/
+VOID *
+EFIAPI
+BuildGuidDataHob (
+  IN CONST EFI_GUID        &= nbsp;     *Guid,
+  IN VOID          = ;            &n= bsp; *Data,
+  IN UINTN         &nbs= p;             = DataLength
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+  return NULL;
+}
+
+/**
+  Builds a Firmware Volume HOB.
+
+  This function builds a Firmware Volume HOB.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If there is no additional space for HOB creation, then ASSERT(). +  If the FvImage buffer is not at its required alignment, then ASSER= T().
+
+  @param  BaseAddress   The base address of the Firmw= are Volume.
+  @param  Length        The = size of the Firmware Volume in bytes.
+
+**/
+VOID
+EFIAPI
+BuildFvHob (
+  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
+  IN UINT64         &nb= sp;            Lengt= h
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a EFI_HOB_TYPE_FV2 HOB.
+
+  This function builds a EFI_HOB_TYPE_FV2 HOB.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If there is no additional space for HOB creation, then ASSERT(). +  If the FvImage buffer is not at its required alignment, then ASSER= T().
+
+  @param  BaseAddress   The base address of the Firmw= are Volume.
+  @param  Length        The = size of the Firmware Volume in bytes.
+  @param  FvName        The = name of the Firmware Volume.
+  @param  FileName      The name of th= e file.
+
+**/
+VOID
+EFIAPI
+BuildFv2Hob (
+  IN          EFI_PHYSI= CAL_ADDRESS        BaseAddress,
+  IN          UINT64&nb= sp;            =          Length,
+  IN CONST    EFI_GUID     &= nbsp;           &nbs= p;  *FvName,
+  IN CONST    EFI_GUID     &= nbsp;           &nbs= p;  *FileName
+  )
+{
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a EFI_HOB_TYPE_FV3 HOB.
+
+  This function builds a EFI_HOB_TYPE_FV3 HOB.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() since PEI HOB is read-only for MM p= hase.
+
+  If there is no additional space for HOB creation, then ASSERT(). +  If the FvImage buffer is not at its required alignment, then ASSER= T().
+
+  @param BaseAddress        =     The base address of the Firmware Volume.
+  @param Length         = ;        The size of the Firmware Volume= in bytes.
+  @param AuthenticationStatus   The authentication status.=
+  @param ExtractedFv        =     TRUE if the FV was extracted as a file within
+            &= nbsp;           &nbs= p;       another firmware volume. FALSE other= wise.
+  @param FvName         = ;        The name of the Firmware Volume= .
+            &= nbsp;           &nbs= p;       Valid only if IsExtractedFv is TRUE.=
+  @param FileName        &nb= sp;      The name of the file.
+            &= nbsp;           &nbs= p;       Valid only if IsExtractedFv is TRUE.=
+
+**/
+VOID
+EFIAPI
+BuildFv3Hob (
+  IN          EFI_PHYSI= CAL_ADDRESS        BaseAddress,
+  IN          UINT64&nb= sp;            =          Length,
+  IN          UINT32&nb= sp;            =          AuthenticationStatus,
+  IN          BOOLEAN&n= bsp;            = ;        ExtractedFv,
+  IN CONST    EFI_GUID     &= nbsp;           &nbs= p;  *FvName, OPTIONAL
+  IN CONST    EFI_GUID     &= nbsp;           &nbs= p;  *FileName OPTIONAL
+  )
+{
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a HOB for the CPU.
+
+  This function builds a HOB for the CPU.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  SizeOfMemorySpace   The maximum physical me= mory addressability of the processor.
+  @param  SizeOfIoSpace       The= maximum physical I/O addressability of the processor.
+
+**/
+VOID
+EFIAPI
+BuildCpuHob (
+  IN UINT8         &nbs= p;             = SizeOfMemorySpace,
+  IN UINT8         &nbs= p;             = SizeOfIoSpace
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
+
+/**
+  Builds a HOB for the memory allocation.
+
+  This function builds a HOB for the memory allocation.
+  It can only be invoked during PEI phase;
+  for MM phase, it will ASSERT() because PEI HOB is read-only for MM= phase.
+
+  If there is no additional space for HOB creation, then ASSERT(). +
+  @param  BaseAddress   The 64 bit physical address o= f the memory.
+  @param  Length        The = length of the memory allocation in bytes.
+  @param  MemoryType    Type of memory allocated= by this HOB.
+
+**/
+VOID
+EFIAPI
+BuildMemoryAllocationHob (
+  IN EFI_PHYSICAL_ADDRESS        = BaseAddress,
+  IN UINT64         &nb= sp;            Lengt= h,
+  IN EFI_MEMORY_TYPE        =      MemoryType
+  )
+{
+  //
+  // PEI HOB is read only for MM phase
+  //
+  ASSERT (FALSE);
+}
diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo= reHobLib.inf b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmC= oreHobLib.inf
index 0046cd804def..a2559920e887 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLi= b.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLi= b.inf
@@ -22,16 +22,21 @@ [Defines]
   LIBRARY_CLASS        =           =3D HobLib|MM_CORE_S= TANDALONE
 
 #
-#  VALID_ARCHITECTURES       &nbs= p;   =3D AARCH64
+#  VALID_ARCHITECTURES       &nbs= p;   =3D X64 AARCH64
 #
-[Sources.Common]
-  StandaloneMmCoreHobLib.c
+[Sources.common]
+  Common.c
+
+[Sources.X64]
+  X64/StandaloneMmCoreHobLib.c
 
 [Sources.AARCH64]
+  AArch64/StandaloneMmCoreHobLib.c
   AArch64/StandaloneMmCoreHobLibInternal.c
 
 [Packages]
   MdePkg/MdePkg.dec
+  StandaloneMmPkg/StandaloneMmPkg.dec
 
 
 [LibraryClasses]
--
2.30.0.windows.1




 

--_000_BY5PR11MB41667AD3744F0007A2EB0E608CBC9BY5PR11MB4166namp_--