summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjan Zhong <ajan.zhong@newfw.com>2024-12-24 15:58:27 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-12-25 04:11:32 +0000
commitf39b1210660bd8b9a0ec5c6e415673c2ca6dbafd (patch)
treea2b676b568dec6ca6358de6906ac975945192832
parentda6504e5ccaa233b0ec051762809905f20ca5859 (diff)
downloadedk2-f39b1210660bd8b9a0ec5c6e415673c2ca6dbafd.tar.gz
UefiPayloadPkg: Align base address for ACPI region
In platform which support ACPI 2.0 only, the base address of ACPI region is not page aligned. This unalinged base address leads to failure at BuildMemoryAllocationHob when parsing ACPI node in FdtParserLib, before building gUniversalPayloadAcpiTableGuid GUID HOB. Align base address of ACPI region down to EFI_PAGE_SIZE to make sure base address always aligned. Signed-off-by: Ajan Zhong <ajan.zhong@newfw.com>
-rw-r--r--UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
index 372ca07765..05780a2c19 100644
--- a/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
+++ b/UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
@@ -60,6 +60,8 @@ typedef enum {
EFI_PCI_IO_ATTRIBUTE_ISA_IO | \
EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO)
+#define UPL_ALIGN_DOWN(Addr) ((UINT64)(Addr) & ~(UINT64)(EFI_PAGE_SIZE - 1))
+
extern VOID *mHobList;
UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *mPciRootBridgeInfo = NULL;
INT32 mNode[0x500] = { 0 };
@@ -289,7 +291,12 @@ ParseReservedMemory (
BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiACPIMemoryNVS);
} else if (AsciiStrnCmp (TempStr, "acpi", AsciiStrLen ("acpi")) == 0) {
DEBUG ((DEBUG_INFO, " acpi, StartAddress:%x, NumberOfBytes:%x\n", StartAddress, NumberOfBytes));
- BuildMemoryAllocationHob (StartAddress, NumberOfBytes, EfiBootServicesData);
+
+ BuildMemoryAllocationHob (
+ UPL_ALIGN_DOWN (StartAddress),
+ ALIGN_VALUE (NumberOfBytes, EFI_PAGE_SIZE),
+ EfiBootServicesData
+ );
PlatformAcpiTable = BuildGuidHob (&gUniversalPayloadAcpiTableGuid, sizeof (UNIVERSAL_PAYLOAD_ACPI_TABLE));
if (PlatformAcpiTable != NULL) {
DEBUG ((DEBUG_INFO, " build gUniversalPayloadAcpiTableGuid , NumberOfBytes:%x\n", NumberOfBytes));