aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ath
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2018-07-07 15:25:16 +0000
committerWarner Losh <imp@FreeBSD.org>2018-07-07 15:25:16 +0000
commit4d711ae2697272ecd5cb77926e45920540b8cc56 (patch)
tree7b0ceb992ca7421be7f79e349d425c662bb76ead /sys/dev/ath
parent971b5f76327451eda17260f799aad58effbf6a80 (diff)
Notes
Diffstat (limited to 'sys/dev/ath')
-rw-r--r--sys/dev/ath/if_ath_pci.c85
-rw-r--r--sys/dev/ath/if_ath_pci_devlist.h2
2 files changed, 7 insertions, 80 deletions
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index ae5867713094e..26c0f66f3ce9a 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -82,40 +82,11 @@ struct ath_pci_softc {
void *sc_ih; /* interrupt handler */
};
-/*
- * XXX eventually this should be some system level definition
- * so modules will have 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_VDEVICE(v, d) \
+ PCI_DEV(v,d)
-#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_DEVICE_SUB(v, d, sv, sd) \
+ PCI_DEV(v, d), PCI_SUBDEV(v, d)
#define PCI_VENDOR_ID_ATHEROS 0x168c
#define PCI_VENDOR_ID_SAMSUNG 0x144d
@@ -130,50 +101,6 @@ struct pci_device_id {
#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
@@ -244,12 +171,12 @@ ath_pci_attach(device_t dev)
const struct firmware *fw = NULL;
const char *buf;
#endif
- const struct pci_device_id *pd;
+ const struct pci_device_table *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));
+ pd = PCI_MATCH(dev, ath_pci_id_table);
if (pd)
sc->sc_pci_devinfo = pd->driver_data;
diff --git a/sys/dev/ath/if_ath_pci_devlist.h b/sys/dev/ath/if_ath_pci_devlist.h
index ae65909b3364f..dc49ab578d65a 100644
--- a/sys/dev/ath/if_ath_pci_devlist.h
+++ b/sys/dev/ath/if_ath_pci_devlist.h
@@ -29,7 +29,7 @@
* $FreeBSD$
*/
-static const struct pci_device_id ath_pci_id_table[] = {
+static const struct pci_device_table ath_pci_id_table[] = {
{ PCI_VDEVICE(PCI_VENDOR_ID_ATHEROS, 0x0023) }, /* PCI */
{ PCI_VDEVICE(PCI_VENDOR_ID_ATHEROS, 0x0024) }, /* PCI-E */
{ PCI_VDEVICE(PCI_VENDOR_ID_ATHEROS, 0x0027) }, /* PCI */