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_vr.c | |
parent | f8eb256c65fe796edfbbb90ae32c5502ca585795 (diff) |
Add a simplistic table driven lookup routine and use it where appropriate.
Diffstat (limited to 'sys/dev/pci/if_vr.c')
-rw-r--r-- | sys/dev/pci/if_vr.c | 32 |
1 files changed, 11 insertions, 21 deletions
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]))); } /* |