diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2007-02-14 22:31:21 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2007-02-14 22:31:21 +0000 |
| commit | 4ccac64eed9d681041c7966e4cb49dabd10d6219 (patch) | |
| tree | a3cb02cdf3b7765006ef2e529cda7f296c826b79 /sys/dev/mpt | |
| parent | 464223f7621c050c8c7a2dfe4a5cad9ec287e59d (diff) | |
Notes
Diffstat (limited to 'sys/dev/mpt')
| -rw-r--r-- | sys/dev/mpt/mpt_pci.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sys/dev/mpt/mpt_pci.c b/sys/dev/mpt/mpt_pci.c index 78e3c9b9ba64..47ce90b7217c 100644 --- a/sys/dev/mpt/mpt_pci.c +++ b/sys/dev/mpt/mpt_pci.c @@ -106,9 +106,10 @@ __FBSDID("$FreeBSD$"); #include <dev/mpt/mpt_raid.h> #if __FreeBSD_version < 700000 +#define pci_msix_count(x) 0 #define pci_msi_count(x) 0 -#define pci_msi_enable(x) 0 #define pci_alloc_msi(x, y) 1 +#define pci_alloc_msix(x, y) 1 #define pci_release_msi(x) do { ; } while (0) #endif @@ -527,14 +528,28 @@ mpt_pci_attach(device_t dev) /* Get a handle to the interrupt */ iqd = 0; - if (mpt->msi_enable && 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; + if (mpt->msi_enable) { + /* + * First try to alloc an MSI-X message. If that + * fails, then try to alloc an MSI message instead. + */ + if (pci_msix_count(dev) == 1) { + mpt->pci_msi_count = 1; + if (pci_alloc_msix(dev, &mpt->pci_msi_count) == 0) { + iqd = 1; + } else { + mpt->pci_msi_count = 0; + } } - } + if (iqd == 0 && 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) { |
