wpi(4): use MSI if available.

This commit is contained in:
jakllsch 2017-02-02 03:41:22 +00:00
parent 4cb74e69ad
commit c5b0c4ab5e
2 changed files with 13 additions and 7 deletions

View File

@ -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, device_t self, void *aux)
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, device_t self, void *aux)
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 __unused)
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);

View File

@ -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;