static int mps_pci_suspend(device_t);
static int mps_pci_resume(device_t);
static void mps_pci_free(struct mps_softc *);
+#ifdef OLD_MSI
static int mps_alloc_msix(struct mps_softc *sc, int msgs);
static int mps_alloc_msi(struct mps_softc *sc, int msgs);
+#endif
int mps_disable_msix = 0;
TUNABLE_INT("hw.mps.disable_msix", &mps_disable_msix);
mps_pci_setup_interrupts(struct mps_softc *sc)
{
device_t dev;
- int i, error, msgs;
+ int i, error;
+#ifdef OLD_MSI
+ int msgs;
+#endif
dev = sc->mps_dev;
error = ENXIO;
+#ifdef OLD_MSI
if ((mps_disable_msix == 0) &&
((msgs = pci_msix_count(dev)) >= MPS_MSI_COUNT))
error = mps_alloc_msix(sc, MPS_MSI_COUNT);
if ((error != 0) && (mps_disable_msi == 0) &&
((msgs = pci_msi_count(dev)) >= MPS_MSI_COUNT))
error = mps_alloc_msi(sc, MPS_MSI_COUNT);
+#endif
if (error != 0) {
sc->mps_flags |= MPS_FLAGS_INTX;
return (EINVAL);
}
+#ifdef OLD_MSI
static int
mps_alloc_msix(struct mps_softc *sc, int msgs)
{
error = pci_alloc_msi(sc->mps_dev, &msgs);
return (error);
}
+#endif
/* Get a handle to the interrupt */
iqd = 0;
+#ifdef OLD_MSI
if (mpt->msi_enable) {
/*
* First try to alloc an MSI-X message. If that
}
}
}
+#endif
mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd,
RF_ACTIVE | RF_SHAREABLE);
if (mpt->pci_irq == NULL) {
{ -1, 0, 0 }
};
+#ifdef OLD_MSI
static struct resource_spec alc_irq_spec_msi[] = {
{ SYS_RES_IRQ, 1, RF_ACTIVE },
{ -1, 0, 0 }
{ SYS_RES_IRQ, 1, RF_ACTIVE },
{ -1, 0, 0 }
};
+#endif
static uint32_t alc_dma_burst[] = { 128, 256, 512, 1024, 2048, 4096, 0 };
device_printf(dev, "MSI count : %d\n", msic);
}
-#if 0
+#ifdef OLD_MSI
/* Prefer MSIX over MSI. */
if (msix_disable == 0 || msi_disable == 0) {
if (msix_disable == 0 && msixc == ALC_MSIX_MESSAGES &&
static int
igb_setup_msix(struct adapter *adapter)
{
-#if 0
+#ifdef OLD_MSI
device_t dev = adapter->dev;
int rid, want, queues, msgs;
struct ifnet *ifp;
const struct iwn_hal *hal;
uint32_t tmp;
- int i, error, result;
+ int i, error;
+#ifdef OLD_MSI
+ int result;
+#endif
uint8_t macaddr[IEEE80211_ADDR_LEN];
wlan_serialize_enter();
sc->sc_st = rman_get_bustag(sc->mem);
sc->sc_sh = rman_get_bushandle(sc->mem);
sc->irq_rid = 0;
-#if 0
+#ifdef OLD_MSI
if ((result = pci_msi_count(dev)) == 1 &&
pci_alloc_msi(dev, &result) == 0)
sc->irq_rid = 1;
{
int count, err, rid;
+#ifdef OLD_MSI
count = pci_msi_count(sc->dev);
- if (/* count == 1 && pci_alloc_msi(sc->dev, &count) == 0 */0) {
+ if (count == 1 && pci_alloc_msi(sc->dev, &count) == 0) {
rid = 1;
} else {
rid = 0;
sc->legacy_irq = 1;
}
+#else
+ count = 0;
+ rid = 0;
+ sc->legacy_irq = 1;
+#endif
sc->irq_res = bus_alloc_resource(sc->dev, SYS_RES_IRQ, &rid, 0, ~0,
1, RF_SHAREABLE | RF_ACTIVE);
if (sc->irq_res == NULL) {
device_printf(sc->tws_dev, "Using legacy INTx\n");
break;
case TWS_MSI :
+#ifdef OLD_MSI
cmd = cmd | 0x0400;
pci_write_config(sc->tws_dev, PCIR_COMMAND, cmd, 2);
sc->irqs = 1;
if ( tws_setup_intr(sc, sc->irqs) == FAILURE )
return(FAILURE);
device_printf(sc->tws_dev, "Using MSI\n");
+#else
+ messages = 0;
+ panic("%s: Using MSI", device_get_nameunit(sc->tws_dev));
+#endif
break;
}