Skip to content

Commit

Permalink
MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tables
Browse files Browse the repository at this point in the history
As per ACPI Spec 6.5+ Table 5-9 if xDSDT is available,
it should be used first. Handle required flow when xDSDT
is absent or present.

Test: Tested on RISCV64 Qemu platform with xDSDT and booted to
linux kernel.

Cc: Liming Gao <[email protected]>
Cc: Zhiguang Liu <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Pedro Falcato <[email protected]>
Signed-off-by: Dhaval Sharma <[email protected]>
Acked-by: Chasel Chiu <chasel.chiu@...>
Reviewed-by: Liming Gao <[email protected]>
  • Loading branch information
dhaval-rivos authored and lgao4 committed Apr 11, 2024
1 parent 963671d commit 98f150a
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1906,14 +1906,24 @@ InstallAcpiTableFromHob (
}
}

if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt != 0) {
//
// First check if xDSDT is available, as that is preferred as per
// ACPI Spec 6.5+ Table 5-9 X_DSDT definition
//
if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->XDsdt != 0) {
TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->XDsdt;
} else if (((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt != 0) {
TableToInstall = (VOID *)(UINTN)((EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)ChildTable)->Dsdt;
Status = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI table DSDT\n"));
ASSERT_EFI_ERROR (Status);
break;
}
} else {
DEBUG ((DEBUG_ERROR, "DSDT table not found\n"));
continue;
}

Status = AddTableToList (AcpiTableInstance, TableToInstall, TRUE, Version, TRUE, &TableKey);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "InstallAcpiTableFromHob: Fail to add ACPI table DSDT\n"));
ASSERT_EFI_ERROR (Status);
break;
}
}
}
Expand Down

0 comments on commit 98f150a

Please sign in to comment.