git: 5fa51c3653b1 - stable/14 - ACPI: Add ACPI_Q_AEI_NOPULL quirk and use in EC2

From: Colin Percival <cperciva_at_FreeBSD.org>
Date: Sun, 03 Nov 2024 16:02:24 UTC
The branch stable/14 has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=5fa51c3653b14b364e26a4cce2733c7be6ee7721

commit 5fa51c3653b14b364e26a4cce2733c7be6ee7721
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2024-10-22 14:47:30 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2024-11-03 16:01:27 +0000

    ACPI: Add ACPI_Q_AEI_NOPULL quirk and use in EC2
    
    AWS Graviton [1234] systems have a bug in their ACPI where they mark
    the PL061's GPIO pins as needing to be configured in PullUp mode (in
    fact the PL061 has no pullup/pulldown resistors); this flag needs to
    be removed in order for _AEI objects to be handled on these systems.
    
    Reviewed by:    Ali Saidi
    MFC after:      1 week
    Sponsored by:   Amazon
    Differential Revision:  https://reviews.freebsd.org/D47239
    
    (cherry picked from commit 2f3f867ac6dd7ff3769366b828b79c44b38828e1)
---
 release/tools/ec2.conf   | 5 +++++
 sys/dev/acpica/acpivar.h | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf
index 522aaa400520..963c6ff4957b 100644
--- a/release/tools/ec2.conf
+++ b/release/tools/ec2.conf
@@ -63,6 +63,11 @@ ec2_common() {
 	# nodes, but apply the workaround just in case.
 	echo 'hw.broken_txfifo="1"' >> ${DESTDIR}/boot/loader.conf
 
+	# Graviton 1 through Graviton 4 have a bug in their ACPI where they
+	# mark the PL061's pins as needing to be configured in PullUp mode
+	# (in fact the PL061 has no pullup/pulldown resistors).
+	echo 'debug.acpi.quirks="8"' >> ${DESTDIR}/boot/loader.conf
+
 	# Load the kernel module for the Amazon "Elastic Network Adapter"
 	echo 'if_ena_load="YES"' >> ${DESTDIR}/boot/loader.conf
 
diff --git a/sys/dev/acpica/acpivar.h b/sys/dev/acpica/acpivar.h
index afb0a6909e1a..eb6022cde159 100644
--- a/sys/dev/acpica/acpivar.h
+++ b/sys/dev/acpica/acpivar.h
@@ -224,12 +224,15 @@ extern struct mtx			acpi_mutex;
  * ACPI_Q_MADT_IRQ0: Specifies that ISA IRQ 0 is wired up to pin 0 of the
  *	first APIC and that the MADT should force that by ignoring the PC-AT
  *	compatible flag and ignoring overrides that redirect IRQ 0 to pin 2.
+ * ACPI_Q_AEI_NOPULL: Specifies that _AEI objects incorrectly designate pins
+ *	as "PullUp" and they should be treated as "NoPull" instead.
  */
 extern int	acpi_quirks;
 #define ACPI_Q_OK		0
 #define ACPI_Q_BROKEN		(1 << 0)
 #define ACPI_Q_TIMER		(1 << 1)
 #define ACPI_Q_MADT_IRQ0	(1 << 2)
+#define ACPI_Q_AEI_NOPULL	(1 << 3)
 
 #if defined(__amd64__) || defined(__i386__)
 /*