From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.92.45.35]) by mx.groups.io with SMTP id smtpd.web09.991.1611192892807850639 for ; Wed, 20 Jan 2021 17:34:53 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=BepqlllQ; spf=pass (domain: outlook.com, ip: 40.92.45.35, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oeXCCCIVaHtvpDdpw/QYJ6HHffvCEFT6kChZ0h0n8LfK6lPsHTXxeA33YTEQcaJwBpsOi8CthnGYz8Fy8I13xa+GzO6SmDDWVxIbR+6rb23uDE0/k7fiwhkrCIM3LkfaeTwU1wBKBt0o1cmnIBB9ifhQ0FxE09HScUflbMTRa5a0ezhxiYMRwlsU3BqyGNmExvPnffZUsKGhXS0ivPWiXTWhG9Qs3mDNc8NxzNHO/Mu6+RkcKtJNmBVf0mSgesk0CamkqZuBOHbnAN387aKIV04f+b9g2xpTChxEiFbktX8OIogeVGpYCUqKsVDMIVDUsyIWqPn0BNbU8/SdZhjVkw== 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=J8lhSZpvbBRGftHeJU4E5Q9HkSJHMOGdX2GYOdy/ARo=; b=Omm4OihnpPHcePYf3SyqD9ha1lA+v7XfylqBzFvO378+eU+VvSzlya+Nh2/P0TnDIhd0L2CMAkvhqs7HbR/6YcmEZm8/sdafxK4mvAd4bt553kSXlw1vCcrd0zBVM6ovmocA3d86Wto9PgRDg45rqvdwqxM/2rKxsMppSkHFhPFKTUz8JX2ppR7Xfb932rJVeUtL/wNnDwwykM8QS5J/Uud3+QSeBQGMTLSevtmllS6g5eI22Vqoysjc5XXp1HO0TF9QEsvmQ6SWhWd4X72U8eMFVAvfnN18mgyTGEi+XBmyfgEZOzK5DtZeS3EN9K5SvHvV9sWN3QY1QYWQVRkMDQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=J8lhSZpvbBRGftHeJU4E5Q9HkSJHMOGdX2GYOdy/ARo=; b=BepqlllQbkVc/pOeHUxyzEmkLdmDf4RcecBfkSBbXF2iO4Z7T/WNzaIB+PY1R/+HhYM+9KxPQ0ZCiN+VtP0RfUyCBeCtFaWB+sU91GWSeUbo6igTxgWP9BCxvpiusZyjD5/3y464fhaUWsfJ4nzAS8m2/a7AdWQG0w7ZTTYnak/97peP5s82ZnQYq6umclG9hdelt8tuNLAk0GNREOcdUgZ21HMXUK1Io+B0YkU5YdRf423YY7aJtDhK9lwB5vTNkYypMW82MfGWd+vgxYbRPtc9A6IuHuLiQtdH+sFztWClSP2Y9v8xPxy8kQB2Tkq2bSpc5NT8aKQNBeuNlCmlZw== Received: from BN3NAM04FT030.eop-NAM04.prod.protection.outlook.com (10.152.92.54) by BN3NAM04HT011.eop-NAM04.prod.protection.outlook.com (10.152.92.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12; Thu, 21 Jan 2021 01:34:50 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e4e::4d) by BN3NAM04FT030.mail.protection.outlook.com (2a01:111:e400:7e4e::164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Thu, 21 Jan 2021 01:34:50 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::acb3:ab69:563d:b0d6]) by MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::acb3:ab69:563d:b0d6%5]) with mapi id 15.20.3763.014; Thu, 21 Jan 2021 01:34:50 +0000 From: "Kun Qin" To: "devel@edk2.groups.io" , Ard Biesheuvel , Sami Mujawar , Jiewen Yao , 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+W4Ur49PxunaoxVMei Date: Thu, 21 Jan 2021 01:34:50 +0000 Message-ID: References: <20210114223400.2596-1-kun.q@outlook.com>,<165A3A1108D15505.7065@groups.io> In-Reply-To: <165A3A1108D15505.7065@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:110C5BE6708FF6EF03278DA4746C1461934020A249594AF9691E818927E9BF4A;UpperCasedChecksum:B7BEAB1F6202BD736B238DCE82838D8AD8FFD96B4F654CE5C63ABB86A595190A;SizeAsReceived:7047;Count:43 x-tmn: [7soN7Jfqf7z0g8lKNIpBJ/OZk/5iBV6t] x-ms-publictraffictype: Email x-incomingheadercount: 43 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: e82b0855-619c-4ff2-3a49-08d8bdacbe93 x-ms-traffictypediagnostic: BN3NAM04HT011: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 9q+uDyogjsLoqiykPL/f+qALmNEKic78zSukwtjEN6XMZDoDnX6VIusX+3rHMX56ZqjL3fcYW4PTWnKgfAatZe0BZbLxHTKdfKSUpxldisWGbB9b9V8L+odhzvOZj5jygWFJZgLwmE5tVext69WFWv+2rRpE3GFLQB1Tg618piMzPVKUu9cmMvo9dQqHKjloUEsjs3xQMslPQGY8JazziTND2vSqsOsb33Ksr9U3r6IZSG0qsaY4CV9oHhDhh7BG4seOAFwgXgsOnZECycrgJveEhp0plhvFP9xf+5C/5Lo= x-ms-exchange-antispam-messagedata: ciY/xpkZRwGduYpBMJYSFt8rvF3B3OEU6M+SCJGd30LaZcBTuJElmhEA3IXODIDbfB1KCdv7NeVHLn2OPTdPLAc+9j6JGJDdc/4gRz56kfx3wFWfsXpT9QDeSxU0FjUIt3G2vIA1IpOiUSB1ivYe/w== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: BN3NAM04FT030.eop-NAM04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: e82b0855-619c-4ff2-3a49-08d8bdacbe93 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2021 01:34:50.1246 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3NAM04HT011 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MWHPR06MB3102C679E8110BF974C68A0EF3A10MWHPR06MB3102namp_" --_000_MWHPR06MB3102C679E8110BF974C68A0EF3A10MWHPR06MB3102namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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_MWHPR06MB3102C679E8110BF974C68A0EF3A10MWHPR06MB3102namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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: Kun 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.biesheuvel@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>

Signed-off-by: Kun Qin <kun.q@outlook.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_MWHPR06MB3102C679E8110BF974C68A0EF3A10MWHPR06MB3102namp_--