diff options
author | 2002-11-19 18:40:16 +0000 | |
---|---|---|
committer | 2002-11-19 18:40:16 +0000 | |
commit | 6f90920fe77d3de38f5477a4106b971292dc022e (patch) | |
tree | 185d19f885892062002712c79fc874f91872a057 /sys/dev/pci/adv_pci.c | |
parent | Use queue.h macros instead of using the structure names directly. (diff) | |
download | wireguard-openbsd-6f90920fe77d3de38f5477a4106b971292dc022e.tar.xz wireguard-openbsd-6f90920fe77d3de38f5477a4106b971292dc022e.zip |
Add a simplistic table driven lookup routine and use it where appropriate.
Diffstat (limited to 'sys/dev/pci/adv_pci.c')
-rw-r--r-- | sys/dev/pci/adv_pci.c | 21 |
1 files changed, 9 insertions, 12 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]))); } |