diff options
author | jhb <jhb@FreeBSD.org> | 2006-11-15 20:04:57 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-11-15 20:04:57 +0000 |
commit | 821d475e2153abcb1d2799ea78cd129f8e6bcdfa (patch) | |
tree | ad72a88ddd7eba8ec7a99b957026db915b490585 /sys/dev/bce | |
parent | c69b9a59a87cbe9855f041cdcf89bc5c94597255 (diff) | |
download | FreeBSD-src-821d475e2153abcb1d2799ea78cd129f8e6bcdfa.zip FreeBSD-src-821d475e2153abcb1d2799ea78cd129f8e6bcdfa.tar.gz |
Add MSI support to em(4), bce(4), and mpt(4). For now, we only support
devices that support a maximum of 1 message, and we use that 1 message
instead of the INTx rid 0 IRQ with the same interrupt handler, etc.
Diffstat (limited to 'sys/dev/bce')
-rw-r--r-- | sys/dev/bce/if_bce.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/bce/if_bce.c b/sys/dev/bce/if_bce.c index fc5daa1..2b67c43 100644 --- a/sys/dev/bce/if_bce.c +++ b/sys/dev/bce/if_bce.c @@ -452,7 +452,7 @@ bce_attach(device_t dev) struct bce_softc *sc; struct ifnet *ifp; u32 val; - int mbuf, rid, rc = 0; + int count, mbuf, rid, rc = 0; sc = device_get_softc(dev); sc->bce_dev = dev; @@ -485,7 +485,12 @@ bce_attach(device_t dev) sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res); /* Allocate PCI IRQ resources. */ - rid = 0; + count = pci_msi_count(dev); + if (count == 1 && pci_alloc_msi(dev, &count) == 0) { + rid = 1; + sc->bce_flags |= BCE_USING_MSI_FLAG; + } else + rid = 0; sc->bce_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); @@ -2539,9 +2544,12 @@ bce_release_resources(struct bce_softc *sc) if (sc->bce_irq != NULL) bus_release_resource(dev, SYS_RES_IRQ, - 0, + sc->bce_flags & BCE_USING_MSI_FLAG ? 1 : 0, sc->bce_irq); + if (sc->bce_flags & BCE_USING_MSI_FLAG) + pci_release_msi(dev); + if (sc->bce_res != NULL) bus_release_resource(dev, SYS_RES_MEMORY, |