summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/sparc/dev/if_le.c25
-rw-r--r--sys/dev/sbus/if_le.c44
2 files changed, 33 insertions, 36 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) {
diff --git a/sys/dev/sbus/if_le.c b/sys/dev/sbus/if_le.c
index 96e8d76c1e9..a04303da7b4 100644
--- a/sys/dev/sbus/if_le.c
+++ b/sys/dev/sbus/if_le.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_le.c,v 1.10 2004/09/30 07:28:13 miod Exp $ */
+/* $OpenBSD: if_le.c,v 1.11 2006/06/02 19:58:34 miod Exp $ */
/* $NetBSD: if_le.c,v 1.17 2001/05/30 11:46:35 mrg Exp $ */
/*-
@@ -153,7 +153,7 @@ leattach_sbus(struct device *parent, struct device *self, void *aux)
struct sbusdev *sd;
/* XXX the following declarations should be elsewhere */
extern void myetheraddr(u_char *);
-
+ extern struct cfdriver lebuffer_cd;
lesc->sc_bustag = sa->sa_bustag;
lesc->sc_dmatag = dmatag = sa->sa_dmatag;
@@ -171,25 +171,27 @@ leattach_sbus(struct device *parent, struct device *self, void *aux)
* a pre-historic ROM that doesn't establish le<=>lebuffer
* parent-child relationships.
*/
- for (sd = ((struct sbus_softc *)parent)->sc_sbdev; sd != NULL;
- sd = sd->sd_bchain) {
- struct lebuf_softc *lebuf = (struct lebuf_softc *)sd->sd_dev;
-
- if (strncmp("lebuffer", sd->sd_dev->dv_xname, 8) != 0)
- continue;
-
- if (lebuf->attached != 0)
- continue;
-
- sc->sc_mem = lebuf->sc_buffer;
- sc->sc_memsize = lebuf->sc_bufsiz;
- sc->sc_addr = 0; /* Lance view is offset by buffer location */
- lebuf->attached = 1;
-
- /* That old black magic... */
- sc->sc_conf3 = getpropint(sa->sa_node,
- "busmaster-regval", LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON);
- break;
+ if (lebuffer_cd.cd_ndevs != 0) {
+ struct lebuf_softc *lebuf;
+ int i;
+
+ for (i = 0; i < lebuffer_cd.cd_ndevs; i++) {
+ lebuf = (struct lebuf_softc *)lebuffer_cd.cd_devs[i];
+ if (lebuf == NULL || lebuf->attached != 0)
+ continue;
+
+ sc->sc_mem = lebuf->sc_buffer;
+ sc->sc_memsize = lebuf->sc_bufsiz;
+ /* Lance view is offset by buffer location */
+ sc->sc_addr = 0;
+ lebuf->attached = 1;
+
+ /* That old black magic... */
+ sc->sc_conf3 = getpropint(sa->sa_node,
+ "busmaster-regval",
+ LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON);
+ break;
+ }
}
lesc->sc_sd.sd_reset = (void *)am7990_reset;