Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/acpi Apply MADT interrupt source overrides to i...



details:   https://anonhg.NetBSD.org/src/rev/c170e5ed36fb
branches:  trunk
changeset: 446076:c170e5ed36fb
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Nov 22 15:06:00 2018 +0000

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

diffstat:

 sys/arch/x86/acpi/acpi_machdep.c |  64 +++++++++++++++++----------------------
 1 files changed, 28 insertions(+), 36 deletions(-)

diffs (110 lines):

diff -r 9a5882d1a729 -r c170e5ed36fb sys/arch/x86/acpi/acpi_machdep.c
--- a/sys/arch/x86/acpi/acpi_machdep.c  Thu Nov 22 13:47:37 2018 +0000
+++ b/sys/arch/x86/acpi/acpi_machdep.c  Thu Nov 22 15:06:00 2018 +0000
@@ -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 @@
     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 @@
                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 @@
        }
 #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



Home | Main Index | Thread Index | Old Index