summaryrefslogtreecommitdiffstats
path: root/sys/dev/mpt
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-11-15 20:04:57 +0000
committerjhb <jhb@FreeBSD.org>2006-11-15 20:04:57 +0000
commit821d475e2153abcb1d2799ea78cd129f8e6bcdfa (patch)
treead72a88ddd7eba8ec7a99b957026db915b490585 /sys/dev/mpt
parentc69b9a59a87cbe9855f041cdcf89bc5c94597255 (diff)
downloadFreeBSD-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/mpt')
-rw-r--r--sys/dev/mpt/mpt.h1
-rw-r--r--sys/dev/mpt/mpt_pci.c15
2 files changed, 15 insertions, 1 deletions
diff --git a/sys/dev/mpt/mpt.h b/sys/dev/mpt/mpt.h
index f27c397..b347a0b 100644
--- a/sys/dev/mpt/mpt.h
+++ b/sys/dev/mpt/mpt.h
@@ -599,6 +599,7 @@ struct mpt_softc {
/*
* PCI Hardware info
*/
+ int pci_msi_count;
struct resource * pci_irq; /* Interrupt map for chip */
void * ih; /* Interupt handle */
struct mpt_pci_cfg pci_cfg; /* saved PCI conf registers */
diff --git a/sys/dev/mpt/mpt_pci.c b/sys/dev/mpt/mpt_pci.c
index 7b5668f..e3f8f76 100644
--- a/sys/dev/mpt/mpt_pci.c
+++ b/sys/dev/mpt/mpt_pci.c
@@ -512,6 +512,13 @@ mpt_pci_attach(device_t dev)
/* Get a handle to the interrupt */
iqd = 0;
+ if (pci_msi_count(dev) == 1) {
+ mpt->pci_msi_count = 1;
+ if (pci_alloc_msi(dev, &mpt->pci_msi_count) == 0)
+ iqd = 1;
+ else
+ mpt->pci_msi_count = 0;
+ }
mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
RF_ACTIVE | RF_SHAREABLE);
if (mpt->pci_irq == NULL) {
@@ -608,10 +615,16 @@ mpt_free_bus_resources(struct mpt_softc *mpt)
}
if (mpt->pci_irq) {
- bus_release_resource(mpt->dev, SYS_RES_IRQ, 0, mpt->pci_irq);
+ bus_release_resource(mpt->dev, SYS_RES_IRQ,
+ mpt->pci_msi_count ? 1 : 0, mpt->pci_irq);
mpt->pci_irq = 0;
}
+ if (mpt->pci_msi_count) {
+ pci_release_msi(mpt->dev);
+ mpt->pci_msi_count = 0;
+ }
+
if (mpt->pci_pio_reg) {
bus_release_resource(mpt->dev, SYS_RES_IOPORT, mpt->pci_pio_rid,
mpt->pci_pio_reg);
OpenPOWER on IntegriCloud