diff options
author | Jason Wright <jason@cvs.openbsd.org> | 2002-04-04 17:11:47 +0000 |
---|---|---|
committer | Jason Wright <jason@cvs.openbsd.org> | 2002-04-04 17:11:47 +0000 |
commit | c539c2cb7d21d49c93dbb6793e3ac46e6aa43568 (patch) | |
tree | 9ac8fbf25bff67c6a84ec228f3b012d6f8e16345 /sys | |
parent | 1acf3ae37e5c710dec3dc91aa3ed79eeda663e9f (diff) |
Catch broken devices on sparc64 (where broken == devices that don't have
a function 0). Many thanks to Joey Coleman <joeycoleman@acm.org> for
fixing this.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/pci.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index a12bbde504d..2cc0be21242 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pci.c,v 1.28 2002/03/27 15:10:44 jason Exp $ */ +/* $OpenBSD: pci.c,v 1.29 2002/04/04 17:11:46 jason Exp $ */ /* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */ /* @@ -169,13 +169,33 @@ pciattach(parent, self, aux) for (device = 0; device < maxndevs; device++) { #endif pcitag_t tag; - pcireg_t id, class, intr, bhlcr; + pcireg_t id, class, intr; +#ifndef __sparc64__ + pcireg_t bhlcr; +#endif struct pci_attach_args pa; int pin; tag = pci_make_tag(pc, bus, device, 0); id = pci_conf_read(pc, tag, PCI_ID_REG); +#ifdef __sparc64__ + pci_dev_funcorder(pc, bus, device, funcs); + nfunctions = 8; + + /* Invalid vendor ID value or 0 (see below for zero) + * ... of course, if the pci_dev_funcorder found + * functions other than zero, we probably want + * to attach them. + */ + if (PCI_VENDOR(id) == PCI_VENDOR_INVALID || PCI_VENDOR(id) == 0) + if (funcs[0] < 0) + continue; + + for (j = 0; (function = funcs[j]) < nfunctions && + function >= 0; j++) { +#else + /* Invalid vendor ID value? */ if (PCI_VENDOR(id) == PCI_VENDOR_INVALID) continue; @@ -193,6 +213,7 @@ pciattach(parent, self, aux) #else for (function = 0; function < nfunctions; function++) { #endif +#endif tag = pci_make_tag(pc, bus, device, function); id = pci_conf_read(pc, tag, PCI_ID_REG); |