Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci wpi(4): use MSI if available.



details:   https://anonhg.NetBSD.org/src/rev/4054d50e808d
branches:  trunk
changeset: 821345:4054d50e808d
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Thu Feb 02 03:41:22 2017 +0000

description:
wpi(4): use MSI if available.

diffstat:

 sys/dev/pci/if_wpi.c    |  17 +++++++++++------
 sys/dev/pci/if_wpivar.h |   3 ++-
 2 files changed, 13 insertions(+), 7 deletions(-)

diffs (73 lines):

diff -r c073a00f2669 -r 4054d50e808d sys/dev/pci/if_wpi.c
--- a/sys/dev/pci/if_wpi.c      Thu Feb 02 03:20:19 2017 +0000
+++ b/sys/dev/pci/if_wpi.c      Thu Feb 02 03:41:22 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wpi.c,v 1.75 2016/12/08 01:12:01 ozaki-r Exp $      */
+/*     $NetBSD: if_wpi.c,v 1.76 2017/02/02 03:41:22 jakllsch Exp $     */
 
 /*-
  * Copyright (c) 2006, 2007
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.75 2016/12/08 01:12:01 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wpi.c,v 1.76 2017/02/02 03:41:22 jakllsch Exp $");
 
 /*
  * Driver for Intel PRO/Wireless 3945ABG 802.11 network adapters.
@@ -206,7 +206,6 @@
        const char *intrstr;
        bus_space_tag_t memt;
        bus_space_handle_t memh;
-       pci_intr_handle_t ih;
        pcireg_t data;
        int ac, error;
        char intrbuf[PCI_INTRSTR_LEN];
@@ -256,13 +255,15 @@
        sc->sc_sh = memh;
        sc->sc_dmat = pa->pa_dmat;
 
-       if (pci_intr_map(pa, &ih) != 0) {
+       if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) {
                aprint_error_dev(self, "could not map interrupt\n");
                return;
        }
 
-       intrstr = pci_intr_string(sc->sc_pct, ih, intrbuf, sizeof(intrbuf));
-       sc->sc_ih = pci_intr_establish(sc->sc_pct, ih, IPL_NET, wpi_intr, sc);
+       intrstr = pci_intr_string(sc->sc_pct, sc->sc_pihp[0], intrbuf,
+           sizeof(intrbuf));
+       sc->sc_ih = pci_intr_establish(sc->sc_pct, sc->sc_pihp[0], IPL_NET,
+           wpi_intr, sc);
        if (sc->sc_ih == NULL) {
                aprint_error_dev(self, "could not establish interrupt");
                if (intrstr != NULL)
@@ -432,6 +433,10 @@
                pci_intr_disestablish(sc->sc_pct, sc->sc_ih);
                sc->sc_ih = NULL;
        }
+       if (sc->sc_pihp != NULL) {
+               pci_intr_release(sc->sc_pct, sc->sc_pihp, 1);
+               sc->sc_pihp = NULL;
+       }
        mutex_enter(&sc->sc_rsw_mtx);
        sc->sc_dying = 1;
        cv_signal(&sc->sc_rsw_cv);
diff -r c073a00f2669 -r 4054d50e808d sys/dev/pci/if_wpivar.h
--- a/sys/dev/pci/if_wpivar.h   Thu Feb 02 03:20:19 2017 +0000
+++ b/sys/dev/pci/if_wpivar.h   Thu Feb 02 03:41:22 2017 +0000
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_wpivar.h,v 1.19 2015/01/06 15:39:54 bouyer Exp $    */
+/*  $NetBSD: if_wpivar.h,v 1.20 2017/02/02 03:41:22 jakllsch Exp $    */
 
 /*-
  * Copyright (c) 2006
@@ -150,6 +150,7 @@
        bus_space_tag_t         sc_st;
        bus_space_handle_t      sc_sh;
        void                    *sc_ih;
+       pci_intr_handle_t       *sc_pihp;
        pci_chipset_tag_t       sc_pct;
        pcitag_t                sc_pcitag;
        bus_size_t              sc_sz;



Home | Main Index | Thread Index | Old Index