git: 01593a0ff9f1 - main - Only change the fadt revision in acpidump on i386

From: Andrew Turner <andrew_at_FreeBSD.org>
Date: Thu, 21 Oct 2021 11:24:12 UTC
The branch main has been updated by andrew:

URL: https://cgit.FreeBSD.org/src/commit/?id=01593a0ff9f16e2cb23ab2ebc4ca3b8bd2434425

commit 01593a0ff9f16e2cb23ab2ebc4ca3b8bd2434425
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-10-20 09:19:55 +0000
Commit:     Andrew Turner <andrew@FreeBSD.org>
CommitDate: 2021-10-21 11:20:32 +0000

    Only change the fadt revision in acpidump on i386
    
    There is a workaround in acpidump for an old IBM laptop. This is being
    hit on a modern arm64 system causing acpidump to use the wrong field
    when reading a later address.
    
    As the laptop has a 32-bit CPU the only FreeBSD support for it is i386.
    As such limit the workaround to that architecture.
    
    Reviewed by:    emaste, jkim, jhb (all earlier version)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision: https://reviews.freebsd.org/D32573
---
 usr.sbin/acpi/acpidump/acpi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/usr.sbin/acpi/acpidump/acpi.c b/usr.sbin/acpi/acpidump/acpi.c
index adb5b968f441..0e91a85f6a90 100644
--- a/usr.sbin/acpi/acpidump/acpi.c
+++ b/usr.sbin/acpi/acpidump/acpi.c
@@ -219,16 +219,22 @@ acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt)
 	if (addr_size == 8) {
 		fadt_revision = 2;
 
+#if defined(__i386__)
 		/*
 		 * A few systems (e.g., IBM T23) have an RSDP that claims
 		 * revision 2 but the 64 bit addresses are invalid.  If
 		 * revision 2 and the 32 bit address is non-zero but the
 		 * 32 and 64 bit versions don't match, prefer the 32 bit
 		 * version for all subsequent tables.
+		 *
+		 * The only known ACPI systems this affects are early
+		 * implementations on 32-bit x86. Because of this limit the
+		 * workaround to i386.
 		 */
 		if (fadt->Facs != 0 &&
 		    (fadt->XFacs & 0xffffffff) != fadt->Facs)
 			fadt_revision = 1;
+#endif
 	} else
 		fadt_revision = 1;
 	return (fadt_revision);