Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/dev More ugly code to force early configurati...



details:   https://anonhg.NetBSD.org/src/rev/7061581c6723
branches:  trunk
changeset: 474128:7061581c6723
user:      pk <pk%NetBSD.org@localhost>
date:      Mon Jun 28 22:40:15 1999 +0000

description:
More ugly code to force early configuration of the sun4 on-board timer.

diffstat:

 sys/arch/sparc/dev/obio.c |  40 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 35 insertions(+), 5 deletions(-)

diffs (89 lines):

diff -r d6212fbfc33e -r 7061581c6723 sys/arch/sparc/dev/obio.c
--- a/sys/arch/sparc/dev/obio.c Mon Jun 28 22:13:04 1999 +0000
+++ b/sys/arch/sparc/dev/obio.c Mon Jun 28 22:40:15 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: obio.c,v 1.45 1998/09/05 22:15:51 eeh Exp $    */
+/*     $NetBSD: obio.c,v 1.46 1999/06/28 22:40:15 pk Exp $     */
 
 /*-
  * Copyright (c) 1997,1998 The NetBSD Foundation, Inc.
@@ -81,6 +81,16 @@
        sizeof(union obio_softc), obiomatch, obioattach
 };
 
+
+/*
+ * This `obio4_busattachargs' data structure only exists to pass down
+ * to obiosearch() the name of a device that must be configured early.
+ */
+struct obio4_busattachargs {
+       struct mainbus_attach_args      *ma;
+       const char                      *name;
+};
+
 #if defined(SUN4)
 static int obioprint  __P((void *, const char *));
 static int obiosearch   __P((struct device *, struct cfdata *, void *));
@@ -141,6 +151,13 @@
        if (CPU_ISSUN4) {
 #if defined(SUN4)
                struct obio4_softc *sc = &((union obio_softc *)self)->sc_obio;
+               struct obio4_busattachargs oa;
+               const char *const *cpp;
+               static const char *const special4[] = {
+                       /* find these first */
+                       "timer",
+                       NULL
+               };
 
                sc->sc_bustag = ma->ma_bustag;
                sc->sc_dmatag = ma->ma_dmatag;
@@ -148,7 +165,17 @@
                obio_space_tag.cookie = sc;
                obio_space_tag.parent = sc->sc_bustag;
 
-               (void)config_search(obiosearch, self, aux);
+               oa.ma = ma;
+
+               /* Find all `early' obio devices */
+               for (cpp = special4; *cpp != NULL; cpp++) {
+                       oa.name = *cpp;
+                       (void)config_search(obiosearch, self, &oa);
+               }
+
+               /* Find all other obio devices */
+               oa.name = NULL;
+               (void)config_search(obiosearch, self, &oa);
 #endif
                return;
        } else if (CPU_ISSUN4M) {
@@ -236,11 +263,14 @@
        struct cfdata *cf;
        void *aux;
 {
-       struct mainbus_attach_args *ma = aux;
+       struct obio4_busattachargs *oap = aux;
        union obio_attach_args uoba;
        struct obio4_attach_args *oba = &uoba.uoba_oba4;
        struct bootpath *bp;
 
+       /* Check whether we're looking for a specifically named device */
+       if (oap->name != NULL && strcmp(oap->name, cf->cf_driver->cd_name) != 0)
+               return (0);
 
        /*
         * Avoid sun4m entries which don't have valid PAs.
@@ -263,11 +293,11 @@
 
        uoba.uoba_isobio4 = 1;
        oba->oba_bustag = &obio_space_tag;
-       oba->oba_dmatag = ma->ma_dmatag;
+       oba->oba_dmatag = oap->ma->ma_dmatag;
        oba->oba_paddr = cf->cf_loc[0];
        oba->oba_pri = cf->cf_loc[1];
 
-       bp = ma->ma_bp;
+       bp = oap->ma->ma_bp;
        if (bp != NULL && strcmp(bp->name, "obio") == 0)
                oba->oba_bp = bp + 1;
        else



Home | Main Index | Thread Index | Old Index