Index: sys/dev/oce/oce_if.c =================================================================== --- sys/dev/oce/oce_if.c +++ sys/dev/oce/oce_if.c @@ -214,12 +214,6 @@ static devclass_t oce_devclass; -DRIVER_MODULE(oce, pci, oce_driver, oce_devclass, 0, 0); -MODULE_DEPEND(oce, pci, 1, 1, 1); -MODULE_DEPEND(oce, ether, 1, 1, 1); -MODULE_VERSION(oce, 1); - - /* global vars */ const char component_revision[32] = {"///" COMPONENT_REVISION "///"}; @@ -242,6 +236,15 @@ (PCI_VENDOR_EMULEX << 16) | PCI_PRODUCT_SH }; + +DRIVER_MODULE(oce, pci, oce_driver, oce_devclass, 0, 0); +MODULE_PNP_INFO("W32:vendor/device", pci, oce, supportedDevices, + sizeof(supportedDevices[0]), nitems(supportedDevices)); +MODULE_DEPEND(oce, pci, 1, 1, 1); +MODULE_DEPEND(oce, ether, 1, 1, 1); +MODULE_VERSION(oce, 1); + + POCE_SOFTC softc_head = NULL; POCE_SOFTC softc_tail = NULL; Index: sys/dev/pci/pci_pci.c =================================================================== --- sys/dev/pci/pci_pci.c +++ sys/dev/pci/pci_pci.c @@ -81,6 +81,11 @@ static int pcib_request_feature_default(device_t pcib, device_t dev, enum pci_feature feature); +struct pci_device_table pcib_devs[] = { + {PCI_CLASS(PCIC_BRIDGE), PCI_SUBCLASS(PCIS_BRIDGE_PCI), + PCI_DESCR("PCI-PCI bridge")} +}; + static device_method_t pcib_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pcib_probe), @@ -132,6 +137,7 @@ DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc)); DRIVER_MODULE(pcib, pci, pcib_driver, pcib_devclass, NULL, NULL); +PCI_PNP_INFO(pcib_devs); #if defined(NEW_PCIB) || defined(PCI_HP) SYSCTL_DECL(_hw_pci); @@ -1503,12 +1509,13 @@ static int pcib_probe(device_t dev) { - if ((pci_get_class(dev) == PCIC_BRIDGE) && - (pci_get_subclass(dev) == PCIS_BRIDGE_PCI)) { - device_set_desc(dev, "PCI-PCI bridge"); - return(-10000); - } - return(ENXIO); + const struct pci_device_table *pcibd; + + pcibd = PCI_MATCH(dev, pcib_devs); + if (pcibd == NULL) + return (ENXIO); + device_set_desc(dev, pcibd->descr); + return (-10000); } void Index: sys/dev/pci/pcivar.h =================================================================== --- sys/dev/pci/pcivar.h +++ sys/dev/pci/pcivar.h @@ -301,6 +301,8 @@ .match_flag_subdevice = 1, .subdevice = (sd) #define PCI_DEVID(did) \ PCI_DEV((uint16_t)did, (uint16_t)(did >> 16)) +#define PCI_VID(v) \ + .match_flag_vendor = 1, .vendor = (v) #define PCI_CLASS(x) \ .match_flag_class = 1, .class_id = (x) #define PCI_SUBCLASS(x) \ Index: sys/dev/ppc/ppc_pci.c =================================================================== --- sys/dev/ppc/ppc_pci.c +++ sys/dev/ppc/ppc_pci.c @@ -83,35 +83,42 @@ int rid; }; -static struct pci_id pci_ids[] = { - { 0x1020131f, "SIIG Cyber Parallel PCI (10x family)", 0x18 }, - { 0x2020131f, "SIIG Cyber Parallel PCI (20x family)", 0x10 }, - { 0x05111407, "Lava SP BIDIR Parallel PCI", 0x10 }, - { 0x80001407, "Lava Computers 2SP-PCI parallel port", 0x10 }, - { 0x84031415, "Oxford Semiconductor OX12PCI840 Parallel port", 0x10 }, - { 0x95131415, "Oxford Semiconductor OX16PCI954 Parallel port", 0x10 }, - { 0xc1101415, "Oxford Semiconductor OXPCIe952 Parallel port", 0x10 }, - { 0x98059710, "NetMos NM9805 1284 Printer port", 0x10 }, - { 0x98659710, "MosChip MCS9865 1284 Printer port", 0x10 }, - { 0x99009710, "MosChip MCS9900 PCIe to Peripheral Controller", 0x10 }, - { 0x99019710, "MosChip MCS9901 PCIe to Peripheral Controller", 0x10 }, - { 0xffff } +struct pci_device_table ppc_devs[] = { + {PCI_DEVID(0x1020131f), PCI_DESCR("SIIG Cyber Parallel PCI (10x family)"), + .driver_data = 0x18}, + {PCI_DEVID(0x2020131f), PCI_DESCR("SIIG Cyber Parallel PCI (20x family)"), + .driver_data = 0x10}, + {PCI_DEVID(0x05111407), PCI_DESCR("Lava SP BIDIR Parallel PCI"), + .driver_data = 0x10}, + {PCI_DEVID(0x80001407), PCI_DESCR("Lava Computers 2SP-PCI parallel port"), + .driver_data = 0x10}, + {PCI_DEVID(0x84031415), PCI_DESCR("Oxford Semiconductor OX12PCI840 Parallel port"), + .driver_data = 0x10}, + {PCI_DEVID(0x95131415), PCI_DESCR("Oxford Semiconductor OX16PCI954 Parallel port"), + .driver_data = 0x10}, + {PCI_DEVID(0xc1101415), PCI_DESCR("Oxford Semiconductor OXPCIe952 Parallel port"), + .driver_data = 0x10}, + {PCI_DEVID(0x98059710), PCI_DESCR("NetMos NM9805 1284 Printer port"), + .driver_data = 0x10}, + {PCI_DEVID(0x98659710), PCI_DESCR("MosChip MCS9865 1284 Printer port"), + .driver_data = 0x10}, + {PCI_DEVID(0x99009710), PCI_DESCR("MosChip MCS9900 PCIe to Peripheral Controller"), + .driver_data = 0x10}, + {PCI_DEVID(0x99019710), PCI_DESCR("MosChip MCS9901 PCIe to Peripheral Controller"), + .driver_data = 0x10}, }; static int ppc_pci_probe(device_t dev) { - struct pci_id *id; - uint32_t type; - - type = pci_get_devid(dev); - id = pci_ids; - while (id->type != 0xffff && id->type != type) - id++; - if (id->type == 0xffff) + const struct pci_device_table *ppcd; + + ppcd = PCI_MATCH(dev, ppc_devs) + if (ppcd == NULL) return (ENXIO); - device_set_desc(dev, id->desc); - return (ppc_probe(dev, id->rid)); + device_set_desc(dev, ppcd->descr); + return (ppc_probe(dev, ppcd->driver_data)); } DRIVER_MODULE(ppc, pci, ppc_pci_driver, ppc_devclass, 0, 0); +PCI_PNP_INFO(ppc_devs); Index: sys/dev/qlxgb/qla_os.c =================================================================== --- sys/dev/qlxgb/qla_os.c +++ sys/dev/qlxgb/qla_os.c @@ -90,6 +90,11 @@ static int qla_media_change(struct ifnet *ifp); static void qla_media_status(struct ifnet *ifp, struct ifmediareq *ifmr); +struct pci_device_table qla_pci_devs[] = { + {PCI_DEVID(PCI_QLOGIC_ISP8020), + PCI_DESCR("Qlogic ISP 80xx PCI CNA Adapter-Ethernet Function")} +}; + static device_method_t qla_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, qla_pci_probe), @@ -105,6 +110,7 @@ static devclass_t qla80xx_devclass; DRIVER_MODULE(qla80xx, pci, qla_pci_driver, qla80xx_devclass, 0, 0); +PCI_PNP_INFO(qla_pci_devs); MODULE_DEPEND(qla80xx, pci, 1, 1, 1); MODULE_DEPEND(qla80xx, ether, 1, 1, 1); @@ -127,22 +133,20 @@ static int qla_pci_probe(device_t dev) { - switch ((pci_get_device(dev) << 16) | (pci_get_vendor(dev))) { - case PCI_QLOGIC_ISP8020: - snprintf(dev_str, sizeof(dev_str), "%s v%d.%d.%d", - "Qlogic ISP 80xx PCI CNA Adapter-Ethernet Function", - QLA_VERSION_MAJOR, QLA_VERSION_MINOR, - QLA_VERSION_BUILD); - device_set_desc(dev, dev_str); - break; - default: - return (ENXIO); - } - - if (bootverbose) - printf("%s: %s\n ", __func__, dev_str); - - return (BUS_PROBE_DEFAULT); + const struct pci_device_table *qlad; + qlad = PCI_MATCH(dev, qla_pci_devs); + if (qlad == NULL) + return (ENXIO); + snprintf(dev_str, sizeof(dev_str), "%s v%d.%d.%d", + qlad->descr, + QLA_VERSION_MAJOR, QLA_VERSION_MINOR, + QLA_VERSION_BUILD); + device_set_desc(dev, dev_str); + + if (bootverbose) + printf("%s: %s\n ", __func__, dev_str); + + return (BUS_PROBE_DEFAULT); } static void Index: sys/dev/qlxgbe/ql_os.c =================================================================== --- sys/dev/qlxgbe/ql_os.c +++ sys/dev/qlxgbe/ql_os.c @@ -104,6 +104,11 @@ static void qla_destroy_fp_taskqueues(qla_host_t *ha); static void qla_drain_fp_taskqueues(qla_host_t *ha); +struct pci_device_table qla_pci_devs[] = { + {PCI_DEVID(PCI_QLOGIC_ISP8030), + PCI_DESCR("Qlogic ISP 83xx PCI CNA Adapter-Ethernet Function")} +}; + static device_method_t qla_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, qla_pci_probe), @@ -119,6 +124,7 @@ static devclass_t qla83xx_devclass; DRIVER_MODULE(qla83xx, pci, qla_pci_driver, qla83xx_devclass, 0, 0); +PCI_PNP_INFO(qla_pci_devs); MODULE_DEPEND(qla83xx, pci, 1, 1, 1); MODULE_DEPEND(qla83xx, ether, 1, 1, 1); @@ -139,25 +145,24 @@ static int qla_pci_probe(device_t dev) { - switch ((pci_get_device(dev) << 16) | (pci_get_vendor(dev))) { - case PCI_QLOGIC_ISP8030: - snprintf(dev_str, sizeof(dev_str), "%s v%d.%d.%d", - "Qlogic ISP 83xx PCI CNA Adapter-Ethernet Function", - QLA_VERSION_MAJOR, QLA_VERSION_MINOR, - QLA_VERSION_BUILD); - snprintf(ver_str, sizeof(ver_str), "v%d.%d.%d", - QLA_VERSION_MAJOR, QLA_VERSION_MINOR, - QLA_VERSION_BUILD); - device_set_desc(dev, dev_str); - break; - default: - return (ENXIO); - } - - if (bootverbose) - printf("%s: %s\n ", __func__, dev_str); - - return (BUS_PROBE_DEFAULT); + const struct pci_device_table *qlad; + + qlad = PCI_MATCH(dev, qla_pci_devs); + if (qlad == NULL) + return (ENXIO); + snprintf(dev_str, sizeof(dev_str), "%s v%d.%d.%d", + qlad->descr, + QLA_VERSION_MAJOR, QLA_VERSION_MINOR, + QLA_VERSION_BUILD); + snprintf(ver_str, sizeof(ver_str), "v%d.%d.%d", + QLA_VERSION_MAJOR, QLA_VERSION_MINOR, + QLA_VERSION_BUILD); + device_set_desc(dev, dev_str); + + if (bootverbose) + printf("%s: %s\n ", __func__, dev_str); + + return (BUS_PROBE_DEFAULT); } static void Index: sys/dev/qlxge/qls_os.c =================================================================== --- sys/dev/qlxge/qls_os.c +++ sys/dev/qlxge/qls_os.c @@ -97,6 +97,11 @@ static int qls_media_change(struct ifnet *ifp); static void qls_media_status(struct ifnet *ifp, struct ifmediareq *ifmr); +struct pci_device_table qla_pci_devs[] = { + {PCI_DEVID(PCI_QLOGIC_DEV8000), + PCI_DESCR("Qlogic ISP 8000 PCI CNA Adapter-Ethernet Function")} +}; + static device_method_t qla_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, qls_pci_probe), @@ -112,6 +117,7 @@ static devclass_t qla8000_devclass; DRIVER_MODULE(qla8000, pci, qla_pci_driver, qla8000_devclass, 0, 0); +PCI_PNP_INFO(qla_pci_devs); MODULE_DEPEND(qla8000, pci, 1, 1, 1); MODULE_DEPEND(qla8000, ether, 1, 1, 1); @@ -128,20 +134,19 @@ static int qls_pci_probe(device_t dev) { - switch ((pci_get_device(dev) << 16) | (pci_get_vendor(dev))) { - case PCI_QLOGIC_DEV8000: - snprintf(dev_str, sizeof(dev_str), "%s v%d.%d.%d", - "Qlogic ISP 8000 PCI CNA Adapter-Ethernet Function", - QLA_VERSION_MAJOR, QLA_VERSION_MINOR, - QLA_VERSION_BUILD); - snprintf(ver_str, sizeof(ver_str), "v%d.%d.%d", - QLA_VERSION_MAJOR, QLA_VERSION_MINOR, - QLA_VERSION_BUILD); - device_set_desc(dev, dev_str); - break; - default: - return (ENXIO); - } + const struct pci_device_table *qlsd; + + qlsd = PCI_MATCH(dev, qla_pci_devs); + if (qlsd == NULL) + return (ENXIO); + snprintf(dev_str, sizeof(dev_str), "%s v%d.%d.%d", + qlsd->descr, + QLA_VERSION_MAJOR, QLA_VERSION_MINOR, + QLA_VERSION_BUILD); + snprintf(ver_str, sizeof(ver_str), "v%d.%d.%d", + QLA_VERSION_MAJOR, QLA_VERSION_MINOR, + QLA_VERSION_BUILD); + device_set_desc(dev, dev_str); if (bootverbose) printf("%s: %s\n ", __func__, dev_str); Index: sys/dev/re/if_re.c =================================================================== --- sys/dev/re/if_re.c +++ sys/dev/re/if_re.c @@ -176,29 +176,29 @@ /* * Various supported device vendors/types and their names. */ -static const struct rl_type re_devs[] = { - { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, - "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, - { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, - "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, - { RT_VENDORID, RT_DEVICEID_8139, 0, - "RealTek 8139C+ 10/100BaseTX" }, - { RT_VENDORID, RT_DEVICEID_8101E, 0, - "RealTek 810xE PCIe 10/100baseTX" }, - { RT_VENDORID, RT_DEVICEID_8168, 0, - "RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet" }, - { NCUBE_VENDORID, RT_DEVICEID_8168, 0, - "TP-Link TG-3468 v2 (RTL8168) Gigabit Ethernet" }, - { RT_VENDORID, RT_DEVICEID_8169, 0, - "RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet" }, - { RT_VENDORID, RT_DEVICEID_8169SC, 0, - "RealTek 8169SC/8110SC Single-chip Gigabit Ethernet" }, - { COREGA_VENDORID, COREGA_DEVICEID_CGLAPCIGT, 0, - "Corega CG-LAPCIGT (RTL8169S) Gigabit Ethernet" }, - { LINKSYS_VENDORID, LINKSYS_DEVICEID_EG1032, 0, - "Linksys EG1032 (RTL8169S) Gigabit Ethernet" }, - { USR_VENDORID, USR_DEVICEID_997902, 0, - "US Robotics 997902 (RTL8169S) Gigabit Ethernet" } +struct pci_device_table re_devs[] = { + {PCI_DEV(DLINK_VENDORID, DLINK_DEVICEID_528T), + PCI_DESCR("D-Link DGE-528(T) Gigabit Ethernet Adapter"), .driver_data = 0}, + {PCI_DEV(DLINK_VENDORID, DLINK_DEVICEID_530T_REVC), + PCI_DESCR("D-Link DGE-530(T) Gigabit Ethernet Adapter"), .driver_data = 0}, + {PCI_DEV(RT_VENDORID, RT_DEVICEID_8139), + PCI_DESCR("RealTek 8139C+ 10/100BaseTX"), .driver_data = 0}, + {PCI_DEV(RT_VENDORID, RT_DEVICEID_8101E), + PCI_DESCR("RealTek 810xE PCIe 10/100baseTX"), .driver_data = 0}, + {PCI_DEV(RT_VENDORID, RT_DEVICEID_8168), + PCI_DESCR("RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet"), .driver_data = 0}, + {PCI_DEV(NCUBE_VENDORID, RT_DEVICEID_8168), + PCI_DESCR("TP-Link TG-3468 v2 (RTL8168) Gigabit Ethernet"), .driver_data = 0}, + {PCI_DEV(RT_VENDORID, RT_DEVICEID_8169), + PCI_DESCR("RealTek 8169/8169S/8169SB(L)/8110S/8110SB(L) Gigabit Ethernet"), .driver_data = 0}, + {PCI_DEV(RT_VENDORID, RT_DEVICEID_8169SC), + PCI_DESCR("RealTek 8169SC/8110SC Single-chip Gigabit Ethernet"), .driver_data = 0}, + {PCI_DEV(COREGA_VENDORID, COREGA_DEVICEID_CGLAPCIGT), + PCI_DESCR("Corega CG-LAPCIGT (RTL8169S) Gigabit Ethernet"), .driver_data = 0}, + {PCI_DEV(LINKSYS_VENDORID, LINKSYS_DEVICEID_EG1032), + PCI_DESCR("Linksys EG1032 (RTL8169S) Gigabit Ethernet"), .driver_data = 0}, + {PCI_DEV(USR_VENDORID, USR_DEVICEID_997902), + PCI_DESCR("US Robotics 997902 (RTL8169S) Gigabit Ethernet"), .driver_data = 0} }; static const struct rl_hwrev re_hwrevs[] = { @@ -352,6 +352,7 @@ static devclass_t re_devclass; DRIVER_MODULE(re, pci, re_driver, re_devclass, 0, 0); +PCI_PNP_INFO(re_devs); DRIVER_MODULE(miibus, re, miibus_driver, miibus_devclass, 0, 0); #define EE_SET(x) \ @@ -934,10 +935,9 @@ static int re_probe(device_t dev) { - const struct rl_type *t; + const struct pci_device_table *red; uint16_t devid, vendor; uint16_t revid, sdevid; - int i; vendor = pci_get_vendor(dev); devid = pci_get_device(dev); @@ -960,16 +960,12 @@ return (ENXIO); } } - - t = re_devs; - for (i = 0; i < nitems(re_devs); i++, t++) { - if (vendor == t->rl_vid && devid == t->rl_did) { - device_set_desc(dev, t->rl_name); - return (BUS_PROBE_DEFAULT); - } - } - - return (ENXIO); + + red = PCI_MATCH(dev, re_devs); + if (red == NULL) + return (ENXIO); + device_set_desc(dev, red->descr); + return (BUS_PROBE_DEFAULT); } /* Index: sys/dev/rp/rp_pci.c =================================================================== --- sys/dev/rp/rp_pci.c +++ sys/dev/rp/rp_pci.c @@ -123,6 +123,11 @@ static rp_aiop2off_t rp_pci_aiop2off; static rp_ctlmask_t rp_pci_ctlmask; +struct pci_device_table rp_devs[] = { + {PCI_VID(RP_VENDOR_ID), + PCI_DESCR("RocketPort PCI")} +}; + /* * The following functions are the pci-specific part * of rp driver. @@ -131,18 +136,13 @@ static int rp_pciprobe(device_t dev) { - char *s; - - s = NULL; - if (pci_get_vendor(dev) == RP_VENDOR_ID) - s = "RocketPort PCI"; + const struct pci_device_table *rpd; - if (s != NULL) { - device_set_desc(dev, s); - return (BUS_PROBE_DEFAULT); - } - - return (ENXIO); + rpd = PCI_MATCH(dev, rp_devs); + if (rpd == NULL) + return (ENXIO); + device_set_desc(dev, rpd->descr); + return (BUS_PROBE_DEFAULT); } static int @@ -365,3 +365,5 @@ * rp can be attached to a pci bus. */ DRIVER_MODULE(rp, pci, rp_pcidriver, rp_devclass, 0, 0); +PCI_PNP_INFO(rp_devs); + Index: sys/i386/i386/mp_clock.c =================================================================== --- sys/i386/i386/mp_clock.c +++ sys/i386/i386/mp_clock.c @@ -55,6 +55,11 @@ static u_int32_t piix_timecounter_address; static u_int piix_freq = 14318182/4; +struct pci_device_table piix_devs[] = { + {PCI_DEVID(0x71138086), + PCI_DESCR("PIIX Timecounter")} +}; + static struct timecounter piix_timecounter = { piix_get_timecount, /* get_timecount */ 0, /* no poll_pps */ @@ -103,16 +108,14 @@ piix_probe(device_t dev) { u_int32_t d; + const struct pci_device_table *piid; if (devclass_get_device(devclass_find("acpi"), 0) != NULL) return (ENXIO); - switch (pci_get_devid(dev)) { - case 0x71138086: - device_set_desc(dev, "PIIX Timecounter"); - break; - default: + piid = PCI_MATCH(dev, piix_devs); + if (piid == NULL) return (ENXIO); - } + device_set_desc(dev, piid->descr); d = pci_read_config(dev, PCIR_COMMAND, 2); if (!(d & PCIM_CMD_PORTEN)) { @@ -150,3 +153,5 @@ static devclass_t piix_devclass; DRIVER_MODULE(piix, pci, piix_driver, piix_devclass, 0, 0); +PCI_PNP_INFO(piix_devs); + Index: sys/x86/pci/pci_bus.c =================================================================== --- sys/x86/pci/pci_bus.c +++ sys/x86/pci/pci_bus.c @@ -731,6 +731,11 @@ */ static int pcibios_pcib_probe(device_t bus); +struct pci_device_table pcibios_pci_devs[] = { + {PCI_CLASS(PCIC_BRIDGE), PCI_SUBCLASS(PCIS_BRIDGE_PCI), + PCI_DESCR("PCIBIOS PCI-PCI bridge")} +}; + static device_method_t pcibios_pcib_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, pcibios_pcib_probe), @@ -743,25 +748,28 @@ static devclass_t pcib_devclass; -DEFINE_CLASS_1(pcib, pcibios_pcib_driver, pcibios_pcib_pci_methods, - sizeof(struct pcib_softc), pcib_driver); -DRIVER_MODULE(pcibios_pcib, pci, pcibios_pcib_driver, pcib_devclass, 0, 0); -ISA_PNP_INFO(pcibus_pnp_ids); static int pcibios_pcib_probe(device_t dev) { int bus; + const struct pci_device_table *pcibid; - if ((pci_get_class(dev) != PCIC_BRIDGE) || - (pci_get_subclass(dev) != PCIS_BRIDGE_PCI)) + pcibid = PCI_MATCH(dev, pcibios_pci_devs); + if (pcibid == NULL) return (ENXIO); bus = pci_read_config(dev, PCIR_SECBUS_1, 1); if (bus == 0) return (ENXIO); if (!pci_pir_probe(bus, 1)) return (ENXIO); - device_set_desc(dev, "PCIBIOS PCI-PCI bridge"); + device_set_desc(dev, pcibid->descr); return (-2000); } + +DEFINE_CLASS_1(pcib, pcibios_pcib_driver, pcibios_pcib_pci_methods, + sizeof(struct pcib_softc), pcib_driver); +DRIVER_MODULE(pcibios_pcib, pci, pcibios_pcib_driver, pcib_devclass, 0, 0); +PCI_PNP_INFO(pcibios_pci_devs); +ISA_PNP_INFO(pcibus_pnp_ids); #endif