[PATCH] Updated quirk-driven R3000Z patches

John Baldwin jhb at FreeBSD.org
Mon Feb 14 14:21:06 PST 2005


I've tweaked Jung-uk Kim's patches to be driven by a single ACPI quirk rather
than multiple hints.  I've included the patch below.  If the quirk is not
automatically detected on your laptop, you can manually set it from the loader
via 'set debug.acpi.quirks=4'.  If you have to manually set the quirk to get
it to work, please let me know and include the FADT header from your acpidump
in your reply, thanks.

--- //depot/vendor/freebsd/src/sys/amd64/acpica/madt.c	2004/06/10 21:30:51
+++ //depot/user/jhb/acpipci/amd64/acpica/madt.c	2005/02/14 22:18:55
@@ -367,7 +367,7 @@
 	}
 		    
 	/* First, we run through adding I/O APIC's. */
-	if (madt->PCATCompat)
+	if (madt->PCATCompat && !(acpi_quirks & ACPI_Q_MADT_IRQ0))
 		ioapic_enable_mixed_mode();
 	madt_walk_table(madt_parse_apics, NULL);
 
@@ -596,8 +596,14 @@
 	enum intr_polarity pol;
 	char buf[64];
 
+	if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->Source == 0 &&
+	    intr->Interrupt == 2) {
+		if (bootverbose)
+			printf("MADT: Skipping timer override\n");
+		return;
+	}
 	if (bootverbose)
-		printf("MADT: intr override: source %u, irq %u\n",
+		printf("MADT: Interrupt override: source %u, irq %u\n",
 		    intr->Source, intr->Interrupt);
 	KASSERT(intr->Bus == 0, ("bus for interrupt overrides must be zero"));
 	if (madt_find_interrupt(intr->Interrupt, &new_ioapic,
--- //depot/vendor/freebsd/src/sys/dev/acpica/acpi_quirks	2004/10/08 18:00:57
+++ //depot/user/jhb/acpipci/dev/acpica/acpi_quirks	2005/02/14 21:45:45
@@ -101,6 +101,13 @@
 oem_rev:	FADT <= 0x06040000
 quirks:		ACPI_Q_BROKEN
 
+# Compaq R3000Z
+name:		Compaq_R3000Z
+oem:		FADT "NVIDIA" "CK8     "
+oem_rev:	FADT = 0x6040000
+creator:	FADT "PTL_"
+quirks:		ACPI_Q_MADT_IRQ0
+
 # Compaq Thunder 05/18/99
 # XXX Note creator rev should be "=", I think
 name:		Compaq_Thunder
--- //depot/vendor/freebsd/src/sys/dev/acpica/acpi_resource.c	2005/01/18 20:25:37
+++ //depot/user/jhb/acpipci/dev/acpica/acpi_resource.c	2005/01/18 23:04:51
@@ -77,6 +77,12 @@
 	    req->counter++;
 	    break;
 	}
+	if (irq != rman_get_start(req->res) && irq == 0) {
+		if (bootverbose)
+			printf("IRQ is %u, resource is %lu\n", irq,
+			    rman_get_start(req->res));
+		return (AE_CTRL_TERMINATE);
+	}
 	req->found = 1;
 	KASSERT(irq == rman_get_start(req->res),
 	    ("IRQ resources do not match"));
--- //depot/vendor/freebsd/src/sys/dev/acpica/acpivar.h	2004/12/13 23:35:37
+++ //depot/user/jhb/acpipci/dev/acpica/acpivar.h	2005/02/11 19:51:51
@@ -160,11 +160,20 @@
 #define	ACPI_INTR_APIC		1
 #define	ACPI_INTR_SAPIC		2
 
-/* Quirk flags. */
+/*
+ * Quirk flags.
+ *
+ * ACPI_Q_BROKEN: Disables all ACPI support.
+ * ACPI_Q_TIMER: Disables support for the ACPI timer.
+ * 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.
+ */
 extern int	acpi_quirks;
 #define ACPI_Q_OK		0
-#define ACPI_Q_BROKEN		(1 << 0)	/* Disable ACPI completely. */
-#define ACPI_Q_TIMER		(1 << 1)	/* Disable ACPI timer. */
+#define ACPI_Q_BROKEN		(1 << 0)
+#define ACPI_Q_TIMER		(1 << 1)
+#define ACPI_Q_MADT_IRQ0	(1 << 2)
 
 /*
  * Note that the low ivar values are reserved to provide
--- //depot/vendor/freebsd/src/sys/i386/acpica/madt.c	2004/06/10 20:05:33
+++ //depot/user/jhb/acpipci/i386/acpica/madt.c	2005/02/14 22:18:55
@@ -367,7 +367,7 @@
 	}
 		    
 	/* First, we run through adding I/O APIC's. */
-	if (madt->PCATCompat)
+	if (madt->PCATCompat && !(acpi_quirks & ACPI_Q_MADT_IRQ0))
 		ioapic_enable_mixed_mode();
 	madt_walk_table(madt_parse_apics, NULL);
 
@@ -595,8 +595,14 @@
 	enum intr_polarity pol;
 	char buf[64];
 
+	if (acpi_quirks & ACPI_Q_MADT_IRQ0 && intr->Source == 0 &&
+	    intr->Interrupt == 2) {
+		if (bootverbose)
+			printf("MADT: Skipping timer override\n");
+		return;
+	}
 	if (bootverbose)
-		printf("MADT: intr override: source %u, irq %u\n",
+		printf("MADT: Interrupt override: source %u, irq %u\n",
 		    intr->Source, intr->Interrupt);
 	KASSERT(intr->Bus == 0, ("bus for interrupt overrides must be zero"));
 	if (madt_find_interrupt(intr->Interrupt, &new_ioapic,
--- //depot/vendor/freebsd/src/sys/i386/i386/io_apic.c	2005/01/18 20:30:33
+++ //depot/user/jhb/acpipci/i386/i386/io_apic.c	2005/02/08 19:07:03
@@ -547,10 +547,11 @@
 
 		/*
 		 * Assume that pin 0 on the first I/O APIC is an ExtINT pin
-		 * and that pins 1-15 are ISA interrupts.  Assume that all
+		 * if mixed mode is enabled and an ISA interrupt if not.
+		 * Assume that pins 1-15 are ISA interrupts and that all
 		 * other pins are PCI interrupts.
 		 */
-		if (intpin->io_vector == 0)
+		if (intpin->io_vector == 0 && mixed_mode_enabled)
 			ioapic_set_extint(io, i);
 		else if (intpin->io_vector < IOAPIC_ISA_INTS) {
 			intpin->io_bus = APIC_BUS_ISA;


-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-amd64 mailing list