Module Name: src
Committed By: jakllsch
Date: Thu Feb 2 03:41:22 UTC 2017
Modified Files:
src/sys/dev/pci: if_wpi.c if_wpivar.h
Log Message:
wpi(4): use MSI if available.
To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/if_wpi.c
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/pci/if_wpivar.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_wpi.c
diff -u src/sys/dev/pci/if_wpi.c:1.75 src/sys/dev/pci/if_wpi.c:1.76
--- src/sys/dev/pci/if_wpi.c:1.75 Thu Dec 8 01:12:01 2016
+++ src/sys/dev/pci/if_wpi.c Thu Feb 2 03:41:22 2017
@@ -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 @@ wpi_attach(device_t parent __unused, dev
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 @@ wpi_attach(device_t parent __unused, dev
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 @@ wpi_detach(device_t self, int flags __un
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);
Index: src/sys/dev/pci/if_wpivar.h
diff -u src/sys/dev/pci/if_wpivar.h:1.19 src/sys/dev/pci/if_wpivar.h:1.20
--- src/sys/dev/pci/if_wpivar.h:1.19 Tue Jan 6 15:39:54 2015
+++ src/sys/dev/pci/if_wpivar.h Thu Feb 2 03:41:22 2017
@@ -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 @@ struct wpi_softc {
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;