diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-06-26 01:51:00 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-06-26 01:51:00 +0000 |
commit | 2942212fa482ee088a3abddbee64d901b6211c8a (patch) | |
tree | fdcedc2a613da4abaa38061a42fa657c9a518423 | |
parent | 3fbd987175866559300504171fc177d64f9c0b7c (diff) |
check for invalid and empty slots by name
-rw-r--r-- | sys/dev/pci/pci.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 83b98d0e78c..1d75af323a2 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.11 1998/01/20 18:40:34 niklas Exp $ */ +/* $OpenBSD: pci.c,v 1.12 1998/06/26 01:50:59 deraadt Exp $ */ /* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */ /* @@ -41,6 +41,7 @@ #include <dev/pci/pcireg.h> #include <dev/pci/pcivar.h> +#include <dev/pci/pcidevs.h> int pcimatch __P((struct device *, void *, void *)); void pciattach __P((struct device *, struct device *, void *)); @@ -137,7 +138,12 @@ pciattach(parent, self, aux) tag = pci_make_tag(pc, bus, device, 0); id = pci_conf_read(pc, tag, PCI_ID_REG); - if (id == 0 || id == 0xffffffff) + + /* Invalid vendor ID value? */ + if (PCI_VENDOR(id) == PCI_VENDOR_INVALID) + continue; + /* XXX Not invalid, but we've done this ~forever. */ + if (PCI_VENDOR(id) == 0) continue; bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG); @@ -146,8 +152,14 @@ pciattach(parent, self, aux) for (function = 0; function < nfunctions; function++) { tag = pci_make_tag(pc, bus, device, function); id = pci_conf_read(pc, tag, PCI_ID_REG); - if (id == 0 || id == 0xffffffff) + + /* Invalid vendor ID value? */ + if (PCI_VENDOR(id) == PCI_VENDOR_INVALID) continue; + /* XXX Not invalid, but we've done this ~forever. */ + if (PCI_VENDOR(id) == 0) + continue; + class = pci_conf_read(pc, tag, PCI_CLASS_REG); intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG); |