Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/ofppc Fetch the platform name earlier, so we can de...



details:   https://anonhg.NetBSD.org/src/rev/fe84ef78fc83
branches:  trunk
changeset: 516385:fe84ef78fc83
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Oct 22 16:44:03 2001 +0000

description:
Fetch the platform name earlier, so we can determine what kind of
system we're running on earlier.

diffstat:

 sys/arch/ofppc/include/autoconf.h |   2 ++
 sys/arch/ofppc/ofppc/machdep.c    |  14 ++++++++++++--
 sys/arch/ofppc/ofppc/mainbus.c    |  20 ++++----------------
 3 files changed, 18 insertions(+), 18 deletions(-)

diffs (109 lines):

diff -r 3371655d2f06 -r fe84ef78fc83 sys/arch/ofppc/include/autoconf.h
--- a/sys/arch/ofppc/include/autoconf.h Mon Oct 22 16:43:55 2001 +0000
+++ b/sys/arch/ofppc/include/autoconf.h Mon Oct 22 16:44:03 2001 +0000
@@ -16,6 +16,8 @@
 
 #ifdef __BROKEN_DK_ESTABLISH
 void dk_cleanup(void);
+
+extern char platform_name[];
 #endif
 
 #endif /* _KERNEL */
diff -r 3371655d2f06 -r fe84ef78fc83 sys/arch/ofppc/ofppc/machdep.c
--- a/sys/arch/ofppc/ofppc/machdep.c    Mon Oct 22 16:43:55 2001 +0000
+++ b/sys/arch/ofppc/ofppc/machdep.c    Mon Oct 22 16:44:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.69 2001/09/10 21:19:21 chris Exp $       */
+/*     $NetBSD: machdep.c,v 1.70 2001/10/22 16:44:03 thorpej Exp $     */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -55,6 +55,8 @@
 
 #include <net/netisr.h>
 
+#include <dev/ofw/openfirm.h>
+
 #include <machine/autoconf.h>
 #include <machine/bat.h>
 #include <machine/pmap.h>
@@ -111,6 +113,8 @@
        fake_irq_establish,
 };
 
+char   platform_name[64];
+
 void
 initppc(startkernel, endkernel, args)
        u_int startkernel, endkernel;
@@ -131,7 +135,7 @@
 #ifdef IPKDB
        extern int ipkdblow, ipkdbsize;
 #endif
-       int exc, scratch;
+       int exc, scratch, node;
 
        proc0.p_addr = proc0paddr;
        memset(proc0.p_addr, 0, sizeof *proc0.p_addr);
@@ -141,6 +145,12 @@
        curpm = curpcb->pcb_pmreal = curpcb->pcb_pm = pmap_kernel();
 
        /*
+        * Fetch the platform name from the root of the OFW tree.
+        */
+       node = OF_peer(0);
+       OF_getprop(node, "name", platform_name, sizeof(platform_name));
+
+       /*
         * i386 port says, that this shouldn't be here,
         * but I really think the console should be initialized
         * as early as possible.
diff -r 3371655d2f06 -r fe84ef78fc83 sys/arch/ofppc/ofppc/mainbus.c
--- a/sys/arch/ofppc/ofppc/mainbus.c    Mon Oct 22 16:43:55 2001 +0000
+++ b/sys/arch/ofppc/ofppc/mainbus.c    Mon Oct 22 16:44:03 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mainbus.c,v 1.4 2001/10/22 14:46:09 thorpej Exp $       */
+/*     $NetBSD: mainbus.c,v 1.5 2001/10/22 16:44:03 thorpej Exp $       */
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -42,6 +42,8 @@
 
 #include <dev/ofw/openfirm.h>
 
+#include <machine/autoconf.h>
+
 int    mainbus_match(struct device *, struct cfdata *, void *);
 void   mainbus_attach(struct device *, struct device *, void *);
 
@@ -53,8 +55,6 @@
 
 extern struct cfdriver mainbus_cd;
 
-char platform_type[64];
-
 /*
  * Probe for the mainbus; always succeeds.
  */
@@ -99,19 +99,7 @@
                NULL
        };
 
-       node = OF_peer(0);
-       if (node == 0) {
-               printf("\n");
-               panic("mainbus_attach: no OpenFirmware root node\n");
-       }
-
-       /*
-        * Display the type of system we are running on.  Eventually,
-        * this can be used to look up methods to handle native hardware
-        * devices.
-        */
-       OF_getprop(node, "name", platform_type, sizeof(platform_type));
-       printf(": %s\n", platform_type);
+       printf(": %s\n", platform_name);
 
        /*
         * Before we do anything else, attach CPUs.  We do this early,



Home | Main Index | Thread Index | Old Index