Author: imp
Date: Sat Jul 7 15:25:16 2018
New Revision: 336067
URL: https://svnweb.freebsd.org/changeset/base/336067
Log:
Switch to using new PCI_MATCH stuff.
Modified:
head/sys/dev/ath/if_ath_pci.c
head/sys/dev/ath/if_ath_pci_devlist.h
Modified: head/sys/dev/ath/if_ath_pci.c
==
--- head/sys/dev/ath/if_ath_pci.c Sat Jul 7 15:25:11 2018
(r336066)
+++ head/sys/dev/ath/if_ath_pci.c Sat Jul 7 15:25:16 2018
(r336067)
@@ -82,41 +82,12 @@ 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;
+#definePCI_VDEVICE(v, d) \
+ PCI_DEV(v,d)
- int sub_vendor_id;
- int sub_device_id;
+#definePCI_DEVICE_SUB(v, d, sv, sd)\
+ PCI_DEV(v, d), PCI_SUBDEV(v, d)
- 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;
-};
-
-#definePCI_VDEVICE(v, s) \
- .vendor_id = (v), \
- .device_id = (s), \
- .match_populated = 1, \
- .match_vendor_id = 1, \
- .match_device_id = 1
-
-#definePCI_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
-
#definePCI_VENDOR_ID_ATHEROS 0x168c
#definePCI_VENDOR_ID_SAMSUNG 0x144d
#definePCI_VENDOR_ID_AZWAVE0x1a3b
@@ -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);
-}
-
#defineBS_BAR 0x10
#definePCIR_RETRY_TIMEOUT 0x41
#definePCIR_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;
Modified: head/sys/dev/ath/if_ath_pci_devlist.h
==
--- head/sys/dev/ath/if_ath_pci_devlist.h Sat Jul 7 15:25:11 2018
(r336066)
+++ head/sys/dev/ath/if_ath_pci_devlist.h Sat Jul 7 15:25:16 2018
(r336067)
@@ -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 */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any ma