summaryrefslogtreecommitdiffstats
path: root/sys/dev/ath/if_ath_pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ath/if_ath_pci.c')
-rw-r--r--sys/dev/ath/if_ath_pci.c138
1 files changed, 17 insertions, 121 deletions
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index 5610882..91cb425 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
-#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/kernel.h>
#include <sys/lock.h>
@@ -54,7 +53,6 @@ __FBSDID("$FreeBSD$");
#include <net/if.h>
#include <net/if_media.h>
#include <net/if_arp.h>
-#include <net/ethernet.h>
#include <net80211/ieee80211_var.h>
@@ -80,98 +78,6 @@ struct ath_pci_softc {
void *sc_ih; /* interrupt handler */
};
-/*
- * XXX eventually this should be some system level definition
- * so modules will hvae probe/attach information like USB.
- * But for now..
- */
-struct pci_device_id {
- int vendor_id;
- int device_id;
-
- int sub_vendor_id;
- int sub_device_id;
-
- int driver_data;
-
- int match_populated:1;
- int match_vendor_id:1;
- int match_device_id:1;
- int match_sub_vendor_id:1;
- int match_sub_device_id:1;
-};
-
-#define PCI_VDEVICE(v, s) \
- .vendor_id = (v), \
- .device_id = (s), \
- .match_populated = 1, \
- .match_vendor_id = 1, \
- .match_device_id = 1
-
-#define PCI_DEVICE_SUB(v, d, dv, ds) \
- .match_populated = 1, \
- .vendor_id = (v), .match_vendor_id = 1, \
- .device_id = (d), .match_device_id = 1, \
- .sub_vendor_id = (dv), .match_sub_vendor_id = 1, \
- .sub_device_id = (ds), .match_sub_device_id = 1
-
-#define PCI_VENDOR_ID_ATHEROS 0x168c
-#define PCI_VENDOR_ID_SAMSUNG 0x144d
-#define PCI_VENDOR_ID_AZWAVE 0x1a3b
-#define PCI_VENDOR_ID_FOXCONN 0x105b
-#define PCI_VENDOR_ID_ATTANSIC 0x1969
-#define PCI_VENDOR_ID_ASUSTEK 0x1043
-#define PCI_VENDOR_ID_DELL 0x1028
-#define PCI_VENDOR_ID_QMI 0x1a32
-#define PCI_VENDOR_ID_LENOVO 0x17aa
-#define PCI_VENDOR_ID_HP 0x103c
-
-#include "if_ath_pci_devlist.h"
-
-/*
- * Attempt to find a match for the given device in
- * the given device table.
- *
- * Returns the device structure or NULL if no matching
- * PCI device is found.
- */
-static const struct pci_device_id *
-ath_pci_probe_device(device_t dev, const struct pci_device_id *dev_table, int nentries)
-{
- int i;
- int vendor_id, device_id;
- int sub_vendor_id, sub_device_id;
-
- vendor_id = pci_get_vendor(dev);
- device_id = pci_get_device(dev);
- sub_vendor_id = pci_get_subvendor(dev);
- sub_device_id = pci_get_subdevice(dev);
-
- for (i = 0; i < nentries; i++) {
- /* Don't match on non-populated (eg empty) entries */
- if (! dev_table[i].match_populated)
- continue;
-
- if (dev_table[i].match_vendor_id &&
- (dev_table[i].vendor_id != vendor_id))
- continue;
- if (dev_table[i].match_device_id &&
- (dev_table[i].device_id != device_id))
- continue;
- if (dev_table[i].match_sub_vendor_id &&
- (dev_table[i].sub_vendor_id != sub_vendor_id))
- continue;
- if (dev_table[i].match_sub_device_id &&
- (dev_table[i].sub_device_id != sub_device_id))
- continue;
-
- /* Match */
- return (&dev_table[i]);
- }
-
- return (NULL);
-}
-
#define BS_BAR 0x10
#define PCIR_RETRY_TIMEOUT 0x41
#define PCIR_CFG_PMCSR 0x48
@@ -242,15 +148,9 @@ ath_pci_attach(device_t dev)
const struct firmware *fw = NULL;
const char *buf;
#endif
- const struct pci_device_id *pd;
sc->sc_dev = dev;
- /* Do this lookup anyway; figure out what to do with it later */
- pd = ath_pci_probe_device(dev, ath_pci_id_table, nitems(ath_pci_id_table));
- if (pd)
- sc->sc_pci_devinfo = pd->driver_data;
-
/*
* Enable bus mastering.
*/
@@ -271,7 +171,8 @@ ath_pci_attach(device_t dev)
device_printf(dev, "cannot map register space\n");
goto bad;
}
- sc->sc_st = (HAL_BUS_TAG) rman_get_bustag(psc->sc_sr);
+ /* XXX uintptr_t is a bandaid for ia64; to be fixed */
+ sc->sc_st = (HAL_BUS_TAG)(uintptr_t) rman_get_bustag(psc->sc_sr);
sc->sc_sh = (HAL_BUS_HANDLE) rman_get_bushandle(psc->sc_sr);
/*
* Mark device invalid so any interrupts (shared or otherwise)
@@ -279,13 +180,6 @@ ath_pci_attach(device_t dev)
*/
sc->sc_invalid = 1;
- ATH_LOCK_INIT(sc);
- ATH_PCU_LOCK_INIT(sc);
- ATH_RX_LOCK_INIT(sc);
- ATH_TX_LOCK_INIT(sc);
- ATH_TX_IC_LOCK_INIT(sc);
- ATH_TXSTATUS_LOCK_INIT(sc);
-
/*
* Arrange interrupt line.
*/
@@ -336,7 +230,7 @@ ath_pci_attach(device_t dev)
if (fw == NULL) {
device_printf(dev, "%s: couldn't find firmware\n",
__func__);
- goto bad4;
+ goto bad3;
}
device_printf(dev, "%s: EEPROM firmware @ %p\n",
@@ -346,20 +240,30 @@ ath_pci_attach(device_t dev)
if (! sc->sc_eepromdata) {
device_printf(dev, "%s: can't malloc eepromdata\n",
__func__);
- goto bad4;
+ goto bad3;
}
memcpy(sc->sc_eepromdata, fw->data, fw->datasize);
firmware_put(fw, 0);
}
#endif /* ATH_EEPROM_FIRMWARE */
+ ATH_LOCK_INIT(sc);
+ ATH_PCU_LOCK_INIT(sc);
+ ATH_RX_LOCK_INIT(sc);
+ ATH_TX_LOCK_INIT(sc);
+ ATH_TX_IC_LOCK_INIT(sc);
+ ATH_TXSTATUS_LOCK_INIT(sc);
+
error = ath_attach(pci_get_device(dev), sc);
if (error == 0) /* success */
return 0;
-#ifdef ATH_EEPROM_FIRMWARE
-bad4:
-#endif
+ ATH_TXSTATUS_LOCK_DESTROY(sc);
+ ATH_PCU_LOCK_DESTROY(sc);
+ ATH_RX_LOCK_DESTROY(sc);
+ ATH_TX_IC_LOCK_DESTROY(sc);
+ ATH_TX_LOCK_DESTROY(sc);
+ ATH_LOCK_DESTROY(sc);
bus_dma_tag_destroy(sc->sc_dmat);
bad3:
bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih);
@@ -367,14 +271,6 @@ bad2:
bus_release_resource(dev, SYS_RES_IRQ, 0, psc->sc_irq);
bad1:
bus_release_resource(dev, SYS_RES_MEMORY, BS_BAR, psc->sc_sr);
-
- ATH_TXSTATUS_LOCK_DESTROY(sc);
- ATH_PCU_LOCK_DESTROY(sc);
- ATH_RX_LOCK_DESTROY(sc);
- ATH_TX_IC_LOCK_DESTROY(sc);
- ATH_TX_LOCK_DESTROY(sc);
- ATH_LOCK_DESTROY(sc);
-
bad:
return (error);
}
OpenPOWER on IntegriCloud