Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc * add machdep.booted_device and machdep.boot_...



details:   https://anonhg.NetBSD.org/src/rev/f4f4c3ffe2ba
branches:  trunk
changeset: 521683:f4f4c3ffe2ba
user:      darrenr <darrenr%NetBSD.org@localhost>
date:      Sun Feb 03 14:10:02 2002 +0000

description:
* add machdep.booted_device and machdep.boot_args (both fetched from
  appropriate PROM variables).
* return "netbsd" for machdep.booted_kernel if the PROM doesn't return us a
  kernel name.

diffstat:

 sys/arch/sparc/include/cpu.h   |   8 ++++++--
 sys/arch/sparc/sparc/machdep.c |  14 +++++++++++++-
 2 files changed, 19 insertions(+), 3 deletions(-)

diffs (54 lines):

diff -r d6d3f7aa16c1 -r f4f4c3ffe2ba sys/arch/sparc/include/cpu.h
--- a/sys/arch/sparc/include/cpu.h      Sun Feb 03 12:55:26 2002 +0000
+++ b/sys/arch/sparc/include/cpu.h      Sun Feb 03 14:10:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.48 2001/12/11 03:24:46 uwe Exp $ */
+/*     $NetBSD: cpu.h,v 1.49 2002/02/03 14:10:02 darrenr Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -51,11 +51,15 @@
  * CTL_MACHDEP definitions.
  */
 #define        CPU_BOOTED_KERNEL       1       /* string: booted kernel name */
-#define        CPU_MAXID               2       /* number of valid machdep ids */
+#define        CPU_BOOTED_DEVICE       2       /* string: device booted from */
+#define        CPU_BOOT_ARGS           3       /* string: args booted with */
+#define        CPU_MAXID               4       /* number of valid machdep ids */
 
 #define        CTL_MACHDEP_NAMES {                     \
        { 0, 0 },                               \
        { "booted_kernel", CTLTYPE_STRING },    \
+       { "booted_device", CTLTYPE_STRING },    \
+       { "boot_args", CTLTYPE_STRING },        \
 }
 
 #ifdef _KERNEL
diff -r d6d3f7aa16c1 -r f4f4c3ffe2ba sys/arch/sparc/sparc/machdep.c
--- a/sys/arch/sparc/sparc/machdep.c    Sun Feb 03 12:55:26 2002 +0000
+++ b/sys/arch/sparc/sparc/machdep.c    Sun Feb 03 14:10:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.188 2001/12/04 00:05:07 darrenr Exp $ */
+/*     $NetBSD: machdep.c,v 1.189 2002/02/03 14:10:03 darrenr Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -472,6 +472,18 @@
        switch (name[0]) {
        case CPU_BOOTED_KERNEL:
                cp = prom_getbootfile();
+               if (cp == NULL)
+                       return (ENOENT);
+               if (*cp == '\0')
+                       cp = "netbsd";
+               return (sysctl_rdstring(oldp, oldlenp, newp, cp));
+       case CPU_BOOTED_DEVICE:
+               cp = prom_getbootpath();
+               if (cp == NULL || cp[0] == '\0')
+                       return (ENOENT);
+               return (sysctl_rdstring(oldp, oldlenp, newp, cp));
+       case CPU_BOOT_ARGS:
+               cp = prom_getbootargs();
                if (cp == NULL || cp[0] == '\0')
                        return (ENOENT);
                return (sysctl_rdstring(oldp, oldlenp, newp, cp));



Home | Main Index | Thread Index | Old Index