Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc Not all sun4m platforms have version 8 sparc ...



details:   https://anonhg.NetBSD.org/src/rev/e40f0f43d774
branches:  trunk
changeset: 539878:e40f0f43d774
user:      pk <pk%NetBSD.org@localhost>
date:      Thu Nov 28 15:29:53 2002 +0000

description:
Not all sun4m platforms have version 8 sparc CPUs. So go out to the PROM
and get the CPU architecture version from the PROM cpu node `sparc-version'
property.

diffstat:

 sys/arch/sparc/include/cpu.h   |   5 ++++-
 sys/arch/sparc/sparc/cpu.c     |  18 +++++++++++-------
 sys/arch/sparc/sparc/machdep.c |   5 ++---
 3 files changed, 17 insertions(+), 11 deletions(-)

diffs (82 lines):

diff -r fd91bc7a0b24 -r e40f0f43d774 sys/arch/sparc/include/cpu.h
--- a/sys/arch/sparc/include/cpu.h      Thu Nov 28 15:09:48 2002 +0000
+++ b/sys/arch/sparc/include/cpu.h      Thu Nov 28 15:29:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.50 2002/11/26 14:36:11 pk Exp $ */
+/*     $NetBSD: cpu.h,v 1.51 2002/11/28 15:29:53 pk Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -163,6 +163,9 @@
  */
 #define        signotify(p)            (want_ast = 1)
 
+/* CPU architecture version */
+extern int cpu_arch;
+
 /* Number of CPUs in the system */
 extern int ncpu;
 
diff -r fd91bc7a0b24 -r e40f0f43d774 sys/arch/sparc/sparc/cpu.c
--- a/sys/arch/sparc/sparc/cpu.c        Thu Nov 28 15:09:48 2002 +0000
+++ b/sys/arch/sparc/sparc/cpu.c        Thu Nov 28 15:29:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.134 2002/10/02 16:02:09 thorpej Exp $ */
+/*     $NetBSD: cpu.c,v 1.135 2002/11/28 15:29:53 pk Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -92,6 +92,7 @@
 char   machine[] = MACHINE;            /* from <machine/param.h> */
 char   machine_arch[] = MACHINE_ARCH;  /* from <machine/param.h> */
 char   cpu_model[100];
+int    cpu_arch;                       /* sparc architecture version */
 
 int    ncpu;                           /* # of CPUs detected by PROM */
 struct cpu_info **cpus;
@@ -1728,17 +1729,20 @@
                        mmu_impl = ANY;
                        mmu_vers = ANY;
                }
+
+               /* Get sparc architecture version */
+               cpu_arch = (node == 0)
+                       ? 7
+                       : PROM_getpropint(node, "sparc-version", 7);
        } else {
                /*
                 * Get CPU version/implementation from ROM. If not
                 * available, assume same as boot CPU.
                 */
-               cpu_impl = PROM_getpropint(node, "psr-implementation", -1);
-               if (cpu_impl == -1)
-                       cpu_impl = cpuinfo.cpu_impl;
-               cpu_vers = PROM_getpropint(node, "psr-version", -1);
-               if (cpu_vers == -1)
-                       cpu_vers = cpuinfo.cpu_vers;
+               cpu_impl = PROM_getpropint(node, "psr-implementation",
+                                          cpuinfo.cpu_impl);
+               cpu_vers = PROM_getpropint(node, "psr-version",
+                                          cpuinfo.cpu_vers);
 
                /* Get MMU version/implementation from ROM always */
                mmu_impl = PROM_getpropint(node, "implementation", -1);
diff -r fd91bc7a0b24 -r e40f0f43d774 sys/arch/sparc/sparc/machdep.c
--- a/sys/arch/sparc/sparc/machdep.c    Thu Nov 28 15:09:48 2002 +0000
+++ b/sys/arch/sparc/sparc/machdep.c    Thu Nov 28 15:29:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.204 2002/11/26 14:36:10 pk Exp $ */
+/*     $NetBSD: machdep.c,v 1.205 2002/11/28 15:29:54 pk Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -490,8 +490,7 @@
                return (sysctl_rdstring(oldp, oldlenp, newp, cp));
        case CPU_ARCH:
                /* CPU architecture version */
-               return (sysctl_rdint(oldp, oldlenp, newp,
-                       (CPU_ISSUN4 || CPU_ISSUN4C) ? 7 : 8));
+               return (sysctl_rdint(oldp, oldlenp, newp, cpu_arch));
        default:
                return (EOPNOTSUPP);
        }



Home | Main Index | Thread Index | Old Index