From c511663cfad216b4ec6a08be3c451784b0cb3ac5 Mon Sep 17 00:00:00 2001 From: Dhaval Date: Thu, 29 Aug 2024 10:36:59 +0530 Subject: [PATCH] UefiPayloadPkg: Add support for Special Purpose memory 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 --- UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c index 4684f11497..24dd0be9ab 100644 --- a/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c +++ b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c @@ -236,6 +236,7 @@ ParseReservedMemory ( UNIVERSAL_PAYLOAD_ACPI_TABLE *PlatformAcpiTable; UNIVERSAL_PAYLOAD_SMBIOS_TABLE *SmbiosTable; FDT_NODE_HEADER *NodePtr; + UINT32 Attribute; PlatformAcpiTable = NULL; @@ -273,6 +274,10 @@ ParseReservedMemory ( } else if (AsciiStrnCmp (TempStr, "runtime-data", AsciiStrLen ("runtime-data")) == 0) { DEBUG ((DEBUG_INFO, " runtime-data")); BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiRuntimeServicesData); + } else if (AsciiStrnCmp (TempStr, "special-purpose", AsciiStrLen ("special-purpose")) == 0) { + Attribute = MEMORY_ATTRIBUTE_DEFAULT | EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE; + DEBUG ((DEBUG_INFO, " special-purpose memory")); + BuildResourceDescriptorHob (EFI_RESOURCE_SYSTEM_MEMORY, Attribute, StartAddress, NumberOfBytes); } else if (AsciiStrnCmp (TempStr, "acpi", AsciiStrLen ("acpi")) == 0) { DEBUG ((DEBUG_INFO, " acpi, StartAddress:%x, NumberOfBytes:%x", StartAddress, NumberOfBytes)); BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiBootServicesData);