Skip to content

Commit

Permalink
UefiPayloadPkg: Align base address for ACPI region
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
AjanZhong committed Dec 24, 2024
1 parent 1cc7881 commit 59da910
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion UefiPayloadPkg/Library/FdtParserLib/FdtParserLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ typedef enum {
EFI_PCI_IO_ATTRIBUTE_ISA_IO | \
EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO)

#define UPL_ALIGN_DOWN_PAGE_U64(Address) ((UINT64)(Address) & ~(UINT64)(EFI_PAGE_SIZE - 1))

extern VOID *mHobList;
UNIVERSAL_PAYLOAD_PCI_ROOT_BRIDGES *mPciRootBridgeInfo = NULL;
INT32 mNode[0x500] = { 0 };
Expand Down Expand Up @@ -289,7 +291,10 @@ 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_PAGE_U64(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));
Expand Down

0 comments on commit 59da910

Please sign in to comment.