summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2006-06-02 19:58:35 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2006-06-02 19:58:35 +0000
commit5b53586656af78db5f7c676cdc57e76baafb8fef (patch)
treebcb9786c5daf53de83f117b3cc8970a1bd037e04 /sys/arch
parent58677725a689f4e53c792c72a130d78e5c0aaf75 (diff)
When trying to find leaf lebuffer devices, to work around broken old PROMs,
walk the lebuffer_cd device list, instead of the sbus children list.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/sparc/dev/if_le.c25
1 files changed, 10 insertions, 15 deletions
diff --git a/sys/arch/sparc/dev/if_le.c b/sys/arch/sparc/dev/if_le.c
index f7c7ef6045e..87fcce9b9b1 100644
--- a/sys/arch/sparc/dev/if_le.c
+++ b/sys/arch/sparc/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.26 2005/04/19 21:30:19 miod Exp $ */
+/* $OpenBSD: if_le.c,v 1.27 2006/06/02 19:58:32 miod Exp $ */
/* $NetBSD: if_le.c,v 1.50 1997/09/09 20:54:48 pk Exp $ */
/*-
@@ -458,22 +458,17 @@ leattach(parent, self, aux)
if (lebufchild) {
lebuf = (struct lebuf_softc *)parent;
} else if (sbuschild) {
- struct sbus_softc *sbus = (struct sbus_softc *)parent;
- struct sbusdev *sd;
+ extern struct cfdriver lebuffer_cd;
+ struct lebuf_softc *lebufsc;
+ int i;
- /*
- * Find last "unallocated" lebuffer and pair it with
- * this `le' device on the assumption that we're on
- * a pre-historic ROM that doesn't establish le<=>lebuffer
- * parent-child relationships.
- */
- for (sd = sbus->sc_sbdev; sd != NULL; sd = sd->sd_bchain) {
- if (strncmp("lebuffer", sd->sd_dev->dv_xname, 8) != 0)
+ for (i = 0; i < lebuffer_cd.cd_ndevs; i++) {
+ lebufsc = (struct lebuf_softc *)lebuffer_cd.cd_devs[i];
+ if (lebufsc == NULL || lebufsc->attached != 0)
continue;
- if (((struct lebuf_softc *)sd->sd_dev)->attached == 0) {
- lebuf = (struct lebuf_softc *)sd->sd_dev;
- break;
- }
+
+ lebuf = lebufsc;
+ break;
}
}
if (lebuf != NULL) {