Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc Rearrange the special mainbus device li...



details:   https://anonhg.NetBSD.org/src/rev/30e85964fc5d
branches:  trunk
changeset: 784936:30e85964fc5d
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Feb 14 12:14:13 2013 +0000

description:
Rearrange the special mainbus device list to allow for optional entries.
Fixes a panic on all SUN4M machines w/o an sx graphics adapter.
XXX the "ignore devices at mainbus" list seems to be ignored - or am I
missing something?

diffstat:

 sys/arch/sparc/sparc/autoconf.c |  116 +++++++++++++++++++++------------------
 1 files changed, 63 insertions(+), 53 deletions(-)

diffs (185 lines):

diff -r 3fb5737aab64 -r 30e85964fc5d sys/arch/sparc/sparc/autoconf.c
--- a/sys/arch/sparc/sparc/autoconf.c   Thu Feb 14 10:54:54 2013 +0000
+++ b/sys/arch/sparc/sparc/autoconf.c   Thu Feb 14 12:14:13 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.248 2013/02/05 22:03:16 macallan Exp $ */
+/*     $NetBSD: autoconf.c,v 1.249 2013/02/14 12:14:13 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.248 2013/02/05 22:03:16 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.249 2013/02/14 12:14:13 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1091,84 +1091,90 @@
 extern struct sparc_bus_dma_tag mainbus_dma_tag;
 extern struct sparc_bus_space_tag mainbus_space_tag;
 
+       struct boot_special {
+               const char *const dev;
+#define BS_EARLY       1       /* attach device early */
+#define        BS_IGNORE       2       /* ignore root device */
+#define        BS_OPTIONAL     4       /* device not alwas present */
+               unsigned int flags;
+       };
+
        struct mainbus_attach_args ma;
        char namebuf[32];
 #if defined(SUN4C) || defined(SUN4M) || defined(SUN4D)
-       const char *const *ssp, *sp = NULL;
+       const char *sp = NULL;
        int node0, node;
-       const char *const *openboot_special;
+       const struct boot_special *openboot_special, *ssp;
 #endif
 
 #if defined(SUN4C)
-       static const char *const openboot_special4c[] = {
-               /* find these first (end with empty string) */
-               "memory-error", /* as early as convenient, in case of error */
-               "eeprom",
-               "counter-timer",
-               "auxiliary-io",
-               "",
+       static const struct boot_special openboot_special4c[] = {
+               /* find these first */
+               { "memory-error", BS_EARLY },
+                       /* as early as convenient, in case of error */
+               { "eeprom", BS_EARLY },
+               { "counter-timer", BS_EARLY },
+               { "auxiliary-io", BS_EARLY },
 
-               /* ignore these (end with NULL) */
-               "aliases",
-               "interrupt-enable",
-               "memory",
-               "openprom",
-               "options",
-               "packages",
-               "virtual-memory",
-               NULL
+               /* ignore these */
+               { "aliases", BS_IGNORE },
+               { "interrupt-enable", BS_IGNORE },
+               { "memory", BS_IGNORE },
+               { "openprom", BS_IGNORE },
+               { "options", BS_IGNORE },
+               { "packages", BS_IGNORE },
+               { "virtual-memory", BS_IGNORE },
+
+               /* sentinel */
+               { NULL, 0 }
        };
 #else
 #define openboot_special4c     ((void *)0)
 #endif
 #if defined(SUN4M)
-       static const char *const openboot_special4m[] = {
+       static const struct boot_special openboot_special4m[] = {
                /* find these first */
-#if !defined(MSIIEP)
-               "SUNW,sx",
-               "obio",         /* smart enough to get eeprom/etc mapped */
-#else
-               "pci",          /* ms-IIep */
-#endif
-               "",
+               { "SUNW,sx", BS_EARLY|BS_OPTIONAL },
+               { "obio", BS_EARLY|BS_OPTIONAL },
+                               /* smart enough to get eeprom/etc mapped */
+               { "pci", BS_EARLY|BS_OPTIONAL },        /* ms-IIep */
 
-               /* ignore these (end with NULL) */
                /*
                 * These are _root_ devices to ignore. Others must be handled
                 * elsewhere.
                 */
-               "virtual-memory",
-               "aliases",
-               "chosen",               /* OpenFirmware */
-               "memory",
-               "openprom",
-               "options",
-               "packages",
-               "udp",                  /* OFW in Krups */
+               { "virtual-memory", BS_IGNORE },
+               { "aliases", BS_IGNORE },
+               { "chosen", BS_IGNORE },        /* OpenFirmware */
+               { "memory", BS_IGNORE },
+               { "openprom", BS_IGNORE },
+               { "options", BS_IGNORE },
+               { "packages", BS_IGNORE },
+               { "udp", BS_IGNORE },           /* OFW in Krups */
                /* we also skip any nodes with device_type == "cpu" */
-               NULL
+
+               { NULL, 0 }
        };
 #else
 #define openboot_special4m     ((void *)0)
 #endif
 #if defined(SUN4D)
-       static const char *const openboot_special4d[] = {
-               "",
-
-               /* ignore these (end with NULL) */
+       static const struct boot_special openboot_special4d[] = {
                /*
                 * These are _root_ devices to ignore. Others must be handled
                 * elsewhere.
                 */
-               "mem-unit",     /* XXX might need this for memory errors */
-               "boards",
-               "openprom",
-               "virtual-memory",
-               "memory",
-               "aliases",
-               "options",
-               "packages",
-               NULL
+               { "mem-unit", BS_IGNORE },
+                       /* XXX might need this for memory errors */
+               { "boards", BS_IGNORE },
+               { "openprom", BS_IGNORE },
+               { "virtual-memory", BS_IGNORE },
+               { "memory", BS_IGNORE },
+               { "aliases", BS_IGNORE },
+               { "options", BS_IGNORE },
+               { "packages", BS_IGNORE },
+
+               { NULL, 0 }
        };
 #else
 #define        openboot_special4d      ((void *)0)
@@ -1282,10 +1288,12 @@
                config_found(dev, (void *)&ma, mbprint);
        }
 
-       for (ssp = openboot_special; *(sp = *ssp) != 0; ssp++) {
+       for (ssp = openboot_special; (sp = ssp->dev) != NULL; ssp++) {
                struct openprom_addr romreg;
 
+               if (!(ssp->flags & BS_EARLY)) continue;
                if ((node = findnode(node0, sp)) == 0) {
+                       if (ssp->flags & BS_OPTIONAL) continue;
                        printf("could not find %s in OPENPROM\n", sp);
                        panic(sp);
                }
@@ -1331,9 +1339,11 @@
 #endif
                cp = prom_getpropstringA(node, "name", namebuf, sizeof namebuf);
                DPRINTF(ACDB_PROBE, (" name %s\n", namebuf));
-               for (ssp = openboot_special; (sp = *ssp) != NULL; ssp++)
+               for (ssp = openboot_special; (sp = ssp->dev) != NULL; ssp++) {
+                       if (!(ssp->flags & BS_EARLY)) continue;
                        if (strcmp(cp, sp) == 0)
                                break;
+               }
                if (sp != NULL)
                        continue; /* an "early" device already configured */
 



Home | Main Index | Thread Index | Old Index