Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc64 Use GETVER_CPU_* macros.



details:   https://anonhg.NetBSD.org/src/rev/91edd9a5310e
branches:  trunk
changeset: 334751:91edd9a5310e
user:      nakayama <nakayama%NetBSD.org@localhost>
date:      Fri Dec 05 11:34:00 2014 +0000

description:
Use GETVER_CPU_* macros.

diffstat:

 sys/arch/sparc64/include/psl.h |   3 ++-
 sys/arch/sparc64/sparc64/cpu.c |  16 ++++++----------
 2 files changed, 8 insertions(+), 11 deletions(-)

diffs (76 lines):

diff -r 4dfa67a669cf -r 91edd9a5310e sys/arch/sparc64/include/psl.h
--- a/sys/arch/sparc64/include/psl.h    Fri Dec 05 11:31:50 2014 +0000
+++ b/sys/arch/sparc64/include/psl.h    Fri Dec 05 11:34:00 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: psl.h,v 1.54 2014/12/05 11:31:50 nakayama Exp $ */
+/*     $NetBSD: psl.h,v 1.55 2014/12/05 11:34:00 nakayama Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -369,6 +369,7 @@
 SPARC64_WRASR64_DEF(stick, STICK)              /* setstick() */
 
 /* Some simple macros to check the cpu type. */
+#define GETVER_CPU_MASK()      ((getver() & VER_MASK) >> VER_MASK_SHIFT)
 #define GETVER_CPU_IMPL()      ((getver() & VER_IMPL) >> VER_IMPL_SHIFT)
 #define GETVER_CPU_MANUF()     ((getver() & VER_MANUF) >> VER_MANUF_SHIFT)
 #define CPU_IS_SPITFIRE()      (GETVER_CPU_IMPL() == IMPL_SPITFIRE)
diff -r 4dfa67a669cf -r 91edd9a5310e sys/arch/sparc64/sparc64/cpu.c
--- a/sys/arch/sparc64/sparc64/cpu.c    Fri Dec 05 11:31:50 2014 +0000
+++ b/sys/arch/sparc64/sparc64/cpu.c    Fri Dec 05 11:34:00 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.120 2014/11/05 13:30:11 nakayama Exp $ */
+/*     $NetBSD: cpu.c,v 1.121 2014/12/05 11:34:00 nakayama Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.120 2014/11/05 13:30:11 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.121 2014/12/05 11:34:00 nakayama Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -276,7 +276,6 @@
        struct cpu_info *ci;
        const char *sep;
        register int i, l;
-       uint64_t ver;
        int bigcache, cachesize;
        char buf[100];
        int     totalsize = 0;
@@ -341,11 +340,10 @@
        aprint_normal(": %s, CPU id %d\n", buf, ci->ci_cpuid);
        aprint_naive("\n");
        if (CPU_ISSUN4U || CPU_ISSUN4US) {
-               ver = getver();
                aprint_normal_dev(dev, "manuf %x, impl %x, mask %x\n",
-                   (u_int)((ver & VER_MANUF) >> VER_MANUF_SHIFT),
-                   (u_int)((ver & VER_IMPL) >> VER_IMPL_SHIFT),
-                   (u_int)((ver & VER_MASK) >> VER_MASK_SHIFT));
+                   (u_int)GETVER_CPU_MANUF(),
+                   (u_int)GETVER_CPU_IMPL(),
+                   (u_int)GETVER_CPU_MASK());
        }
 
        if (ci->ci_system_clockrate[0] != 0) {
@@ -485,7 +483,6 @@
 cpu_myid(void)
 {
        char buf[32];
-       int impl;
 
        if (CPU_ISSUN4V) {
                uint64_t myid;
@@ -495,8 +492,7 @@
        if (OF_getprop(findroot(), "name", buf, sizeof(buf)) > 0 &&
            strcmp(buf, "SUNW,Ultra-Enterprise-10000") == 0)
                return lduwa(0x1fff40000d0UL, ASI_PHYS_NON_CACHED);
-       impl = (getver() & VER_IMPL) >> VER_IMPL_SHIFT;
-       switch (impl) {
+       switch (GETVER_CPU_IMPL()) {
                case IMPL_OLYMPUS_C:
                case IMPL_JUPITER:
                        return CPU_JUPITERID;



Home | Main Index | Thread Index | Old Index