diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2007-08-15 10:15:00 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2007-08-15 10:15:00 +0000 |
commit | 40fbc3fbbe3aaaf26af1e054c3ae72cfc375c1e8 (patch) | |
tree | 0fb0c1b7e0a096542f8a258d21c23a4f49466bc1 /sys/dev | |
parent | 1ee5a2a0134fd75b4ec908f7b090f31a2d23d359 (diff) |
hook the interrupt up
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_nxe.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/sys/dev/pci/if_nxe.c b/sys/dev/pci/if_nxe.c index ca6aaf58634..21e9b939c52 100644 --- a/sys/dev/pci/if_nxe.c +++ b/sys/dev/pci/if_nxe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nxe.c,v 1.38 2007/08/15 07:46:02 dlg Exp $ */ +/* $OpenBSD: if_nxe.c,v 1.39 2007/08/15 10:14:59 dlg Exp $ */ /* * Copyright (c) 2007 David Gwynne <dlg@openbsd.org> @@ -729,6 +729,7 @@ void nxe_pci_unmap(struct nxe_softc *); int nxe_board_info(struct nxe_softc *); int nxe_user_info(struct nxe_softc *); int nxe_init(struct nxe_softc *); +void nxe_uninit(struct nxe_softc *); void nxe_mountroot(void *); /* chip state */ @@ -843,6 +844,7 @@ nxe_attach(struct device *parent, struct device *self, void *aux) { struct nxe_softc *sc = (struct nxe_softc *)self; struct pci_attach_args *pa = aux; + pci_intr_handle_t ih; struct ifnet *ifp; sc->sc_dmat = pa->pa_dmat; @@ -873,6 +875,17 @@ nxe_attach(struct device *parent, struct device *self, void *aux) goto unmap; } + if (pci_intr_map(pa, &ih) != 0) { + printf(": unable to map interrupt\n"); + goto uninit; + } + sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_NET, + nxe_intr, sc, DEVNAME(sc)); + if (sc->sc_ih == NULL) { + printf(": unable to establish interrupt\n"); + goto uninit; + } + ifp = &sc->sc_ac.ac_if; ifp->if_softc = sc; ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; @@ -896,6 +909,9 @@ nxe_attach(struct device *parent, struct device *self, void *aux) sc->sc_fw_major, sc->sc_fw_minor, sc->sc_fw_build, ether_sprintf(sc->sc_ac.ac_enaddr)); return; + +uninit: + nxe_uninit(sc); unmap: nxe_pci_unmap(sc); } @@ -1578,6 +1594,16 @@ err: } void +nxe_uninit(struct nxe_softc *sc) +{ + if (sc->sc_function == 0) { + bus_dmamap_sync(sc->sc_dmat, NXE_DMA_MAP(sc->sc_dummy_dma), + 0, NXE_DMA_LEN(sc->sc_dummy_dma), BUS_DMASYNC_POSTREAD); + nxe_dmamem_free(sc, sc->sc_dummy_dma); + } +} + +void nxe_mountroot(void *arg) { struct nxe_softc *sc = arg; |