Module Name:    src
Committed By:   jmcneill
Date:           Thu Nov 22 15:06:00 UTC 2018

Modified Files:
        src/sys/arch/x86/acpi: acpi_machdep.c

Log Message:
Apply MADT interrupt source overrides to interrupts established via
acpi_md_intr_establish.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/x86/acpi/acpi_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/acpi/acpi_machdep.c
diff -u src/sys/arch/x86/acpi/acpi_machdep.c:1.20 src/sys/arch/x86/acpi/acpi_machdep.c:1.21
--- src/sys/arch/x86/acpi/acpi_machdep.c:1.20	Fri Nov 16 23:03:55 2018
+++ src/sys/arch/x86/acpi/acpi_machdep.c	Thu Nov 22 15:06:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_machdep.c,v 1.20 2018/11/16 23:03:55 jmcneill Exp $ */
+/* $NetBSD: acpi_machdep.c,v 1.21 2018/11/22 15:06:00 jmcneill Exp $ */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.20 2018/11/16 23:03:55 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_machdep.c,v 1.21 2018/11/22 15:06:00 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -151,19 +151,40 @@ acpi_md_OsInstallInterruptHandler(uint32
     const char *xname)
 {
 	void *ih;
+
+	ih = acpi_md_intr_establish(InterruptNumber, IPL_TTY, IST_LEVEL,
+	    (int (*)(void *))ServiceRoutine, Context, false, xname);
+	if (ih == NULL)
+		return AE_NO_MEMORY;
+
+	*cookiep = ih;
+
+	return AE_OK;
+}
+
+void
+acpi_md_OsRemoveInterruptHandler(void *cookie)
+{
+	intr_disestablish(cookie);
+}
+
+void *
+acpi_md_intr_establish(uint32_t InterruptNumber, int ipl, int type,
+    int (*handler)(void *), void *arg, bool mpsafe, const char *xname)
+{
+	void *ih;
 	struct pic *pic;
 #if NIOAPIC > 0
 	struct ioapic_softc *sc;
 	struct acpi_md_override ovr;
 	struct mp_intr_map tmpmap, *mip, **mipp = NULL;
 #endif
-	int irq, pin, type, redir, mpflags;
+	int irq, pin, redir, mpflags;
 
 	/*
 	 * ACPI interrupts default to level-triggered active-low.
 	 */
 
-	type = IST_LEVEL;
 	mpflags = (MPS_INTTR_LEVEL << 2) | MPS_INTPO_ACTLO;
 	redir = IOAPIC_REDLO_LEVEL | IOAPIC_REDLO_ACTLO;
 
@@ -239,11 +260,8 @@ acpi_md_OsInstallInterruptHandler(uint32
 		irq = pin = (int)InterruptNumber;
 	}
 
-	/*
-	 * XXX probably, IPL_BIO is enough.
-	 */
-	ih = intr_establish_xname(irq, pic, pin, type, IPL_TTY,
-	    (int (*)(void *)) ServiceRoutine, Context, false, xname);
+	ih = intr_establish_xname(irq, pic, pin, type, ipl,
+	    handler, arg, mpsafe, xname);
 
 #if NIOAPIC > 0
 	if (mipp) {
@@ -251,33 +269,7 @@ acpi_md_OsInstallInterruptHandler(uint32
 	}
 #endif
 
-	if (ih == NULL)
-		return AE_NO_MEMORY;
-
-	*cookiep = ih;
-
-	return AE_OK;
-}
-
-void
-acpi_md_OsRemoveInterruptHandler(void *cookie)
-{
-	intr_disestablish(cookie);
-}
-
-void *
-acpi_md_intr_establish(uint32_t irq, int ipl, int type, int (*handler)(void *),
-    void *arg, bool mpsafe, const char *xname)
-{
-	struct pic *pic;
-	int pin;
-
-	pic = intr_findpic(irq);
-	if (pic == NULL)
-		return NULL;
-	pin = irq - pic->pic_vecbase;
-
-	return intr_establish_xname(irq, pic, pin, type, ipl, handler, arg, mpsafe, xname);
+	return ih;
 }
 
 void

Reply via email to