Skip to content

Commit

Permalink
UefiPayloadPkg: Update ReadUnaligned64 in ACPI parsing
Browse files Browse the repository at this point in the history
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 <ajan.zhong@newfw.com>
  • Loading branch information
AjanZhong authored and mergify[bot] committed Dec 9, 2024
1 parent ddb4ea6 commit 694cc9f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion UefiPayloadPkg/UefiPayloadEntry/AcpiTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 694cc9f

Please sign in to comment.