Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Fix the semantics of __PCI_DEV_FUNCORDER so that they're...
details: https://anonhg.NetBSD.org/src/rev/fbe647ba5d85
branches: trunk
changeset: 516155:fbe647ba5d85
user: thorpej <thorpej%NetBSD.org@localhost>
date: Wed Oct 17 22:16:41 2001 +0000
description:
Fix the semantics of __PCI_DEV_FUNCORDER so that they're actually useful:
If __PCI_DEV_FUNCORDER is defined, don't do the song-and-dance to check if
a device is multi-function; machdep code is going to tell us exactly which
functions to probe.
Note this required changing how pci_func_devorder() works in the
sparc64 PCI machdep code; now the "curnode" is assumed to point
to the bus, rather than some function (typically 0) on the device,
just as pci_bus_devorder() makes that assumption.
All this should allow the PCI code to actually locate the second
HME device on a Sun Netra t1, which is at 3,1 -- previously, the
PCI code would have missed it because there is no device at 3,0.
(Sun deserves a brick to the head for this one -- this seems clearly
out of line with the PCI spec.)
diffstat:
sys/arch/sparc64/dev/pci_machdep.c | 15 ++++++++-------
sys/dev/pci/pci.c | 11 ++++++++---
2 files changed, 16 insertions(+), 10 deletions(-)
diffs (78 lines):
diff -r 0a21e94d9f70 -r fbe647ba5d85 sys/arch/sparc64/dev/pci_machdep.c
--- a/sys/arch/sparc64/dev/pci_machdep.c Wed Oct 17 22:13:04 2001 +0000
+++ b/sys/arch/sparc64/dev/pci_machdep.c Wed Oct 17 22:16:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep.c,v 1.24 2001/09/15 19:32:14 mrg Exp $ */
+/* $NetBSD: pci_machdep.c,v 1.25 2001/10/17 22:16:41 thorpej Exp $ */
/*
* Copyright (c) 1999, 2000 Matthew R. Green
@@ -171,13 +171,14 @@
}
#endif
/*
- * Functions are siblings. Presumably we're only called when the
- * first instance of this device is detected, so we should be able to
- * get to all the other functions with OF_peer(). But there seems
- * some issues with this scheme, so we always go to the first node on
- * this bus segment for a scan.
+ * Initially, curnode is the root of the pci tree. As we
+ * attach bridges, curnode should be set to that of the bridge.
+ *
+ * Note this search is almost exactly the same as pci_bus_devorder()'s,
+ * except that we limit the search to only those with a matching
+ * "device" number.
*/
- for (node = OF_child(OF_parent(node)); node; node = OF_peer(node)) {
+ for (node = OF_child(node); node; node = OF_peer(node)) {
len = OF_getproplen(node, "reg");
if (len < sizeof(reg))
continue;
diff -r 0a21e94d9f70 -r fbe647ba5d85 sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c Wed Oct 17 22:13:04 2001 +0000
+++ b/sys/dev/pci/pci.c Wed Oct 17 22:16:41 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci.c,v 1.56 2001/09/13 21:49:40 thorpej Exp $ */
+/* $NetBSD: pci.c,v 1.57 2001/10/17 22:16:41 thorpej Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998
@@ -127,7 +127,6 @@
struct pci_softc *sc = (struct pci_softc *)self;
bus_space_tag_t iot, memt;
pci_chipset_tag_t pc;
- const struct pci_quirkdata *qd;
int bus, device, function, nfunctions, ret;
#ifdef __PCI_BUS_DEVORDER
char devs[32];
@@ -136,6 +135,8 @@
#ifdef __PCI_DEV_FUNCORDER
char funcs[8];
int j;
+#else
+ const struct pci_quirkdata *qd;
#endif
iot = sc->sc_iot;
@@ -154,6 +155,10 @@
struct pci_attach_args pa;
int pin;
+#ifdef __PCI_DEV_FUNCORDER
+ pci_dev_funcorder(sc->sc_pc, sc->sc_bus, device, funcs);
+ nfunctions = 8;
+#else
tag = pci_make_tag(pc, bus, device, 0);
id = pci_conf_read(pc, tag, PCI_ID_REG);
@@ -173,9 +178,9 @@
nfunctions = 8;
else
nfunctions = 1;
+#endif /* __PCI_DEV_FUNCORDER */
#ifdef __PCI_DEV_FUNCORDER
- pci_dev_funcorder(sc->sc_pc, sc->sc_bus, device, funcs);
for (j = 0; (function = funcs[j]) < nfunctions &&
function >= 0; j++)
#else
Home |
Main Index |
Thread Index |
Old Index