Source-Changes-HG archive

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

[src/trunk]: src/sys Use acpi_intr_establish



details:   https://anonhg.NetBSD.org/src/rev/e6730560a1eb
branches:  trunk
changeset: 445902:e6730560a1eb
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Fri Nov 16 23:18:00 2018 +0000

description:
Use acpi_intr_establish

diffstat:

 sys/arch/arm/acpi/plcom_acpi.c |   9 +++++----
 sys/dev/acpi/ahcisata_acpi.c   |   9 +++++----
 sys/dev/acpi/dwiic_acpi.c      |   9 +++++----
 sys/dev/acpi/ehci_acpi.c       |  11 ++++++-----
 sys/dev/acpi/virtio_acpi.c     |  12 ++++++++----
 sys/dev/acpi/xhci_acpi.c       |  11 ++++++-----
 6 files changed, 35 insertions(+), 26 deletions(-)

diffs (263 lines):

diff -r ccd2e210a4bf -r e6730560a1eb sys/arch/arm/acpi/plcom_acpi.c
--- a/sys/arch/arm/acpi/plcom_acpi.c    Fri Nov 16 23:05:50 2018 +0000
+++ b/sys/arch/arm/acpi/plcom_acpi.c    Fri Nov 16 23:18:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: plcom_acpi.c,v 1.1 2018/10/12 22:20:04 jmcneill Exp $ */
+/* $NetBSD: plcom_acpi.c,v 1.2 2018/11/16 23:18:00 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: plcom_acpi.c,v 1.1 2018/10/12 22:20:04 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: plcom_acpi.c,v 1.2 2018/11/16 23:18:00 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -40,6 +40,7 @@
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <evbarm/dev/plcomreg.h>
 #include <evbarm/dev/plcomvar.h>
@@ -109,8 +110,8 @@
 
        plcom_attach_subr(sc);
 
-       const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
-       ih = intr_establish(irq->ar_irq, IPL_SERIAL, type | IST_MPSAFE, plcomintr, sc);
+       ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+           IPL_SERIAL, true, plcomintr, sc, device_xname(self));
        if (ih == NULL) {
                aprint_error_dev(self, "couldn't install interrupt handler\n");
                return;
diff -r ccd2e210a4bf -r e6730560a1eb sys/dev/acpi/ahcisata_acpi.c
--- a/sys/dev/acpi/ahcisata_acpi.c      Fri Nov 16 23:05:50 2018 +0000
+++ b/sys/dev/acpi/ahcisata_acpi.c      Fri Nov 16 23:18:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ahcisata_acpi.c,v 1.3 2018/10/15 18:58:35 jdolecek Exp $ */
+/* $NetBSD: ahcisata_acpi.c,v 1.4 2018/11/16 23:18:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_acpi.c,v 1.3 2018/10/15 18:58:35 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_acpi.c,v 1.4 2018/11/16 23:18:17 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -43,6 +43,7 @@
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #include <dev/pci/pcireg.h>
 
@@ -102,8 +103,8 @@
                goto done;
        }
 
-       const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
-       ih = intr_establish(irq->ar_irq, IPL_BIO, type, ahci_intr, sc);
+       ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+           IPL_BIO, false, ahci_intr, sc, device_xname(self));
        if (ih == NULL) {
                aprint_error_dev(self, "couldn't install interrupt handler\n");
                return;
diff -r ccd2e210a4bf -r e6730560a1eb sys/dev/acpi/dwiic_acpi.c
--- a/sys/dev/acpi/dwiic_acpi.c Fri Nov 16 23:05:50 2018 +0000
+++ b/sys/dev/acpi/dwiic_acpi.c Fri Nov 16 23:18:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwiic_acpi.c,v 1.1 2018/10/17 00:03:47 jmcneill Exp $ */
+/* $NetBSD: dwiic_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.1 2018/10/17 00:03:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwiic_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -39,6 +39,7 @@
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 #include <dev/acpi/acpi_i2c.h>
 
 #include <dev/ic/dwiic_var.h>
@@ -113,8 +114,8 @@
                return;
        }
 
-       const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
-       ih = intr_establish(irq->ar_irq, IPL_VM, type, dwiic_intr, sc);
+       ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+           IPL_VM, true, dwiic_intr, sc, device_xname(self));
        if (ih == NULL) {
                aprint_error_dev(self, "couldn't install interrupt handler\n");
                bus_space_unmap(sc->sc_iot, sc->sc_ioh, mem->ar_length);
diff -r ccd2e210a4bf -r e6730560a1eb sys/dev/acpi/ehci_acpi.c
--- a/sys/dev/acpi/ehci_acpi.c  Fri Nov 16 23:05:50 2018 +0000
+++ b/sys/dev/acpi/ehci_acpi.c  Fri Nov 16 23:18:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci_acpi.c,v 1.2 2018/10/26 23:33:38 jmcneill Exp $ */
+/* $NetBSD: ehci_acpi.c,v 1.3 2018/11/16 23:18:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci_acpi.c,v 1.2 2018/10/26 23:33:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci_acpi.c,v 1.3 2018/11/16 23:18:17 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -46,6 +46,7 @@
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 #include <dev/acpi/acpi_usb.h>
 
 static const char * const compatible[] = {
@@ -113,7 +114,7 @@
        }
 
        irq = acpi_res_irq(&res, 0);
-       if (mem == NULL) {
+       if (irq == NULL) {
                aprint_error_dev(self, "couldn't find irq resource\n");
                goto done;
        }
@@ -130,8 +131,8 @@
        sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH);
        EOWRITE4(sc, EHCI_USBINTR, 0);
 
-       const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
-       ih = intr_establish(irq->ar_irq, IPL_USB, type, ehci_intr, sc);
+       ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+           IPL_USB, true, ehci_intr, sc, device_xname(self));
        if (ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt\n");
                return;
diff -r ccd2e210a4bf -r e6730560a1eb sys/dev/acpi/virtio_acpi.c
--- a/sys/dev/acpi/virtio_acpi.c        Fri Nov 16 23:05:50 2018 +0000
+++ b/sys/dev/acpi/virtio_acpi.c        Fri Nov 16 23:18:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: virtio_acpi.c,v 1.1 2018/10/21 12:26:38 jmcneill Exp $ */
+/* $NetBSD: virtio_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: virtio_acpi.c,v 1.1 2018/10/21 12:26:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: virtio_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -39,12 +39,14 @@
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 
 #define        VIRTIO_PRIVATE
 #include <dev/virtio/virtio_mmiovar.h>
 
 struct virtio_acpi_softc {
        struct virtio_mmio_softc        sc_msc;
+       ACPI_HANDLE                     sc_handle;
        int                             sc_irq;
        int                             sc_irqtype;
 };
@@ -90,6 +92,7 @@
        ACPI_STATUS rv;
        int error;
 
+       sc->sc_handle = aa->aa_node->ad_handle;
        msc->sc_iot = aa->aa_memt;
        vsc->sc_dev = self;
        vsc->sc_dmat = aa->aa_dmat;
@@ -164,7 +167,8 @@
        struct virtio_acpi_softc * const sc = (struct virtio_acpi_softc *)msc;
        struct virtio_softc * const vsc = &msc->sc_sc;
 
-       msc->sc_ih = intr_establish(sc->sc_irq, IPL_VM, sc->sc_irqtype, virtio_mmio_intr, msc);
+       msc->sc_ih = acpi_intr_establish(vsc->sc_dev, (uint64_t)sc->sc_handle,
+            IPL_VM, false, virtio_mmio_intr, msc, device_xname(vsc->sc_dev));
        if (msc->sc_ih == NULL) {
                aprint_error_dev(vsc->sc_dev, "couldn't install interrupt handler\n");
                return -1;
@@ -179,7 +183,7 @@
 virtio_acpi_free_interrupts(struct virtio_mmio_softc *msc)
 {
        if (msc->sc_ih != NULL) {
-               intr_disestablish(msc->sc_ih);
+               acpi_intr_disestablish(msc->sc_ih);
                msc->sc_ih = NULL;
        }
 }
diff -r ccd2e210a4bf -r e6730560a1eb sys/dev/acpi/xhci_acpi.c
--- a/sys/dev/acpi/xhci_acpi.c  Fri Nov 16 23:05:50 2018 +0000
+++ b/sys/dev/acpi/xhci_acpi.c  Fri Nov 16 23:18:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xhci_acpi.c,v 1.1 2018/10/26 23:33:38 jmcneill Exp $ */
+/* $NetBSD: xhci_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,v 1.1 2018/10/26 23:33:38 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci_acpi.c,v 1.2 2018/11/16 23:18:17 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -46,6 +46,7 @@
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
+#include <dev/acpi/acpi_intr.h>
 #include <dev/acpi/acpi_usb.h>
 
 static const char * const compatible[] = {
@@ -113,7 +114,7 @@
        }
 
        irq = acpi_res_irq(&res, 0);
-       if (mem == NULL) {
+       if (irq == NULL) {
                aprint_error_dev(self, "couldn't find irq resource\n");
                goto done;
        }
@@ -126,8 +127,8 @@
                return;
        }
 
-       const int type = (irq->ar_type == ACPI_EDGE_SENSITIVE) ? IST_EDGE : IST_LEVEL;
-       ih = intr_establish(irq->ar_irq, IPL_USB, type, xhci_intr, sc);
+        ih = acpi_intr_establish(self, (uint64_t)aa->aa_node->ad_handle,
+           IPL_USB, true, xhci_intr, sc, device_xname(self));
        if (ih == NULL) {
                aprint_error_dev(self, "couldn't establish interrupt\n");
                return;



Home | Main Index | Thread Index | Old Index