Source-Changes-HG archive

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

[src/trunk]: src/sys/arch use cpu_{g,s}etmodel



details:   https://anonhg.NetBSD.org/src/rev/1399dd658b1c
branches:  trunk
changeset: 328041:1399dd658b1c
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 24 19:29:59 2014 +0000

description:
use cpu_{g,s}etmodel

diffstat:

 sys/arch/pmax/pmax/dec_3100.c          |   6 +++---
 sys/arch/pmax/pmax/dec_3max.c          |   6 +++---
 sys/arch/pmax/pmax/dec_3maxplus.c      |   8 ++++----
 sys/arch/pmax/pmax/dec_3min.c          |   6 +++---
 sys/arch/pmax/pmax/dec_5100.c          |   6 +++---
 sys/arch/pmax/pmax/dec_maxine.c        |   6 +++---
 sys/arch/pmax/pmax/machdep.c           |   7 ++++---
 sys/arch/powerpc/booke/booke_machdep.c |   8 ++++----
 sys/arch/powerpc/ibm4xx/cpu.c          |  12 +++++-------
 sys/arch/powerpc/include/cpu.h         |   3 +--
 sys/arch/powerpc/oea/cpu_subr.c        |  12 ++++--------
 sys/arch/powerpc/oea/oea_machdep.c     |  10 ++++++----
 12 files changed, 43 insertions(+), 47 deletions(-)

diffs (truncated from 401 to 300 lines):

diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/pmax/pmax/dec_3100.c
--- a/sys/arch/pmax/pmax/dec_3100.c     Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/pmax/pmax/dec_3100.c     Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3100.c,v 1.53 2012/10/13 06:51:22 tsutsui Exp $ */
+/* $NetBSD: dec_3100.c,v 1.54 2014/03/24 19:31:39 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -69,7 +69,7 @@
 
 #define __INTR_PRIVATE
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dec_3100.c,v 1.53 2012/10/13 06:51:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_3100.c,v 1.54 2014/03/24 19:31:39 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -141,7 +141,7 @@
                submodel = "2100 (PMIN)";
        else
                submodel = "3100 (PMAX)";
-       sprintf(cpu_model, "DECstation %s", submodel);
+       cpu_setmodel("DECstation %s", submodel);
 }
 
 /*
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/pmax/pmax/dec_3max.c
--- a/sys/arch/pmax/pmax/dec_3max.c     Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/pmax/pmax/dec_3max.c     Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3max.c,v 1.55 2012/10/13 06:51:22 tsutsui Exp $ */
+/* $NetBSD: dec_3max.c,v 1.56 2014/03/24 19:31:39 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -70,7 +70,7 @@
 #define        __INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dec_3max.c,v 1.55 2012/10/13 06:51:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_3max.c,v 1.56 2014/03/24 19:31:39 christos Exp $");
 
 #include "dzkbd.h"
 
@@ -155,7 +155,7 @@
        *(volatile uint32_t *)MIPS_PHYS_TO_KSEG1(KN02_SYS_CSR) = csr;
        kn02_wbflush();
 
-       strcpy(cpu_model, "DECstation 5000/200 (3MAX)");
+       cpu_setmodel("DECstation 5000/200 (3MAX)");
 }
 
 /*
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/pmax/pmax/dec_3maxplus.c
--- a/sys/arch/pmax/pmax/dec_3maxplus.c Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/pmax/pmax/dec_3maxplus.c Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3maxplus.c,v 1.69 2012/10/13 06:51:22 tsutsui Exp $ */
+/* $NetBSD: dec_3maxplus.c,v 1.70 2014/03/24 19:31:40 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -70,7 +70,7 @@
 #define __INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dec_3maxplus.c,v 1.69 2012/10/13 06:51:22 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_3maxplus.c,v 1.70 2014/03/24 19:31:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -180,10 +180,10 @@
        prodtype &= KN03_INTR_PROD_JUMPER;
        /* the bit persists even if INTR register is assigned value 0 */
        if (prodtype)
-               sprintf(cpu_model, "DECstation 5000/%s (3MAXPLUS)",
+               cpu_setmodel("DECstation 5000/%s (3MAXPLUS)",
                    (CPUISMIPS3) ? "260" : "240");
        else
-               sprintf(cpu_model, "DECsystem 5900%s (3MAXPLUS)",
+               cpu_setmodel("DECsystem 5900%s (3MAXPLUS)",
                    (CPUISMIPS3) ? "-260" : "");
 }
 
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/pmax/pmax/dec_3min.c
--- a/sys/arch/pmax/pmax/dec_3min.c     Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/pmax/pmax/dec_3min.c     Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_3min.c,v 1.72 2012/10/13 06:51:23 tsutsui Exp $ */
+/* $NetBSD: dec_3min.c,v 1.73 2014/03/24 19:31:40 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -70,7 +70,7 @@
 #define        __INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.72 2012/10/13 06:51:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_3min.c,v 1.73 2014/03/24 19:31:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -183,7 +183,7 @@
                physmem_boardmax = physmem_boardmax >> 2;
        physmem_boardmax = MIPS_PHYS_TO_KSEG1(physmem_boardmax);
 
-       sprintf(cpu_model, "DECstation 5000/1%d (3MIN)", mips_options.mips_cpu_mhz);
+       cpu_setmodel("DECstation 5000/1%d (3MIN)", mips_options.mips_cpu_mhz);
 }
 
 /*
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/pmax/pmax/dec_5100.c
--- a/sys/arch/pmax/pmax/dec_5100.c     Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/pmax/pmax/dec_5100.c     Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_5100.c,v 1.47 2012/10/13 06:51:23 tsutsui Exp $ */
+/* $NetBSD: dec_5100.c,v 1.48 2014/03/24 19:31:40 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: dec_5100.c,v 1.47 2012/10/13 06:51:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_5100.c,v 1.48 2014/03/24 19:31:40 christos Exp $");
 
 #define __INTR_PRIVATE
 #include <sys/param.h>
@@ -99,7 +99,7 @@
        /* calibrate cpu_mhz value */
        mc_cpuspeed(MIPS_PHYS_TO_KSEG1(KN01_SYS_CLOCK), MIPS_INT_MASK_2);
 
-       sprintf(cpu_model, "DECsystem 5100 (MIPSMATE)");
+       cpu_setmodel("DECsystem 5100 (MIPSMATE)");
 }
 
 /*
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/pmax/pmax/dec_maxine.c
--- a/sys/arch/pmax/pmax/dec_maxine.c   Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/pmax/pmax/dec_maxine.c   Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dec_maxine.c,v 1.64 2012/10/13 06:51:23 tsutsui Exp $ */
+/* $NetBSD: dec_maxine.c,v 1.65 2014/03/24 19:31:40 christos Exp $ */
 
 /*
  * Copyright (c) 1998 Jonathan Stone.  All rights reserved.
@@ -70,7 +70,7 @@
 #define __INTR_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dec_maxine.c,v 1.64 2012/10/13 06:51:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dec_maxine.c,v 1.65 2014/03/24 19:31:40 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -169,7 +169,7 @@
        *(volatile uint32_t *)(ioasic_base + IOASIC_IMSK) = xine_tc3_imask;
        kn02ca_wbflush();
 
-       sprintf(cpu_model, "Personal DECstation 5000/%d (MAXINE)", mips_options.mips_cpu_mhz);
+       cpu_setmodel("Personal DECstation 5000/%d (MAXINE)", mips_options.mips_cpu_mhz);
 }
 
 /*
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/pmax/pmax/machdep.c
--- a/sys/arch/pmax/pmax/machdep.c      Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/pmax/pmax/machdep.c      Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.247 2013/11/10 20:18:51 christos Exp $   */
+/*     $NetBSD: machdep.c,v 1.248 2014/03/24 19:31:40 christos Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.247 2013/11/10 20:18:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.248 2014/03/24 19:31:40 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_modular.h"
@@ -58,6 +58,7 @@
 #include <sys/proc.h>
 #include <sys/reboot.h>
 #include <sys/systm.h>
+#include <sys/cpu.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -386,7 +387,7 @@
         * Good {morning,afternoon,evening,night}.
         */
        printf("%s%s", copyright, version);
-       printf("%s\n", cpu_model);
+       printf("%s\n", cpu_getmodel());
        format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
        printf("total memory = %s\n", pbuf);
 
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/powerpc/booke/booke_machdep.c
--- a/sys/arch/powerpc/booke/booke_machdep.c    Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/powerpc/booke/booke_machdep.c    Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: booke_machdep.c,v 1.19 2014/03/18 18:20:41 riastradh Exp $     */
+/*     $NetBSD: booke_machdep.c,v 1.20 2014/03/24 19:29:59 christos Exp $      */
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,7 @@
 #define        _POWERPC_BUS_DMA_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.19 2014/03/18 18:20:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.20 2014/03/24 19:29:59 christos Exp $");
 
 #include "opt_modular.h"
 
@@ -51,6 +51,7 @@
 #include <sys/kernel.h>
 #include <sys/reboot.h>
 #include <sys/bus.h>
+#include <sys/cpu.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -145,7 +146,6 @@
 /*
  * This should probably be in autoconf!                                XXX
  */
-char cpu_model[80];
 char machine[] = MACHINE;              /* from <machine/param.h> */
 char machine_arch[] = MACHINE_ARCH;    /* from <machine/param.h> */
 
@@ -167,7 +167,7 @@
        vaddr_t         minaddr, maxaddr;
        char            pbuf[9];
 
-       strlcpy(cpu_model, model, sizeof(cpu_model));
+       cpu_setmodel("%s", model);
 
        printf("%s%s", copyright, version);
 
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/powerpc/ibm4xx/cpu.c
--- a/sys/arch/powerpc/ibm4xx/cpu.c     Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/powerpc/ibm4xx/cpu.c     Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.32 2011/06/21 04:21:16 matt Exp $    */
+/*     $NetBSD: cpu.c,v 1.33 2014/03/24 19:29:59 christos Exp $        */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.32 2011/06/21 04:21:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.33 2014/03/24 19:29:59 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -223,8 +223,6 @@
        }
 };
 
-char cpu_model[80];
-
 bool cpufound;
 
 static int
@@ -257,16 +255,16 @@
        const u_int pvr = mfpvr();
        for (cp = models; cp->name != NULL; cp++) {
                if ((pvr & cp->mask) == cp->version) {
-                       strcpy(cpu_model, cp->name);
+                       cpu_setmodel("%s", cp->name);
                        break;
                }
        }
        if (__predict_false(cp->name == NULL))
-               sprintf(cpu_model, "Version 0x%x", pvr);
+               cpu_setmodel("Version 0x%x", pvr);
 
        aprint_normal(": %uMHz %s (PVR 0x%x)\n",
            (processor_freq + 500000) / 1000000,
-           (cp->name != NULL ? cpu_model : "unknown model"),
+           (cp->name != NULL ? cpu_getmodel() : "unknown model"),
            pvr);
 
        cpu_probe_cache();
diff -r a06eb2f5155f -r 1399dd658b1c sys/arch/powerpc/include/cpu.h
--- a/sys/arch/powerpc/include/cpu.h    Mon Mar 24 19:14:31 2014 +0000
+++ b/sys/arch/powerpc/include/cpu.h    Mon Mar 24 19:29:59 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.99 2014/03/03 15:36:36 macallan Exp $        */
+/*     $NetBSD: cpu.h,v 1.100 2014/03/24 19:29:59 christos Exp $       */
 
 /*
  * Copyright (C) 1999 Wolfgang Solfrank.



Home | Main Index | Thread Index | Old Index