]> xenbits.xensource.com Git - people/aperard/ovmf.git/commitdiff
UefiPayloadPkg: Add support for Special Purpose memory
authorDhaval <dhaval@rivosinc.com>
Thu, 29 Aug 2024 05:06:59 +0000 (10:36 +0530)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sat, 14 Sep 2024 03:38:47 +0000 (03:38 +0000)
We need to let UEFI know that there are cetain memory types
which are special purpose (CXL/HBM) etc and we may want to
avoid using them for UEFI purposes. Hence UPL needs to know
about such memory types.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c

index 4684f11497df56c7cf59347f2f2bcba531218fa4..24dd0be9ab9410c661e2a5776f663ae0f22605de 100644 (file)
@@ -236,6 +236,7 @@ ParseReservedMemory (
   UNIVERSAL_PAYLOAD_ACPI_TABLE    *PlatformAcpiTable;\r
   UNIVERSAL_PAYLOAD_SMBIOS_TABLE  *SmbiosTable;\r
   FDT_NODE_HEADER                 *NodePtr;\r
+  UINT32                          Attribute;\r
 \r
   PlatformAcpiTable = NULL;\r
 \r
@@ -273,6 +274,10 @@ ParseReservedMemory (
       } else if (AsciiStrnCmp (TempStr, "runtime-data", AsciiStrLen ("runtime-data")) == 0) {\r
         DEBUG ((DEBUG_INFO, "  runtime-data"));\r
         BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiRuntimeServicesData);\r
+      } else if (AsciiStrnCmp (TempStr, "special-purpose", AsciiStrLen ("special-purpose")) == 0) {\r
+        Attribute = MEMORY_ATTRIBUTE_DEFAULT | EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE;\r
+        DEBUG ((DEBUG_INFO, "  special-purpose memory"));\r
+        BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, Attribute, StartAddress, NumberOfBytes);\r
       } else if (AsciiStrnCmp (TempStr, "acpi", AsciiStrLen ("acpi")) == 0) {\r
         DEBUG ((DEBUG_INFO, "  acpi, StartAddress:%x, NumberOfBytes:%x", StartAddress, NumberOfBytes));\r
         BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiBootServicesData);\r