summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhaval <dhaval@rivosinc.com>2023-09-28 11:37:12 +0530
committerLiming Gao <gaoliming@byosoft.com.cn>2024-04-11 16:04:45 +0800
commit98f150a954b35cc74bd87ae355cf35d8c9e1580d (patch)
tree05aacaedb69c46eab895b21545dc6c6887775383
parent963671d3801a6992d1aa06f05d86e32efa6b205e (diff)
downloadedk2-98f150a954b35cc74bd87ae355cf35d8c9e1580d.tar.gz
edk2-98f150a954b35cc74bd87ae355cf35d8c9e1580d.tar.bz2
edk2-98f150a954b35cc74bd87ae355cf35d8c9e1580d.zip
MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tables
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 <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Pedro Falcato <pedro.falcato@gmail.com> Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com> Acked-by: Chasel Chiu <chasel.chiu@...> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
-rw-r--r--MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
index 080768033c..5f8d20a7e9 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c
@@ -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;
}
}
}