summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw@amazon.co.uk>2024-02-13 10:50:19 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-02-25 18:52:27 +0000
commitba96acd963e794e86633ffd5e7f96cbc03db673c (patch)
treec2befd26d05bd7c2890a339bc10edf9420a95a42
parentf881b4d129602a49e3403043fc27550a74453234 (diff)
downloadedk2-ba96acd963e794e86633ffd5e7f96cbc03db673c.tar.gz
edk2-ba96acd963e794e86633ffd5e7f96cbc03db673c.tar.bz2
edk2-ba96acd963e794e86633ffd5e7f96cbc03db673c.zip
ArmVirtPkg/XenAcpiPlatformDxe: Install FACS table from DT
The FACS may still exist when the reduced hardware flag is set in FADT; it is optional. Since it contains the hardware signature field which indicates that a hibernated system should boot cleanly instead of attempting to resume, a platform may choose to expose it. Propagate it correctly. Also avoid a NULL pointer dereference if the platform doesn't provide a DSDT. Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <881dd0a2558ecbdfa02c844722d8a1103ab97ab3.camel@infradead.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> [lersek@redhat.com: uncrustify]
-rw-r--r--ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c37
1 files changed, 29 insertions, 8 deletions
diff --git a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c
index 32c8b1e94e..0914546d86 100644
--- a/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c
+++ b/ArmVirtPkg/XenAcpiPlatformDxe/XenAcpiPlatformDxe.c
@@ -128,10 +128,12 @@ InstallXenArmTables (
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *FadtTable;
EFI_ACPI_DESCRIPTION_HEADER *DsdtTable;
+ EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *FacsTable;
XenAcpiRsdpStructurePtr = NULL;
FadtTable = NULL;
DsdtTable = NULL;
+ FacsTable = NULL;
TableHandle = 0;
NumberOfTableEntries = 0;
@@ -191,6 +193,8 @@ InstallXenArmTables (
FadtTable = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)
(UINTN)CurrentTablePointer;
DsdtTable = (EFI_ACPI_DESCRIPTION_HEADER *)(UINTN)FadtTable->Dsdt;
+ FacsTable = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)
+ (UINTN)FadtTable->FirmwareCtrl;
}
}
}
@@ -198,14 +202,31 @@ InstallXenArmTables (
//
// Install DSDT table.
//
- Status = AcpiProtocol->InstallAcpiTable (
- AcpiProtocol,
- DsdtTable,
- DsdtTable->Length,
- &TableHandle
- );
- if (EFI_ERROR (Status)) {
- return Status;
+ if (DsdtTable != NULL) {
+ Status = AcpiProtocol->InstallAcpiTable (
+ AcpiProtocol,
+ DsdtTable,
+ DsdtTable->Length,
+ &TableHandle
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+ }
+
+ //
+ // Install FACS table.
+ //
+ if (FacsTable != NULL) {
+ Status = AcpiProtocol->InstallAcpiTable (
+ AcpiProtocol,
+ FacsTable,
+ FacsTable->Length,
+ &TableHandle
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
}
return EFI_SUCCESS;