[PATCH v3 4/4] acpi: support 64bit in acpi_find_table for DSDT and FACS

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Sat Dec 16 09:12:00 CET 2023


Use X_DSDT and X_FIRMWARE_CTRL if available.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 lib/acpi/acpi.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/lib/acpi/acpi.c b/lib/acpi/acpi.c
index f21e509461..f80b2176e1 100644
--- a/lib/acpi/acpi.c
+++ b/lib/acpi/acpi.c
@@ -45,11 +45,30 @@ struct acpi_table_header *acpi_find_table(const char *sig)
 		if (!memcmp(hdr->signature, "FACP", ACPI_NAME_LEN)) {
 			struct acpi_fadt *fadt = (struct acpi_fadt *)hdr;
 
-			if (!memcmp(sig, "DSDT", ACPI_NAME_LEN) && fadt->dsdt)
-				return map_sysmem(fadt->dsdt, 0);
-			if (!memcmp(sig, "FACS", ACPI_NAME_LEN) &&
-			    fadt->firmware_ctrl)
-				return map_sysmem(fadt->firmware_ctrl, 0);
+			if (!memcmp(sig, "DSDT", ACPI_NAME_LEN)) {
+				void *dsdt;
+
+				if (fadt->header.revision >= 3 && fadt->x_dsdt)
+					dsdt = map_sysmem(fadt->x_dsdt, 0);
+				else if (fadt->dsdt)
+					dsdt = map_sysmem(fadt->dsdt, 0);
+				else
+					dsdt = NULL;
+				return dsdt;
+			}
+
+			if (!memcmp(sig, "FACS", ACPI_NAME_LEN)) {
+				void *facs;
+
+				if (fadt->header.revision >= 3 &&
+				    fadt->x_firmware_ctrl)
+					facs = map_sysmem(fadt->x_firmware_ctrl, 0);
+				else if (fadt->firmware_ctrl)
+					facs = map_sysmem(fadt->firmware_ctrl, 0);
+				else
+					facs = NULL;
+				return facs;
+			}
 		}
 	}
 
-- 
2.40.1



More information about the U-Boot mailing list