From 694cc9f1004be90e85dd003711b4724a04e8e697 Mon Sep 17 00:00:00 2001 From: Ajan Zhong Date: Tue, 19 Nov 2024 21:45:41 +0800 Subject: [PATCH] UefiPayloadPkg: Update ReadUnaligned64 in ACPI parsing According to ACPI Specification, 64 bit physical address of the XSDT provides indentical functionality to the RSDT but accommodates physical address of description headers that are larger than 32 bits. In this case physical address of XSDT table is 64 bit aligned, however size of ACPI description tabled header is not 64 bit aligned. It leads to the entry of other description headers are not 64 bit aligned. In AARCH64 architecture, deference non-aligned 64 bit address to fetch 64-bit data will trigger Alignment fault. Use ReadUnaligned64 method to fix this unaligned data access issue. Signed-off-by: Ajan Zhong --- UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c index a7ee00f3e9..b50f460bb3 100644 --- a/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c +++ b/UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c @@ -77,7 +77,7 @@ ParseAcpiInfo ( Entry64 = (UINT64 *)(Xsdt + 1); Entry64Num = (Xsdt->Length - sizeof (EFI_ACPI_DESCRIPTION_HEADER)) >> 3; for (Idx = 0; Idx < Entry64Num; Idx++) { - Signature = (UINT32 *)(UINTN)Entry64[Idx]; + Signature = (UINT32 *)(UINTN)ReadUnaligned64 (&Entry64[Idx]); if (*Signature == EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { Fadt = (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature; DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n"));