diff options
33 files changed, 349 insertions, 511 deletions
diff --git a/sys/dev/pci/adv_pci.c b/sys/dev/pci/adv_pci.c index 4530e53dc04..e0ed9578d29 100644 --- a/sys/dev/pci/adv_pci.c +++ b/sys/dev/pci/adv_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adv_pci.c,v 1.6 2002/03/14 01:26:58 millert Exp $ */ +/* $OpenBSD: adv_pci.c,v 1.7 2002/11/19 18:40:16 jason Exp $ */ /* $NetBSD: adv_pci.c,v 1.5 1998/09/26 15:52:55 dante Exp $ */ /* @@ -97,6 +97,12 @@ struct cfattach adv_pci_ca = sizeof(ASC_SOFTC), adv_pci_match, adv_pci_attach }; +const struct pci_matchid adv_pci_devices[] = { + { PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_1200A }, + { PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_1200B }, + { PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_ULTRA }, +}; + /******************************************************************************/ /* * Check the slots looking for a board we recognise @@ -108,17 +114,8 @@ adv_pci_match(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADVSYS) - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ADVSYS_1200A: - case PCI_PRODUCT_ADVSYS_1200B: - case PCI_PRODUCT_ADVSYS_ULTRA: - return (1); - } - - return 0; + return (pci_matchbyid((struct pci_attach_args *)aux, adv_pci_devices, + sizeof(adv_pci_devices)/sizeof(adv_pci_devices[0]))); } diff --git a/sys/dev/pci/adw_pci.c b/sys/dev/pci/adw_pci.c index 3a262c46680..d75cea1094b 100644 --- a/sys/dev/pci/adw_pci.c +++ b/sys/dev/pci/adw_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adw_pci.c,v 1.11 2002/03/14 01:26:58 millert Exp $ */ +/* $OpenBSD: adw_pci.c,v 1.12 2002/11/19 18:40:16 jason Exp $ */ /* $NetBSD: adw_pci.c,v 1.7 2000/05/26 15:13:46 dante Exp $ */ /* @@ -85,6 +85,12 @@ struct cfattach adw_pci_ca = sizeof(ADW_SOFTC), adw_pci_match, adw_pci_attach }; +const struct pci_matchid adw_pci_devices[] = { + { PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_WIDE }, + { PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_U2W }, + { PCI_VENDOR_ADVSYS, PCI_PRODUCT_ADVSYS_U3W }, +}; + /******************************************************************************/ /* * Check the slots looking for a board we recognise @@ -97,17 +103,8 @@ adw_pci_match(parent, match, aux) void *match; void *aux; { - struct pci_attach_args *pa = aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADVSYS) - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ADVSYS_WIDE: - case PCI_PRODUCT_ADVSYS_U2W: - case PCI_PRODUCT_ADVSYS_U3W: - return (1); - } - - return 0; + return (pci_matchbyid((struct pci_attach_args *)aux, adw_pci_devices, + sizeof(adw_pci_devices)/sizeof(adw_pci_devices[0]))); } diff --git a/sys/dev/pci/ahc_pci.c b/sys/dev/pci/ahc_pci.c index 9c26a0ab988..7f6843fe39a 100644 --- a/sys/dev/pci/ahc_pci.c +++ b/sys/dev/pci/ahc_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahc_pci.c,v 1.35 2002/07/05 05:41:02 smurph Exp $ */ +/* $OpenBSD: ahc_pci.c,v 1.36 2002/11/19 18:40:16 jason Exp $ */ /* $NetBSD: ahc_pci.c,v 1.9 1996/10/21 22:56:24 thorpej Exp $ */ /* @@ -156,60 +156,50 @@ struct cfattach ahc_pci_ca = { sizeof(struct ahc_softc), ahc_pci_probe, ahc_pci_attach }; +const struct pci_matchid ahc_pci_devices[] = { + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7810 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7850 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7855 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC5900 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC5905 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7860 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940AU }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7870 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2930CU }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3940 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3985 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2944 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_AIC7880 }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940U }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_3940U }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_398XU }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2944U }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_2940UWPro }, + { PCI_VENDOR_ADP, PCI_PRODUCT_ADP_7895 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7890 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_2940U2 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_2930U2 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7892 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_29160 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_19160B }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3950U2B }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3950U2D }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7896 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899B }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899D }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899F }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_AIC7899 }, + { PCI_VENDOR_ADP2, PCI_PRODUCT_ADP2_3960D }, +}; + int ahc_pci_probe(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = aux; - - switch (PCI_VENDOR(pa->pa_id)) { - case PCI_VENDOR_ADP: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ADP_AIC7810: - case PCI_PRODUCT_ADP_AIC7850: - case PCI_PRODUCT_ADP_AIC7855: - case PCI_PRODUCT_ADP_AIC5900: - case PCI_PRODUCT_ADP_AIC5905: - case PCI_PRODUCT_ADP_AIC7860: - case PCI_PRODUCT_ADP_2940AU: - case PCI_PRODUCT_ADP_AIC7870: - case PCI_PRODUCT_ADP_2930CU: - case PCI_PRODUCT_ADP_2940: - case PCI_PRODUCT_ADP_3940: - case PCI_PRODUCT_ADP_3985: - case PCI_PRODUCT_ADP_2944: - case PCI_PRODUCT_ADP_AIC7880: - case PCI_PRODUCT_ADP_2940U: - case PCI_PRODUCT_ADP_3940U: - case PCI_PRODUCT_ADP_398XU: - case PCI_PRODUCT_ADP_2944U: - case PCI_PRODUCT_ADP_2940UWPro: - case PCI_PRODUCT_ADP_7895: - return (1); - } - break; - case PCI_VENDOR_ADP2: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ADP2_AIC7890: - case PCI_PRODUCT_ADP2_2940U2: - case PCI_PRODUCT_ADP2_2930U2: - case PCI_PRODUCT_ADP2_AIC7892: - case PCI_PRODUCT_ADP2_29160: - case PCI_PRODUCT_ADP2_19160B: - case PCI_PRODUCT_ADP2_3950U2B: - case PCI_PRODUCT_ADP2_3950U2D: - case PCI_PRODUCT_ADP2_AIC7896: - case PCI_PRODUCT_ADP2_AIC7899B: - case PCI_PRODUCT_ADP2_AIC7899D: - case PCI_PRODUCT_ADP2_AIC7899F: - case PCI_PRODUCT_ADP2_AIC7899: - case PCI_PRODUCT_ADP2_3960D: - return (1); - } - break; - } - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, ahc_pci_devices, + sizeof(ahc_pci_devices)/sizeof(ahc_pci_devices[0]))); } void diff --git a/sys/dev/pci/autri.c b/sys/dev/pci/autri.c index afbc451b6b7..38fa471d0fe 100644 --- a/sys/dev/pci/autri.c +++ b/sys/dev/pci/autri.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autri.c,v 1.9 2002/10/04 19:55:19 mickey Exp $ */ +/* $OpenBSD: autri.c,v 1.10 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 2001 SOMEYA Yoshihiko and KUROSAWA Takahiro. @@ -469,6 +469,12 @@ autri_flags_codec(void *v) /* * */ +const struct pci_matchid autri_devices[] = { + { PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_4DWAVE_DX }, + { PCI_VENDOR_TRIDENT, PCI_PRODUCT_TRIDENT_4DWAVE_NX }, + { PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7018 }, + { PCI_VENDOR_ALI, PCI_PRODUCT_ALI_M5451 }, +}; int autri_match(parent, match, aux) @@ -476,31 +482,8 @@ autri_match(parent, match, aux) void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *) aux; - - switch (PCI_VENDOR(pa->pa_id)) { - case PCI_VENDOR_TRIDENT: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_TRIDENT_4DWAVE_DX: - case PCI_PRODUCT_TRIDENT_4DWAVE_NX: - return 1; - } - break; - case PCI_VENDOR_SIS: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_SIS_7018: - return 1; - } - break; - case PCI_VENDOR_ALI: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ALI_M5451: - return 1; - } - break; - } - - return 0; + return (pci_matchbyid((struct pci_attach_args *)aux, autri_devices, + sizeof(autri_devices)/sizeof(autri_devices[0]))); } void diff --git a/sys/dev/pci/auvia.c b/sys/dev/pci/auvia.c index 8f4e4d882c7..8d7b02468b1 100644 --- a/sys/dev/pci/auvia.c +++ b/sys/dev/pci/auvia.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auvia.c,v 1.20 2002/06/03 16:19:22 mickey Exp $ */ +/* $OpenBSD: auvia.c,v 1.21 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: auvia.c,v 1.7 2000/11/15 21:06:33 jdolecek Exp $ */ /*- @@ -206,23 +206,16 @@ void auvia_reset_codec(void *); int auvia_waitready_codec(struct auvia_softc *sc); int auvia_waitvalid_codec(struct auvia_softc *sc); +const struct pci_matchid auvia_devices[] = { + { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT82C686A_AC97 }, + { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT8233_AC97 }, +}; int auvia_match(struct device *parent, void *match, void *aux) { - struct pci_attach_args *pa = (struct pci_attach_args *) aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_VIATECH) - return 0; - - switch(PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_VIATECH_VT82C686A_AC97: - return 1; - case PCI_PRODUCT_VIATECH_VT8233_AC97: - return 1; - default: - return 0; - } + return (pci_matchbyid((struct pci_attach_args *)aux, auvia_devices, + sizeof(auvia_devices)/sizeof(auvia_devices[0]))); } diff --git a/sys/dev/pci/bha_pci.c b/sys/dev/pci/bha_pci.c index 1c498f7be95..06a44c5169f 100644 --- a/sys/dev/pci/bha_pci.c +++ b/sys/dev/pci/bha_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bha_pci.c,v 1.2 2002/03/14 01:26:58 millert Exp $ */ +/* $OpenBSD: bha_pci.c,v 1.3 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: bha_pci.c,v 1.16 1998/08/15 10:10:53 mycroft Exp $ */ /*- @@ -63,6 +63,11 @@ struct cfattach bha_pci_ca = { sizeof(struct bha_softc), bha_pci_match, bha_pci_attach }; +const struct pci_matchid bha_pci_devices[] = { + { PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_MULTIMASTER_NC }, + { PCI_VENDOR_BUSLOGIC, PCI_PRODUCT_BUSLOGIC_MULTIMASTER }, +}; + /* * Check the slots looking for a board we recognise * If we find one, note it's address (slot) and call @@ -79,11 +84,8 @@ bha_pci_match(parent, match, aux) bus_size_t iosize; int rv; - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_BUSLOGIC) - return (0); - - if (PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_BUSLOGIC_MULTIMASTER_NC && - PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_BUSLOGIC_MULTIMASTER) + if (pci_matchbyid((struct pci_attach_args *)aux, bha_pci_devices, + sizeof(bha_pci_devices)/sizeof(bha_pci_devices[0])) == 0) return (0); if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, diff --git a/sys/dev/pci/cmpci.c b/sys/dev/pci/cmpci.c index 2c99279b111..ce745f89864 100644 --- a/sys/dev/pci/cmpci.c +++ b/sys/dev/pci/cmpci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmpci.c,v 1.8 2002/03/14 03:16:06 millert Exp $ */ +/* $OpenBSD: cmpci.c,v 1.9 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 2000 Takuya SHIOZAKI @@ -289,6 +289,11 @@ cmpci_index_to_divider(index) return cmpci_rate_table[index].divider; } +const struct pci_matchid cmpci_devices[] = { + { PCI_VENDOR_CMI, PCI_PRODUCT_CMI_CMI8338A }, + { PCI_VENDOR_CMI, PCI_PRODUCT_CMI_CMI8338B }, + { PCI_VENDOR_CMI, PCI_PRODUCT_CMI_CMI8738 }, +}; /* * interface to configure the device. @@ -299,15 +304,8 @@ cmpci_match(parent, match, aux) void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_CMI && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CMI_CMI8338A || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CMI_CMI8338B || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CMI_CMI8738)) - return 1; - - return 0; + return (pci_matchbyid((struct pci_attach_args *)aux, cmpci_devices, + sizeof(cmpci_devices)/sizeof(cmpci_devices[0]))); } void diff --git a/sys/dev/pci/cs4280.c b/sys/dev/pci/cs4280.c index 1f1cd7da894..904613ae5d0 100644 --- a/sys/dev/pci/cs4280.c +++ b/sys/dev/pci/cs4280.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cs4280.c,v 1.15 2002/03/14 03:16:06 millert Exp $ */ +/* $OpenBSD: cs4280.c,v 1.16 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: cs4280.c,v 1.5 2000/06/26 04:56:23 simonb Exp $ */ /* @@ -291,6 +291,12 @@ struct audio_device cs4280_device = { "cs4280" }; +const struct pci_matchid cs4280_devices[] = { + { PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4280 }, + { PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4610 }, + { PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4614 }, + { PCI_VENDOR_CIRRUS, PCI_PRODUCT_CIRRUS_CS4615 }, +}; int cs4280_match(parent, ma, aux) @@ -298,17 +304,8 @@ cs4280_match(parent, ma, aux) void *ma; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_CIRRUS) - return (0); - if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CIRRUS_CS4280 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CIRRUS_CS4610 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CIRRUS_CS4614 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CIRRUS_CS4615) { - return (1); - } - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, cs4280_devices, + sizeof(cs4280_devices)/sizeof(cs4280_devices[0]))); } int diff --git a/sys/dev/pci/cy_pci.c b/sys/dev/pci/cy_pci.c index 9db5c3ee8ac..ca1b3100de6 100644 --- a/sys/dev/pci/cy_pci.c +++ b/sys/dev/pci/cy_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cy_pci.c,v 1.11 2002/09/15 21:30:25 art Exp $ */ +/* $OpenBSD: cy_pci.c,v 1.12 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1996 Timo Rossi. * All rights reserved. @@ -70,33 +70,22 @@ struct cfattach cy_pci_ca = { #define CY_PLX_9060_ICS_IENABLE 0x100 #define CY_PLX_9060_ICS_LOCAL_IENABLE 0x800 +const struct pci_matchid cy_pci_devices[] = { + { PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMY_1 }, + { PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOMY_2 }, + { PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM4Y_1 }, + { PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM4Y_2 }, + { PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM8Y_1 }, + { PCI_VENDOR_CYCLADES, PCI_PRODUCT_CYCLADES_CYCLOM8Y_2 }, +}; + int cy_pci_match(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_CYCLADES) - return (0); - - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_CYCLADES_CYCLOMY_1: - case PCI_PRODUCT_CYCLADES_CYCLOMY_2: - case PCI_PRODUCT_CYCLADES_CYCLOM4Y_1: - case PCI_PRODUCT_CYCLADES_CYCLOM4Y_2: - case PCI_PRODUCT_CYCLADES_CYCLOM8Y_1: - case PCI_PRODUCT_CYCLADES_CYCLOM8Y_2: - break; - default: - return (0); - } - -#ifdef CY_DEBUG - printf("cy: Found Cyclades PCI device, id = 0x%x\n", pa->pa_id); -#endif - - return (1); + return (pci_matchbyid((struct pci_attach_args *)aux, cy_pci_devices, + sizeof(cy_pci_devices)/sizeof(cy_pci_devices[0]))); } void diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c index 3643c48cfda..abac3bf2ac6 100644 --- a/sys/dev/pci/cz.c +++ b/sys/dev/pci/cz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cz.c,v 1.5 2002/01/30 20:45:34 nordin Exp $ */ +/* $OpenBSD: cz.c,v 1.6 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: cz.c,v 1.15 2001/01/20 19:10:36 thorpej Exp $ */ /*- @@ -275,13 +275,9 @@ cz_match(parent, match, aux) { struct pci_attach_args *pa = aux; - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_CYCLADES) { - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_CYCLADES_CYCLOMZ_2: - return (1); - } - } - + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_CYCLADES && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CYCLADES_CYCLOMZ_2) + return (1); return (0); } diff --git a/sys/dev/pci/eap.c b/sys/dev/pci/eap.c index 8224729c71d..7d7970d8950 100644 --- a/sys/dev/pci/eap.c +++ b/sys/dev/pci/eap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: eap.c,v 1.16 2002/01/20 19:56:53 ericj Exp $ */ +/* $OpenBSD: eap.c,v 1.17 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: eap.c,v 1.46 2001/09/03 15:07:37 reinoud Exp $ */ /* @@ -252,29 +252,18 @@ struct audio_device eap_device = { "eap" }; +const struct pci_matchid eap_devices[] = { + { PCI_VENDOR_CREATIVELABS, PCI_PRODUCT_CREATIVELABS_EV1938 }, + { PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_AUDIOPCI }, + { PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_AUDIOPCI97 }, + { PCI_VENDOR_ENSONIQ, PCI_PRODUCT_ENSONIQ_CT5880 }, +}; + int eap_match(struct device *parent, void *match, void *aux) { - struct pci_attach_args *pa = (struct pci_attach_args *) aux; - - switch (PCI_VENDOR(pa->pa_id)) { - case PCI_VENDOR_CREATIVELABS: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_CREATIVELABS_EV1938: - return (1); - } - break; - case PCI_VENDOR_ENSONIQ: - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ENSONIQ_AUDIOPCI: - case PCI_PRODUCT_ENSONIQ_AUDIOPCI97: - case PCI_PRODUCT_ENSONIQ_CT5880: - return (1); - } - break; - } - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, eap_devices, + sizeof(eap_devices)/sizeof(eap_devices[0]))); } void diff --git a/sys/dev/pci/esa.c b/sys/dev/pci/esa.c index 0785f7028f9..16fd07940b1 100644 --- a/sys/dev/pci/esa.c +++ b/sys/dev/pci/esa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esa.c,v 1.4 2002/10/04 20:01:19 mickey Exp $ */ +/* $OpenBSD: esa.c,v 1.5 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: esa.c,v 1.12 2002/03/24 14:17:35 jmcneill Exp $ */ /* @@ -992,23 +992,17 @@ esa_freemem(struct esa_softc *sc, struct esa_dma *p) /* * Supporting Subroutines */ +const struct pci_matchid esa_devices[] = { + { PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_ES1989 }, + { PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO3 }, + { PCI_VENDOR_ESSTECH, PCI_PRODUCT_ESSTECH_MAESTRO3_2 }, +}; int esa_match(struct device *dev, void *match, void *aux) { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - switch(PCI_VENDOR(pa->pa_id)) { - case PCI_VENDOR_ESSTECH: - switch(PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ESSTECH_ES1989: - case PCI_PRODUCT_ESSTECH_MAESTRO3: - case PCI_PRODUCT_ESSTECH_MAESTRO3_2: - return (1); - } - } - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, esa_devices, + sizeof(esa_devices)/sizeof(esa_devices[0]))); } void diff --git a/sys/dev/pci/fms.c b/sys/dev/pci/fms.c index 11871443a38..10d3bc3b270 100644 --- a/sys/dev/pci/fms.c +++ b/sys/dev/pci/fms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fms.c,v 1.13 2002/10/13 18:26:12 krw Exp $ */ +/* $OpenBSD: fms.c,v 1.14 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: fms.c,v 1.5.4.1 2000/06/30 16:27:50 simonb Exp $ */ /*- @@ -166,12 +166,10 @@ fms_match(parent, match, aux) { struct pci_attach_args *pa = (struct pci_attach_args *) aux; - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_FORTEMEDIA) - return 0; - if (PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_FORTEMEDIA_FM801) - return 0; - - return 1; + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_FORTEMEDIA && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_FORTEMEDIA_FM801) + return (1); + return (0); } void diff --git a/sys/dev/pci/hifn7751.c b/sys/dev/pci/hifn7751.c index f7ba7580adf..5be93e94619 100644 --- a/sys/dev/pci/hifn7751.c +++ b/sys/dev/pci/hifn7751.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hifn7751.c,v 1.132 2002/08/01 18:29:59 jason Exp $ */ +/* $OpenBSD: hifn7751.c,v 1.133 2002/11/19 18:40:17 jason Exp $ */ /* * Invertex AEON / Hifn 7751 driver @@ -116,26 +116,22 @@ u_int32_t hifn_read_4(struct hifn_softc *, int, bus_size_t); struct hifn_stats hifnstats; +const struct pci_matchid hifn_devices[] = { + { PCI_VENDOR_INVERTEX, PCI_PRODUCT_INVERTEX_AEON }, + { PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7751 }, + { PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7811 }, + { PCI_VENDOR_HIFN, PCI_PRODUCT_HIFN_7951 }, + { PCI_VENDOR_NETSEC, PCI_PRODUCT_NETSEC_7751 }, +}; + int hifn_probe(parent, match, aux) struct device *parent; void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *) aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_INVERTEX && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_INVERTEX_AEON) - return (1); - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_HIFN && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_HIFN_7751 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_HIFN_7951 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_HIFN_7811)) - return (1); - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NETSEC && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NETSEC_7751) - return (1); - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, hifn_devices, + sizeof(hifn_devices)/sizeof(hifn_devices[0]))); } void diff --git a/sys/dev/pci/i82365_pci.c b/sys/dev/pci/i82365_pci.c index 491758add78..96aa21d3b60 100644 --- a/sys/dev/pci/i82365_pci.c +++ b/sys/dev/pci/i82365_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i82365_pci.c,v 1.6 2002/03/14 01:26:58 millert Exp $ */ +/* $OpenBSD: i82365_pci.c,v 1.7 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: i82365_pci.c,v 1.11 2000/02/24 03:42:44 itohy Exp $ */ /* @@ -91,19 +91,10 @@ pcic_pci_match(parent, match, aux) { struct pci_attach_args *pa = (struct pci_attach_args *) aux; - switch (PCI_VENDOR(pa->pa_id)) { - case PCI_VENDOR_CIRRUS: - switch(PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_CIRRUS_CL_PD6729: - break; - default: - return (0); - } - break; - default: - return (0); - } - return (1); + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_CIRRUS && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CIRRUS_CL_PD6729) + return (1); + return (0); } void pcic_isa_config_interrupts(struct device *); diff --git a/sys/dev/pci/if_an_pci.c b/sys/dev/pci/if_an_pci.c index 58c8cbdd140..e61a22ac7f3 100644 --- a/sys/dev/pci/if_an_pci.c +++ b/sys/dev/pci/if_an_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_an_pci.c,v 1.8 2002/05/22 15:30:36 mickey Exp $ */ +/* $OpenBSD: if_an_pci.c,v 1.9 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -87,22 +87,21 @@ struct cfattach an_pci_ca = { sizeof (struct an_softc), an_pci_match, an_pci_attach }; +const struct pci_matchid an_pci_devices[] = { + { PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PCI352 }, + { PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PC4500 }, + { PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PC4800 }, + { PCI_VENDOR_AIRONET, PCI_PRODUCT_AIRONET_PC4800_1 }, +}; + int an_pci_match(parent, match, aux) struct device *parent; void *match; void *aux; { - struct pci_attach_args *pa = aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_AIRONET && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AIRONET_PCI352 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AIRONET_PC4500 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AIRONET_PC4800 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AIRONET_PC4800_1)) - return(1); - - return(0); + return (pci_matchbyid((struct pci_attach_args *)aux, an_pci_devices, + sizeof(an_pci_devices)/sizeof(an_pci_devices[0]))); } void diff --git a/sys/dev/pci/if_ep_pci.c b/sys/dev/pci/if_ep_pci.c index 6e778e51824..d84f236f330 100644 --- a/sys/dev/pci/if_ep_pci.c +++ b/sys/dev/pci/if_ep_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ep_pci.c,v 1.21 2002/03/14 01:26:58 millert Exp $ */ +/* $OpenBSD: if_ep_pci.c,v 1.22 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: if_ep_pci.c,v 1.13 1996/10/21 22:56:38 thorpej Exp $ */ /* @@ -89,27 +89,20 @@ struct cfattach ep_pci_ca = { sizeof(struct ep_softc), ep_pci_match, ep_pci_attach }; +const struct pci_matchid ep_pci_devices[] = { + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C590 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595MII }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595T4 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C595TX }, +}; + int ep_pci_match(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *) aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_3COM) - return 0; - - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_3COM_3C590: - case PCI_PRODUCT_3COM_3C595MII: - case PCI_PRODUCT_3COM_3C595T4: - case PCI_PRODUCT_3COM_3C595TX: - break; - default: - return 0; - } - - return 1; + return (pci_matchbyid((struct pci_attach_args *)aux, ep_pci_devices, + sizeof(ep_pci_devices)/sizeof(ep_pci_devices[0]))); } void diff --git a/sys/dev/pci/if_fpa.c b/sys/dev/pci/if_fpa.c index e39af4ed7f1..58f007e5ca6 100644 --- a/sys/dev/pci/if_fpa.c +++ b/sys/dev/pci/if_fpa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fpa.c,v 1.20 2002/06/09 03:14:18 todd Exp $ */ +/* $OpenBSD: if_fpa.c,v 1.21 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: if_fpa.c,v 1.15 1996/10/21 22:56:40 thorpej Exp $ */ /*- @@ -94,11 +94,10 @@ pdq_pci_match(parent, match, aux) { struct pci_attach_args *pa = (struct pci_attach_args *)aux; - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_DEC) - return (0); - if (PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_DEC_DEFPA) - return (0); - return (1); + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DEC && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DEC_DEFPA) + return (1); + return (0); } void diff --git a/sys/dev/pci/if_fxp_pci.c b/sys/dev/pci/if_fxp_pci.c index 1519ebb3800..238113c052a 100644 --- a/sys/dev/pci/if_fxp_pci.c +++ b/sys/dev/pci/if_fxp_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_fxp_pci.c,v 1.15 2002/10/04 20:47:25 jason Exp $ */ +/* $OpenBSD: if_fxp_pci.c,v 1.16 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1995, David Greenman @@ -86,6 +86,20 @@ struct cfattach fxp_pci_ca = { sizeof(struct fxp_softc), fxp_pci_match, fxp_pci_attach }; +const struct pci_matchid fxp_pci_devices[] = { + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82557 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82559 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82559ER }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_82562 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_0 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_1 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VE_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_0 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_1 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_2 }, + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_PRO_100_VM_3 }, +}; + /* * Check if a device is an 82557. */ @@ -95,27 +109,8 @@ fxp_pci_match(parent, match, aux) void *match; void *aux; { - struct pci_attach_args *pa = aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_INTEL) - return (0); - - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_INTEL_82557: - case PCI_PRODUCT_INTEL_82559: - case PCI_PRODUCT_INTEL_82559ER: - case PCI_PRODUCT_INTEL_82562: - case PCI_PRODUCT_INTEL_PRO_100_VE_0: - case PCI_PRODUCT_INTEL_PRO_100_VE_1: - case PCI_PRODUCT_INTEL_PRO_100_VE_2: - case PCI_PRODUCT_INTEL_PRO_100_VM_0: - case PCI_PRODUCT_INTEL_PRO_100_VM_1: - case PCI_PRODUCT_INTEL_PRO_100_VM_2: - case PCI_PRODUCT_INTEL_PRO_100_VM_3: - return (1); - } - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, fxp_pci_devices, + sizeof(fxp_pci_devices)/sizeof(fxp_pci_devices[0]))); } void diff --git a/sys/dev/pci/if_gem_pci.c b/sys/dev/pci/if_gem_pci.c index bf178532c69..e4961306027 100644 --- a/sys/dev/pci/if_gem_pci.c +++ b/sys/dev/pci/if_gem_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_gem_pci.c,v 1.10 2002/07/26 20:36:41 drahn Exp $ */ +/* $OpenBSD: if_gem_pci.c,v 1.11 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: if_gem_pci.c,v 1.1 2001/09/16 00:11:42 eeh Exp $ */ /* @@ -95,26 +95,21 @@ struct cfattach gem_pci_ca = { * Attach routines need to be split out to different bus-specific files. */ +const struct pci_matchid gem_pci_devices[] = { + { PCI_VENDOR_SUN, PCI_PRODUCT_SUN_ERINETWORK }, + { PCI_VENDOR_SUN, PCI_PRODUCT_SUN_GEMNETWORK }, + { PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GMAC }, + { PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GMAC2 }, + { PCI_VENDOR_APPLE, PCI_PRODUCT_APPLE_GMAC3 }, + int gem_match_pci(parent, cf, aux) struct device *parent; void *cf; void *aux; { - struct pci_attach_args *pa = aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SUN && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_ERINETWORK || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_GEMNETWORK)) - return (1); - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_APPLE && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_GMAC || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_GMAC2 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_APPLE_GMAC3)) - return (1); - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, gem_pci_devices, + sizeof(gem_pci_devices)/sizeof(gem_pci_devices[0]))); } void diff --git a/sys/dev/pci/if_rl_pci.c b/sys/dev/pci/if_rl_pci.c index 6e0631b9d7e..41f895e90ac 100644 --- a/sys/dev/pci/if_rl_pci.c +++ b/sys/dev/pci/if_rl_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rl_pci.c,v 1.7 2002/03/14 01:26:59 millert Exp $ */ +/* $OpenBSD: if_rl_pci.c,v 1.8 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998 @@ -90,15 +90,14 @@ struct cfattach rl_pci_ca = { sizeof(struct rl_softc), rl_pci_match, rl_pci_attach, }; -struct rl_type rl_pci_devs[] = { - { PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_5030 }, - { PCI_VENDOR_ADDTRON, PCI_PRODUCT_ADDTRON_8139 }, - { PCI_VENDOR_DELTA, PCI_PRODUCT_DELTA_8139 }, - { PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_530TXPLUS }, - { PCI_VENDOR_NORTEL, PCI_PRODUCT_NORTEL_BS21 }, - { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129 }, - { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139 }, - { 0, 0 } +const struct pci_matchid rl_pci_devices[] = { + { PCI_VENDOR_ACCTON, PCI_PRODUCT_ACCTON_5030 }, + { PCI_VENDOR_ADDTRON, PCI_PRODUCT_ADDTRON_8139 }, + { PCI_VENDOR_DELTA, PCI_PRODUCT_DELTA_8139 }, + { PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_530TXPLUS }, + { PCI_VENDOR_NORTEL, PCI_PRODUCT_NORTEL_BS21 }, + { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8129 }, + { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8139 }, }; int @@ -107,15 +106,8 @@ rl_pci_match(parent, match, aux) void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - struct rl_type *t; - - for (t = rl_pci_devs; t->rl_vid != 0; t++) { - if ((PCI_VENDOR(pa->pa_id) == t->rl_vid) && - (PCI_PRODUCT(pa->pa_id) == t->rl_did)) - return (1); - } - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, rl_pci_devices, + sizeof(rl_pci_devices)/sizeof(rl_pci_devices[0]))); } void diff --git a/sys/dev/pci/if_sf.c b/sys/dev/pci/if_sf.c index 0a6995a1c33..45a2dd2e275 100644 --- a/sys/dev/pci/if_sf.c +++ b/sys/dev/pci/if_sf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sf.c,v 1.17 2002/03/14 01:26:59 millert Exp $ */ +/* $OpenBSD: if_sf.c,v 1.18 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -588,13 +588,9 @@ int sf_probe(parent, match, aux) { struct pci_attach_args *pa = (struct pci_attach_args *)aux; - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_ADP) - return(0); - - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_ADP_AIC6915: + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADP && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADP_AIC6915) return(1); - } return(0); } diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index abab8794068..abe52794e9d 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.27 2002/07/31 16:58:20 jason Exp $ */ +/* $OpenBSD: if_sis.c,v 1.28 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -604,6 +604,12 @@ void sis_reset(sc) return; } +const struct pci_matchid sis_devices[] = { + { PCI_VENDOR_SIS, PCI_PRODUCT_SIS_900 }, + { PCI_VENDOR_SIS, PCI_PRODUCT_SIS_7016 }, + { PCI_VENDOR_NS, PCI_PRODUCT_NS_DP83815 }, +}; + /* * Probe for an SiS chip. Check the PCI vendor and device * IDs against our list and return a device name if we find a match. @@ -613,21 +619,8 @@ int sis_probe(parent, match, aux) void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_SIS && - PCI_VENDOR(pa->pa_id) != PCI_VENDOR_NS) - return(0); - - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_SIS_900: - case PCI_PRODUCT_SIS_7016: - case PCI_PRODUCT_NS_DP83815: - return(1); - } - - return(0); - + return (pci_matchbyid((struct pci_attach_args *)aux, sis_devices, + sizeof(sis_devices)/sizeof(sis_devices[0]))); } /* diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index 5ac41f28971..7ceb645127d 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.16 2002/03/14 01:26:59 millert Exp $ */ +/* $OpenBSD: if_ste.c,v 1.17 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -827,6 +827,10 @@ void ste_stats_update(xsc) return; } +const struct pci_matchid ste_devices[] = { + { PCI_VENDOR_SUNDANCE, PCI_PRODUCT_SUNDANCE_ST201 }, + { PCI_VENDOR_DLINK, PCI_PRODUCT_DLINK_550TX }, +}; /* * Probe for a Sundance ST201 chip. Check the PCI vendor and device @@ -836,17 +840,8 @@ int ste_probe(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SUNDANCE && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUNDANCE_ST201) - return(1); - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DLINK && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DLINK_550TX) - return(1); - - return(0); + return (pci_matchbyid((struct pci_attach_args *)aux, ste_devices, + sizeof(ste_devices)/sizeof(ste_devices[0]))); } /* diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index cba863a0a43..8aca9b39d64 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.38 2002/10/03 23:50:07 jason Exp $ */ +/* $OpenBSD: if_ti.c,v 1.39 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1422,6 +1422,16 @@ int ti_gibinit(sc) return(0); } +const struct pci_matchid ti_devices[] = { + { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620 }, + { PCI_VENDOR_NETGEAR, PCI_PRODUCT_NETGEAR_GA620T }, + { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENIC }, + { PCI_VENDOR_ALTEON, PCI_PRODUCT_ALTEON_ACENICT }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C985 }, + { PCI_VENDOR_SGI, PCI_PRODUCT_SGI_TIGON }, + { PCI_VENDOR_DEC, PCI_PRODUCT_DEC_PN9000SX }, +}; + /* * Probe for a Tigon chip. Check the PCI vendor and device IDs * against our list and return its name if we find a match. @@ -1432,32 +1442,8 @@ ti_probe(parent, match, aux) void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_NETGEAR && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NETGEAR_GA620 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_NETGEAR_GA620T)) - return (1); - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ALTEON && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALTEON_ACENIC || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ALTEON_ACENICT)) - return (1); - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_3COM && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_3COM_3C985) - return (1); - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SGI && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SGI_TIGON) - return (1); - - /* This is really a Farallon board, they used the wrong vendorid */ - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DEC && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DEC_PN9000SX) - return (1); - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, ti_devices, + sizeof(ti_devices)/sizeof(ti_devices[0]))); } diff --git a/sys/dev/pci/if_tx.c b/sys/dev/pci/if_tx.c index f766b3ae2d5..508d8403c62 100644 --- a/sys/dev/pci/if_tx.c +++ b/sys/dev/pci/if_tx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tx.c,v 1.24 2002/11/14 07:35:18 kjc Exp $ */ +/* $OpenBSD: if_tx.c,v 1.25 2002/11/19 18:40:17 jason Exp $ */ /* $FreeBSD: src/sys/pci/if_tx.c,v 1.45 2001/02/07 20:11:02 semenu Exp $ */ /*- @@ -205,13 +205,11 @@ epic_openbsd_probe( void *aux ) { struct pci_attach_args *pa = aux; - if( PCI_VENDOR(pa->pa_id) != SMC_VENDORID ) - return 0; - - if( PCI_PRODUCT(pa->pa_id) == SMC_DEVICEID_83C170 ) - return 1; - return 0; + if (PCI_VENDOR(pa->pa_id) == SMC_VENDORID && + PCI_PRODUCT(pa->pa_id) == SMC_DEVICEID_83C170) + return (1); + return (0); } void diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 1243c0ac935..94fcd01fefb 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.66 2002/07/11 20:27:04 jason Exp $ */ +/* $OpenBSD: if_txp.c,v 1.67 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 2001 @@ -144,27 +144,22 @@ struct cfdriver txp_cd = { 0, "txp", DV_IFNET }; +const struct pci_matchid txp_devices[] = { + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990TX95 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990TX97 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990SVR95 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CR990SVR97 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C990BTXM }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C990BSVR }, +}; + int txp_probe(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_3COM) - return (0); - - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_3COM_3CR990TX95: - case PCI_PRODUCT_3COM_3CR990TX97: - case PCI_PRODUCT_3COM_3CR990SVR95: - case PCI_PRODUCT_3COM_3CR990SVR97: - case PCI_PRODUCT_3COM_3C990BTXM: - case PCI_PRODUCT_3COM_3C990BSVR: - return (1); - } - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, txp_devices, + sizeof(txp_devices)/sizeof(txp_devices[0]))); } void diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index b6415657b0b..80fd9e1ed27 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.26 2002/05/14 16:54:45 millert Exp $ */ +/* $OpenBSD: if_vr.c,v 1.27 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998 @@ -555,6 +555,14 @@ vr_reset(sc) return; } +const struct pci_matchid vr_devices[] = { + { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_RHINE }, + { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_RHINEII }, + { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_RHINEII_2 }, + { PCI_VENDOR_DELTA, PCI_PRODUCT_DELTA_RHINEII }, + { PCI_VENDOR_ADDTRON, PCI_PRODUCT_ADDTRON_RHINEII }, +}; + /* * Probe for a VIA Rhine chip. */ @@ -563,26 +571,8 @@ vr_probe(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_VIATECH) { - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_VIATECH_RHINE: - case PCI_PRODUCT_VIATECH_RHINEII: - case PCI_PRODUCT_VIATECH_RHINEII_2: - return (1); - } - } - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DELTA && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DELTA_RHINEII) - return (1); - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADDTRON && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADDTRON_RHINEII) - return (1); - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, vr_devices, + sizeof(vr_devices)/sizeof(vr_devices[0]))); } /* diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 4f5d67211e9..1f4d8b53fbf 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.18 2002/07/05 13:48:11 aaron Exp $ */ +/* $OpenBSD: if_wb.c,v 1.19 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998 @@ -708,6 +708,11 @@ wb_fixmedia(sc) ifmedia_set(&mii->mii_media, media); } +const struct pci_matchid wb_devices[] = { + { PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C840F }, + { PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_RL100ATX }, +}; + /* * Probe for a Winbond chip. Check the PCI vendor and device * IDs against our list and return a device name if we find a match. @@ -717,23 +722,8 @@ wb_probe(parent, match, aux) struct device *parent; void *match, *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_WINBOND) { - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_WINBOND_W89C840F: - return (1); - } - } - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_COMPEX) { - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_COMPEX_RL100ATX: - return (1); - } - } - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, wb_devices, + sizeof(wb_devices)/sizeof(wb_devices[0]))); } /* diff --git a/sys/dev/pci/if_xl_pci.c b/sys/dev/pci/if_xl_pci.c index 037be8c2ece..715fe998379 100644 --- a/sys/dev/pci/if_xl_pci.c +++ b/sys/dev/pci/if_xl_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_xl_pci.c,v 1.12 2002/06/15 05:14:41 aaron Exp $ */ +/* $OpenBSD: if_xl_pci.c,v 1.13 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -99,42 +99,37 @@ struct cfattach xl_pci_ca = { sizeof(struct xl_softc), xl_pci_match, xl_pci_attach, }; +const struct pci_matchid xl_pci_devices[] = { + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3CSOHO100TX }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900TPO }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900COMBO }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900B }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BCOMBO }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BTPC }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C900BFL }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905TX }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905T4 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BTX }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BT4 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BCOMBO }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905BFX }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C980TX }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C980CTX }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C905CTX }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C450 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C555 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C556 }, + { PCI_VENDOR_3COM, PCI_PRODUCT_3COM_3C556B }, +}; + int xl_pci_match(parent, match, aux) struct device *parent; void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *) aux; - - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_3COM) - return (0); - - switch (PCI_PRODUCT(pa->pa_id)) { - case PCI_PRODUCT_3COM_3CSOHO100TX: - case PCI_PRODUCT_3COM_3C900TPO: - case PCI_PRODUCT_3COM_3C900COMBO: - case PCI_PRODUCT_3COM_3C900B: - case PCI_PRODUCT_3COM_3C900BCOMBO: - case PCI_PRODUCT_3COM_3C900BTPC: - case PCI_PRODUCT_3COM_3C900BFL: - case PCI_PRODUCT_3COM_3C905TX: - case PCI_PRODUCT_3COM_3C905T4: - case PCI_PRODUCT_3COM_3C905BTX: - case PCI_PRODUCT_3COM_3C905BT4: - case PCI_PRODUCT_3COM_3C905BCOMBO: - case PCI_PRODUCT_3COM_3C905BFX: - case PCI_PRODUCT_3COM_3C980TX: - case PCI_PRODUCT_3COM_3C980CTX: - case PCI_PRODUCT_3COM_3C905CTX: - case PCI_PRODUCT_3COM_3C450: - case PCI_PRODUCT_3COM_3C555: - case PCI_PRODUCT_3COM_3C556: - case PCI_PRODUCT_3COM_3C556B: - return (1); - } - - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, xl_pci_devices, + sizeof(xl_pci_devices)/sizeof(xl_pci_devices[0]))); } void diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 2cc0be21242..3fc327d3787 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.29 2002/04/04 17:11:46 jason Exp $ */ +/* $OpenBSD: pci.c,v 1.30 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */ /* @@ -387,6 +387,20 @@ pci_get_capability(pc, tag, capid, offset, value) return (0); } +int +pci_matchbyid(struct pci_attach_args *pa, const struct pci_matchid *ids, + int nent) +{ + const struct pci_matchid *pm; + int i; + + for (i = 0, pm = ids; i < nent; i++, pm++) + if (PCI_VENDOR(pa->pa_id) == pm->pm_vid && + PCI_PRODUCT(pa->pa_id) == pm->pm_pid) + return (1); + return (0); +} + #ifdef USER_PCICONF /* * This is the user interface to PCI configuration space. diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index dc68945d121..b3682aa6f1b 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcivar.h,v 1.25 2002/07/12 20:17:03 mickey Exp $ */ +/* $OpenBSD: pcivar.h,v 1.26 2002/11/19 18:40:17 jason Exp $ */ /* $NetBSD: pcivar.h,v 1.23 1997/06/06 23:48:05 thorpej Exp $ */ /* @@ -182,6 +182,13 @@ int pci_mem_find(pci_chipset_tag_t, pcitag_t, int, bus_addr_t *, int pci_get_capability(pci_chipset_tag_t, pcitag_t, int, int *, pcireg_t *); +struct pci_matchid { + pci_vendor_id_t pm_vid; + pci_product_id_t pm_pid; +}; + +int pci_matchbyid(struct pci_attach_args *, const struct pci_matchid *, int); + /* * Helper functions for autoconfiguration. */ diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index d35d4ef0c99..187ed180ea9 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ubsec.c,v 1.118 2002/10/12 01:09:44 krw Exp $ */ +/* $OpenBSD: ubsec.c,v 1.119 2002/11/19 18:40:17 jason Exp $ */ /* * Copyright (c) 2000 Jason L. Wright (jason@thought.net) @@ -132,30 +132,26 @@ void ubsec_dump_ctx2(struct ubsec_ctx_keyop *); struct ubsec_stats ubsecstats; +const struct pci_matchid ubsec_devices[] = { + { PCI_VENDOR_BLUESTEEL, PCI_PRODUCT_BLUESTEEL_5501 }, + { PCI_VENDOR_BLUESTEEL, PCI_PRODUCT_BLUESTEEL_5601 }, + { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5801 }, + { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5802 }, + { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5805 }, + { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5820 }, + { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5821 }, + { PCI_VENDOR_BROADCOM, PCI_PRODUCT_BROADCOM_5822 }, + { PCI_VENDOR_SUN, PCI_PRODUCT_SUN_SCA1K }, +}; + int ubsec_probe(parent, match, aux) struct device *parent; void *match; void *aux; { - struct pci_attach_args *pa = (struct pci_attach_args *)aux; - - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_BLUESTEEL && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BLUESTEEL_5501 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BLUESTEEL_5601)) - return (1); - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_BROADCOM && - (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_5801 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_5802 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_5805 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_5820 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_5821 || - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_5822)) - return (1); - if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_SUN && - PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_SUN_SCA1K) - return (1); - return (0); + return (pci_matchbyid((struct pci_attach_args *)aux, ubsec_devices, + sizeof(ubsec_devices)/sizeof(ubsec_devices[0]))); } void |