summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2001-08-25 12:48:36 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2001-08-25 12:48:36 +0000
commitb1742ea4018a820ce6afcdc49e4f07f2ac708605 (patch)
tree986057a118f44e0d1d27482a80a433d271990c81
parent7537f4aa40390ccd31a691be2e05d337a9fdea68 (diff)
Allow machdep code to decide the order in which we probe the
pci buses. this is conditional on __PCI_BUS_DEVORDER and __PCI_DEV_FUNCORDER Used by sparc64.
-rw-r--r--sys/dev/pci/pci.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index 41f5dadbd22..239e31e7a65 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci.c,v 1.21 2001/07/20 05:56:25 csapuntz Exp $ */
+/* $OpenBSD: pci.c,v 1.22 2001/08/25 12:48:35 art Exp $ */
/* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */
/*
@@ -131,6 +131,14 @@ pciattach(parent, self, aux)
#ifdef USER_PCICONF
struct pci_softc *sc = (struct pci_softc *)self;
#endif
+#ifdef __PCI_BUS_DEVORDER
+ char devs[32];
+ int i;
+#endif
+#ifdef __PCI_DEV_FUNCORDER
+ char funcs[8];
+ int j;
+#endif
pci_attach_hook(parent, self, pba);
printf("\n");
@@ -148,7 +156,12 @@ pciattach(parent, self, aux)
if (bus == 0)
pci_isa_bridge_callback = NULL;
+#ifdef __PCI_BUS_DEVORDER
+ pci_bus_devorder(pc, bus, devs);
+ for (i = 0; (device = devs[i]) < 32 && device >= 0; i++) {
+#else
for (device = 0; device < maxndevs; device++) {
+#endif
pcitag_t tag;
pcireg_t id, class, intr, bhlcr;
struct pci_attach_args pa;
@@ -167,7 +180,13 @@ pciattach(parent, self, aux)
bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG);
nfunctions = PCI_HDRTYPE_MULTIFN(bhlcr) ? 8 : 1;
+#ifdef __PCI_DEV_FUNCORDER
+ pci_dev_funcorder(pc, bus, device, funcs);
+ for (j = 0; (function = funcs[j]) < nfunctions &&
+ function >= 0; j++) {
+#else
for (function = 0; function < nfunctions; function++) {
+#endif
tag = pci_make_tag(pc, bus, device, function);
id = pci_conf_read(pc, tag, PCI_ID_REG);