From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.92.19.41]) by mx.groups.io with SMTP id smtpd.web08.1119.1608317429959626559 for ; Fri, 18 Dec 2020 10:50:30 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=o2+8lx2V; spf=pass (domain: outlook.com, ip: 40.92.19.41, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bUyJpz1NdBoiHe+qkSvHrhWZrPe/s0iAawBo7Smv+MRCiLVl+u72HmOjLpd3WayEpHZta70PpbRswvcwswkxJUgfmseMDnjHW076ES/OCmcPbCbiuX5XFLE1klc08QkWAg0tmJnMiEvJndz9FyKVpwatC5PBOlOLamkfUS80jLnG3ODnYclleEYRzJY49IgtCY2WYVq8Qh6RXMla+nhvWLtuXp0thw7S469Z7tqCvMANV+w8FfeLpbsGPIdffAZa/LsGVHQwML1acjzFGqj8waUY1YlYIsP24qesp/h+9oLBW/4rlvQceWsOZTIvDrzx02p6BQF5H7RbkwCdDheFGQ== 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=gHkCHLELdpZ8PUj/VMmOCBfqXFjlhtdVVJEkR7WB8/4=; b=dc5MtEohMVx+j8Zyrd/cHGKkcqboadPenA2VYgOsXY5OnNRqwmHaHcrknUI/l5RM0M9aEtZmo5LjYGOdFAIh/63tUhPtaYUuCEaM8o+Cl2P2bMk9JWsdXw5CWpcCx/lxvPuKNnimsWGVIpBbugXx+YXjKY0NmrFW0IF6wvqUok8XExQT3F7rSvBDmOQ62Uh8GPslKL3Eon81lGi2oSIDoHlRHKfHyCL8Inu5npPbcpbYv74TVLAJCLlX3Yow5WcCZhVhJd/SqykSHCwAimSgt1Hy/CTL9WNGwzpXcgjdPfD47dZinojW7rJniPyGzxoMzryi2UUsVD93C+qZrJL/qw== 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=gHkCHLELdpZ8PUj/VMmOCBfqXFjlhtdVVJEkR7WB8/4=; b=o2+8lx2VYOn4NDe9oHbjRiHnFcHvMnTmF5Gir01CjmxFvKmjWHZED7NFll1+ug6q1BMkAmyst0KWmvCvHZ1VFN3xFIwkgt4NtbeZifBGJtrPcAplgqaHgYBBar1Gb2yDVMMYAI59fFwpyddFoGlA30MnNSjbNqNf6azta6qAbZ/sUXRx11x2jeprL+Vyfkw3aJ3FIOlVKzFix9A4QFAvLeNORcJLQdXuj0DwdV7VzaXfKiLEBuw9bpOUQkW1Lq+rPIVRLFuBaBRML2y7kyIUlqBx/wt0/RnRMh4PhIb6PICyHMKY2NF/Nx8vo46Yma4FnoHJ4jYkwcZERunEBqReAw== Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::40) by DM6NAM11HT121.eop-nam11.prod.protection.outlook.com (2a01:111:e400:fc4d::240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25; Fri, 18 Dec 2020 18:50:28 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:fc4d::48) by DM6NAM11FT039.mail.protection.outlook.com (2a01:111:e400:fc4d::83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3676.25 via Frontend Transport; Fri, 18 Dec 2020 18:50:28 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:D902998453981F99C68A51B9CC22B85CC1DB131B5821289D0C7114B59EE38290;UpperCasedChecksum:64FB247543050844965402C7ACC8D8F75CC3D7B32E97E1BBA4BC2BFB08370516;SizeAsReceived:7506;Count:47 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.3654.026; Fri, 18 Dec 2020 18:50:28 +0000 From: "Kun Qin" To: devel@edk2.groups.io CC: Ard Biesheuvel , Sami Mujawar , Jiewen Yao , Supreeth Venkatesh Subject: [PATCH v1 02/15] StandaloneMmPkg: StandaloneMmCoreHobLib: Extend support for x64 Mm Core Date: Fri, 18 Dec 2020 10:49:58 -0800 Message-ID: X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201218185011.1366-1-kun.q@outlook.com> References: <20201218185011.1366-1-kun.q@outlook.com> X-TMN: [QNI6dqiFasgLPNVOtp7TfE4Gj02W6dqt] X-ClientProxiedBy: MW2PR16CA0018.namprd16.prod.outlook.com (2603:10b6:907::31) To MWHPR06MB3102.namprd06.prod.outlook.com (2603:10b6:301:3e::35) Return-Path: kun.q@outlook.com X-Microsoft-Original-Message-ID: <20201218185011.1366-3-kun.q@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (50.35.88.161) by MW2PR16CA0018.namprd16.prod.outlook.com (2603:10b6:907::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Fri, 18 Dec 2020 18:50:28 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 12a4b18f-9a57-4273-6fc3-08d8a385ca14 X-MS-TrafficTypeDiagnostic: DM6NAM11HT121: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: esGJbmVNYg6xapA4JKjv3jRVWxf5isJnWembXUuMIB0BV+eqyTpf/rQ9r5TN+rivkvh9Z6Sb4OWS5JyqA48m8E6X+dd2PX1RGs+BcGqnGptsPddQGjolXFc22sPUfvzNXPNapaZTx3nJkYer1ckgTAqDflweXbLzCSEIzcqtnynqAG/JSUtVScTJ85MPEbZNNT2NjBvIvuWvNEUy3twsMEZfxCl37xyKh/S7/BXbMQx9sfKTN/LmnOyNORAIYvFd X-MS-Exchange-AntiSpam-MessageData: SYQrqLhFMrx38ggHl1mxmHvCDj1Yz+1spPTh0gVGpWl81qdNh0Ym8OOTo4o8uaW1WXbBxaJCZkkR810g+sEBtybCA665esxxMKJlBYljWOCQsEkcr0AUyCqWpNlIimhXLjKQ0mB20Yvaz39QNg5xPw== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2020 18:50:28.8630 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-Network-Message-Id: 12a4b18f-9a57-4273-6fc3-08d8a385ca14 X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6NAM11HT121 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain This change adds support of x64 version of StandaloneMmCoreHobLib. It brings in global variable "gHobList" through StandaloneMmCoreEntryPoint and imports implementation from DxeCoreHobLib.inf to support x64 Mm Core. Cc: Ard Biesheuvel Cc: Sami Mujawar Cc: Jiewen Yao Cc: Supreeth Venkatesh Signed-off-by: Kun Qin --- StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =3D> AArch64}/StandaloneM= mCoreHobLib.c | 6 +- StandaloneMmPkg/Library/StandaloneMmCoreHobLib/{ =3D> X64}/StandaloneMmCor= eHobLib.c | 426 ++++++++++---------- StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf = | 8 +- 3 files changed, 215 insertions(+), 225 deletions(-) diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCor= eHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/Standalo= neMmCoreHobLib.c similarity index 96% copy from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHo= bLib.c copy to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMm= CoreHobLib.c index e3d4743b63f2..006bff816e39 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib= .c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCo= reHobLib.c @@ -13,14 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include =20 -// -// Cache copy of HobList pointer. -// -VOID *gHobList =3D NULL; - /** Returns the pointer to the HOB list. =20 diff --git a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCor= eHobLib.c b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMm= CoreHobLib.c similarity index 70% rename from StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCore= HobLib.c rename to StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCo= reHobLib.c index e3d4743b63f2..69b20bf07a21 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib= .c +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/X64/StandaloneMmCoreHo= bLib.c @@ -13,14 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include =20 #include =20 -// -// Cache copy of HobList pointer. -// -VOID *gHobList =3D NULL; - /** Returns the pointer to the HOB list. =20 @@ -203,48 +199,13 @@ GetBootModeHob ( return HandOffHob->BootMode; } =20 -VOID * -CreateHob ( - IN UINT16 HobType, - IN UINT16 HobLength - ) -{ - EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob; - EFI_HOB_GENERIC_HEADER *HobEnd; - EFI_PHYSICAL_ADDRESS FreeMemory; - VOID *Hob; - - HandOffHob =3D GetHobList (); - - HobLength =3D (UINT16)((HobLength + 0x7) & (~0x7)); - - FreeMemory =3D HandOffHob->EfiFreeMemoryTop - HandOffHob->EfiFreeMemoryB= ottom; - - if (FreeMemory < HobLength) { - return NULL; - } - - Hob =3D (VOID*) (UINTN) HandOffHob->EfiEndOfHobList; - ((EFI_HOB_GENERIC_HEADER*) Hob)->HobType =3D HobType; - ((EFI_HOB_GENERIC_HEADER*) Hob)->HobLength =3D HobLength; - ((EFI_HOB_GENERIC_HEADER*) Hob)->Reserved =3D 0; - - HobEnd =3D (EFI_HOB_GENERIC_HEADER*) ((UINTN)Hob + HobLength); - HandOffHob->EfiEndOfHobList =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HobEnd; - - HobEnd->HobType =3D EFI_HOB_TYPE_END_OF_HOB_LIST; - HobEnd->HobLength =3D sizeof (EFI_HOB_GENERIC_HEADER); - HobEnd->Reserved =3D 0; - HobEnd++; - HandOffHob->EfiFreeMemoryBottom =3D (EFI_PHYSICAL_ADDRESS) (UINTN) HobEn= d; - - return Hob; -} - /** Builds a HOB for a loaded PE32 module. =20 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(). =20 @@ -263,31 +224,51 @@ BuildModuleHob ( IN EFI_PHYSICAL_ADDRESS EntryPoint ) { - EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob; + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} =20 - ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) =3D=3D 0) && - ((ModuleLength & (EFI_PAGE_SIZE - 1)) =3D=3D 0)); +/** + Builds a HOB that describes a chunk of system memory with Owner GUID. =20 - Hob =3D CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMOR= Y_ALLOCATION_MODULE)); + 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() since PEI HOB is read-only for MM phase. =20 - CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModule= Guid); - Hob->MemoryAllocationHeader.MemoryBaseAddress =3D MemoryAllocationModule= ; - Hob->MemoryAllocationHeader.MemoryLength =3D ModuleLength; - Hob->MemoryAllocationHeader.MemoryType =3D EfiBootServicesCode; + If there is no additional space for HOB creation, then ASSERT(). =20 + @param ResourceType The type of resource described by this HOB. + @param ResourceAttribute The resource attributes of the memory descri= bed by this HOB. + @param PhysicalStart The 64 bit physical address of memory descri= bed by this HOB. + @param NumberOfBytes The length of the memory described by this H= OB 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 + ) +{ // - // Zero the reserved space to match HOB spec + // PEI HOB is read only for MM phase // - ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAlloca= tionHeader.Reserved)); - - CopyGuid (&Hob->ModuleName, ModuleName); - Hob->EntryPoint =3D EntryPoint; + ASSERT (FALSE); } =20 /** Builds a HOB that describes a chunk of system memory. =20 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(). =20 @param ResourceType The type of resource described by this HOB. @@ -305,31 +286,32 @@ BuildResourceDescriptorHob ( IN UINT64 NumberOfBytes ) { - EFI_HOB_RESOURCE_DESCRIPTOR *Hob; - - Hob =3D CreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, sizeof (EFI_HOB_RES= OURCE_DESCRIPTOR)); - ASSERT (Hob !=3D NULL); - - Hob->ResourceType =3D ResourceType; - Hob->ResourceAttribute =3D ResourceAttribute; - Hob->PhysicalStart =3D PhysicalStart; - Hob->ResourceLength =3D NumberOfBytes; + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); } =20 /** - Builds a GUID HOB with a certain data length. + Builds a customized HOB tagged with a GUID for identification and return= s + the start address of GUID HOB data. =20 This function builds a customized HOB tagged with a GUID for identificat= ion and returns the start address of GUID HOB data so that caller can fill t= he 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 >=3D (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), 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 0x= FFF8. =20 @param Guid The GUID to tag the customized HOB. @param DataLength The size of the data payload for the GUID HOB. =20 - @return The start address of GUID HOB data. + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. =20 **/ VOID * @@ -339,35 +321,36 @@ BuildGuidHob ( IN UINTN DataLength ) { - EFI_HOB_GUID_TYPE *Hob; - // - // Make sure that data length is not too long. + // PEI HOB is read only for MM phase // - ASSERT (DataLength <=3D (0xffff - sizeof (EFI_HOB_GUID_TYPE))); - - Hob =3D CreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HO= B_GUID_TYPE) + DataLength)); - CopyGuid (&Hob->Name, Guid); - return Hob + 1; + ASSERT (FALSE); + return NULL; } =20 - /** - Copies a data buffer to a newly-built HOB. + Builds a customized HOB tagged with a GUID for identification, copies th= e input data to the HOB + data field, and returns the start address of the GUID HOB data. =20 - This function builds a customized HOB tagged with a GUID for identificat= ion, - copies the input data to the HOB data field and returns the start addres= s of the GUID HOB data. + This function builds a customized HOB tagged with a GUID for identificat= ion and copies the input + data to the HOB data field and returns the start address of the GUID HOB= data. It can only be + invoked during PEI phase; for MM phase, it will ASSERT() because PEI 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 >=3D (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), 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 0x= FFF8. =20 @param Guid The GUID to tag the customized HOB. @param Data The data to be copied into the data field of the G= UID HOB. @param DataLength The size of the data payload for the GUID HOB. =20 - @return The start address of GUID HOB data. + @retval NULL The GUID HOB could not be allocated. + @retval others The start address of GUID HOB data. =20 **/ VOID * @@ -378,20 +361,22 @@ BuildGuidDataHob ( IN UINTN DataLength ) { - VOID *HobData; - - ASSERT (Data !=3D NULL || DataLength =3D=3D 0); - - HobData =3D BuildGuidHob (Guid, DataLength); - - return CopyMem (HobData, Data, DataLength); + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); + return NULL; } =20 /** Builds a Firmware Volume HOB. =20 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 ASSERT(). =20 @param BaseAddress The base address of the Firmware Volume. @param Length The size of the Firmware Volume in bytes. @@ -404,24 +389,25 @@ BuildFvHob ( IN UINT64 Length ) { - EFI_HOB_FIRMWARE_VOLUME *Hob; - - Hob =3D CreateHob (EFI_HOB_TYPE_FV, sizeof (EFI_HOB_FIRMWARE_VOLUME)); - - Hob->BaseAddress =3D BaseAddress; - Hob->Length =3D Length; + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); } =20 - /** Builds a EFI_HOB_TYPE_FV2 HOB. =20 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 ASSERT(). =20 @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 FvName The name of the Firmware Volume. @param FileName The name of the file. =20 **/ @@ -434,21 +420,78 @@ BuildFv2Hob ( IN CONST EFI_GUID *FileName ) { - EFI_HOB_FIRMWARE_VOLUME2 *Hob; + 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. =20 - Hob =3D CreateHob (EFI_HOB_TYPE_FV2, sizeof (EFI_HOB_FIRMWARE_VOLUME2)); + If there is no additional space for HOB creation, then ASSERT(). + If the FvImage buffer is not at its required alignment, then ASSERT(). =20 - Hob->BaseAddress =3D BaseAddress; - Hob->Length =3D Length; - CopyGuid (&Hob->FvName, FvName); - CopyGuid (&Hob->FileName, FileName); + @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 wit= hin + 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); } =20 +/** + Builds a Capsule Volume HOB. + + This function builds a Capsule 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 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 + ) +{ + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} =20 /** Builds a HOB for the CPU. =20 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(). =20 @param SizeOfMemorySpace The maximum physical memory addressability o= f the processor. @@ -462,122 +505,9 @@ BuildCpuHob ( IN UINT8 SizeOfIoSpace ) { - EFI_HOB_CPU *Hob; - - Hob =3D CreateHob (EFI_HOB_TYPE_CPU, sizeof (EFI_HOB_CPU)); - - Hob->SizeOfMemorySpace =3D SizeOfMemorySpace; - Hob->SizeOfIoSpace =3D SizeOfIoSpace; - // - // Zero the reserved space to match HOB spec + // PEI HOB is read only for MM phase // - ZeroMem (Hob->Reserved, sizeof (Hob->Reserved)); -} - -/** - Builds a HOB for the memory allocation. - - This function builds a HOB for the memory allocation. - 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 - ) -{ - EFI_HOB_MEMORY_ALLOCATION *Hob; - - ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) =3D=3D 0) && - ((Length & (EFI_PAGE_SIZE - 1)) =3D=3D 0)); - - Hob =3D CreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, sizeof (EFI_HOB_MEMOR= Y_ALLOCATION)); - - ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID)); - Hob->AllocDescriptor.MemoryBaseAddress =3D BaseAddress; - Hob->AllocDescriptor.MemoryLength =3D Length; - Hob->AllocDescriptor.MemoryType =3D MemoryType; - // - // Zero the reserved space to match HOB spec - // - ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Res= erved)); -} - -/** - 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 descri= bed by this HOB. - @param PhysicalStart The 64 bit physical address of memory descri= bed by this HOB. - @param NumberOfBytes The length of the memory described by this H= OB 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); } =20 @@ -585,6 +515,9 @@ BuildBspStoreHob ( Builds a HOB for the Stack. =20 This function builds a HOB for the stack. + 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(). =20 @param BaseAddress The 64 bit physical address of the Stack. @@ -598,5 +531,64 @@ BuildStackHob ( IN UINT64 Length ) { + // + // PEI HOB is read only for MM phase + // + ASSERT (FALSE); +} + +/** + Builds a HOB for the BSP store. + + This function builds a HOB for BSP store. + 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 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 + ) +{ + // + // 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 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/StandaloneMmCor= eHobLib.inf b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCo= reHobLib.inf index 0046cd804def..e43a1e63bf14 100644 --- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib= .inf +++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib= .inf @@ -22,16 +22,18 @@ [Defines] LIBRARY_CLASS =3D HobLib|MM_CORE_STANDALONE =20 # -# VALID_ARCHITECTURES =3D AARCH64 +# VALID_ARCHITECTURES =3D X64 AARCH64 # -[Sources.Common] - StandaloneMmCoreHobLib.c +[Sources.X64] + X64/StandaloneMmCoreHobLib.c =20 [Sources.AARCH64] + AArch64/StandaloneMmCoreHobLib.c AArch64/StandaloneMmCoreHobLibInternal.c =20 [Packages] MdePkg/MdePkg.dec + StandaloneMmPkg/StandaloneMmPkg.dec =20 =20 [LibraryClasses] --=20 2.28.0.windows.1