Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci convert to pci_intr_alloc() to possibly allow MS...



details:   https://anonhg.NetBSD.org/src/rev/d613a3639172
branches:  trunk
changeset: 837531:d613a3639172
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Dec 09 19:16:10 2018 +0000

description:
convert to pci_intr_alloc() to possibly allow MSI/MSI-X; has no effect
on my system, where the device only supports INTx

diffstat:

 sys/dev/pci/ichsmb.c |  27 ++++++++++++++++++---------
 1 files changed, 18 insertions(+), 9 deletions(-)

diffs (71 lines):

diff -r f7dd4b9fc133 -r d613a3639172 sys/dev/pci/ichsmb.c
--- a/sys/dev/pci/ichsmb.c      Sun Dec 09 19:03:42 2018 +0000
+++ b/sys/dev/pci/ichsmb.c      Sun Dec 09 19:16:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ichsmb.c,v 1.57 2018/04/09 15:36:00 msaitoh Exp $      */
+/*     $NetBSD: ichsmb.c,v 1.58 2018/12/09 19:16:10 jdolecek Exp $     */
 /*     $OpenBSD: ichiic.c,v 1.18 2007/05/03 09:36:26 dlg Exp $ */
 
 /*
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.57 2018/04/09 15:36:00 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.58 2018/12/09 19:16:10 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -60,6 +60,7 @@
        pci_chipset_tag_t       sc_pc;
        void *                  sc_ih;
        int                     sc_poll;
+       pci_intr_handle_t       *sc_pihp;
 
        struct i2c_controller   sc_i2c_tag;
        kmutex_t                sc_i2c_mutex;
@@ -154,7 +155,6 @@
        struct ichsmb_softc *sc = device_private(self);
        struct pci_attach_args *pa = aux;
        pcireg_t conf;
-       pci_intr_handle_t ih;
        const char *intrstr = NULL;
        char intrbuf[PCI_INTRSTR_LEN];
        int flags;
@@ -187,12 +187,14 @@
                aprint_normal_dev(self, "interrupting at SMI\n");
        } else {
                /* Install interrupt handler */
-               if (pci_intr_map(pa, &ih) == 0) {
-                       intrstr = pci_intr_string(pa->pa_pc, ih, intrbuf,
-                           sizeof(intrbuf));
-                       sc->sc_ih = pci_intr_establish_xname(pa->pa_pc, ih,
-                           IPL_BIO, ichsmb_intr, sc, device_xname(sc->sc_dev));
+               if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0) == 0) {
+                       intrstr = pci_intr_string(pa->pa_pc, sc->sc_pihp[0],
+                           intrbuf, sizeof(intrbuf));
+                       sc->sc_ih = pci_intr_establish_xname(pa->pa_pc,
+                           sc->sc_pihp[0], IPL_BIO, ichsmb_intr, sc,
+                           device_xname(sc->sc_dev));
                        if (sc->sc_ih != NULL) {
+                               pci_intr_release(pa->pa_pc, sc->sc_pihp, 1);
                                aprint_normal_dev(self, "interrupting at %s\n",
                                    intrstr);
                                sc->sc_poll = 0;
@@ -251,8 +253,15 @@
 
        mutex_destroy(&sc->sc_i2c_mutex);
 
-       if (sc->sc_ih)
+       if (sc->sc_ih) {
                pci_intr_disestablish(sc->sc_pc, sc->sc_ih);
+               sc->sc_ih = NULL;
+       }
+
+       if (sc->sc_pihp) {
+               pci_intr_release(sc->sc_pc, sc->sc_pihp, 1);
+               sc->sc_pihp = NULL;
+       }
 
        bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_size);
 



Home | Main Index | Thread Index | Old Index