diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-11-19 18:40:18 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-11-19 18:40:18 +0000 |
commit | 6de774d6cba7e3cd5ab65ca8bd33d4e854d185ac (patch) | |
tree | e947e412c38cb1b45d34a5c858acb00564f371df /sys/dev/pci/if_xl_pci.c | |
parent | f8eb256c65fe796edfbbb90ae32c5502ca585795 (diff) |
Add a simplistic table driven lookup routine and use it where appropriate.
Diffstat (limited to 'sys/dev/pci/if_xl_pci.c')
-rw-r--r-- | sys/dev/pci/if_xl_pci.c | 57 |
1 files changed, 26 insertions, 31 deletions
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 |