Module Name: src Committed By: jakllsch Date: Mon Dec 14 20:01:17 UTC 2015
Modified Files: src/sys/dev/pci: if_re_pci.c Log Message: Switch PCI re(4) attachment from pci_intr_map() to pci_intr_alloc()/pci_intr_release(). This enables MSI where available. To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/if_re_pci.c 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_re_pci.c diff -u src/sys/dev/pci/if_re_pci.c:1.44 src/sys/dev/pci/if_re_pci.c:1.45 --- src/sys/dev/pci/if_re_pci.c:1.44 Sun May 3 00:04:06 2015 +++ src/sys/dev/pci/if_re_pci.c Mon Dec 14 20:01:17 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_re_pci.c,v 1.44 2015/05/03 00:04:06 matt Exp $ */ +/* $NetBSD: if_re_pci.c,v 1.45 2015/12/14 20:01:17 jakllsch Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -46,7 +46,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.44 2015/05/03 00:04:06 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_re_pci.c,v 1.45 2015/12/14 20:01:17 jakllsch Exp $"); #include <sys/types.h> @@ -75,6 +75,7 @@ struct re_pci_softc { struct rtk_softc sc_rtk; void *sc_ih; + pci_intr_handle_t *sc_pihp; pci_chipset_tag_t sc_pc; }; @@ -174,7 +175,6 @@ re_pci_attach(device_t parent, device_t struct rtk_softc *sc = &psc->sc_rtk; struct pci_attach_args *pa = aux; pci_chipset_tag_t pc = pa->pa_pc; - pci_intr_handle_t ih; const char *intrstr = NULL; const struct rtk_type *t; uint32_t hwrev; @@ -253,12 +253,14 @@ re_pci_attach(device_t parent, device_t /* Hook interrupt last to avoid having to lock softc */ /* Allocate interrupt */ - if (pci_intr_map(pa, &ih)) { + if (pci_intr_alloc(pa, &psc->sc_pihp, NULL, 0)) { aprint_error_dev(self, "couldn't map interrupt\n"); return; } - intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf)); - psc->sc_ih = pci_intr_establish(pc, ih, IPL_NET, re_intr, sc); + intrstr = pci_intr_string(pc, psc->sc_pihp[0], intrbuf, + sizeof(intrbuf)); + psc->sc_ih = pci_intr_establish(pc, psc->sc_pihp[0], IPL_NET, + re_intr, sc); if (psc->sc_ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt"); if (intrstr != NULL) @@ -305,6 +307,11 @@ re_pci_detach(device_t self, int flags) psc->sc_ih = NULL; } + if (psc->sc_pihp != NULL) { + pci_intr_release(psc->sc_pc, psc->sc_pihp, 1); + psc->sc_pihp = NULL; + } + if (sc->rtk_bsize != 0) { bus_space_unmap(sc->rtk_btag, sc->rtk_bhandle, sc->rtk_bsize); sc->rtk_bsize = 0;