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/a03c1d898a19
branches:  trunk
changeset: 794790:a03c1d898a19
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Mar 24 20:06:31 2014 +0000

description:
use cpu_{g,s}etmodel

diffstat:

 sys/arch/acorn26/acorn26/machdep.c         |    6 +-
 sys/arch/algor/algor/machdep.c             |   13 +-
 sys/arch/alpha/alpha/machdep.c             |   13 +-
 sys/arch/amiga/amiga/machdep.c             |   11 +-
 sys/arch/arc/arc/machdep.c                 |    9 +-
 sys/arch/arm/arm32/bus_dma.c               |    6 +-
 sys/arch/arm/arm32/cpu.c                   |   24 ++---
 sys/arch/cobalt/cobalt/machdep.c           |   10 +-
 sys/arch/dreamcast/dreamcast/machdep.c     |    7 +-
 sys/arch/emips/emips/machdep.c             |    7 +-
 sys/arch/emips/emips/xilinx_ml40x.c        |    8 +-
 sys/arch/emips/emips/xs_bee3.c             |    6 +-
 sys/arch/evbmips/adm5120/machdep.c         |    9 +-
 sys/arch/evbmips/alchemy/genericbd.c       |    6 +-
 sys/arch/evbmips/alchemy/machdep.c         |    9 +-
 sys/arch/evbmips/atheros/machdep.c         |    9 +-
 sys/arch/evbmips/gdium/machdep.c           |    7 +-
 sys/arch/evbmips/loongson/machdep.c        |   13 +--
 sys/arch/evbmips/malta/machdep.c           |    9 +-
 sys/arch/evbmips/rasoc/machdep.c           |   19 ++--
 sys/arch/evbmips/rmixl/machdep.c           |   10 +-
 sys/arch/ews4800mips/ews4800mips/machdep.c |    9 +-
 sys/arch/hpcmips/hpcmips/machdep.c         |    8 +-
 sys/arch/hpcsh/hpcsh/machdep.c             |    7 +-
 sys/arch/hppa/hppa/machdep.c               |   10 +-
 sys/arch/ia64/ia64/cpu.c                   |    8 +-
 sys/arch/landisk/landisk/machdep.c         |    7 +-
 sys/arch/m68k/m68k/linux_syscall.c         |    8 +-
 sys/arch/mac68k/mac68k/machdep.c           |   11 +-
 sys/arch/mips/mips/mips_machdep.c          |    5 +-
 sys/arch/mipsco/mipsco/machdep.c           |    7 +-
 sys/arch/mipsco/mipsco/mips_3x30.c         |    6 +-
 sys/arch/sh3/sh3/sh3_machdep.c             |   10 +-
 sys/arch/sparc/sparc/cpu.c                 |    8 +-
 sys/arch/sparc64/sparc64/cpu.c             |    8 +-
 sys/arch/sun3/sun3/machdep.c               |   10 +-
 sys/arch/sun3/sun3x/machdep.c              |   10 +-
 sys/arch/usermode/dev/cpu.c                |    8 +-
 sys/arch/vax/vax/ka6400.c                  |    6 +-
 sys/arch/vax/vax/ka780.c                   |    6 +-
 sys/arch/vax/vax/ka820.c                   |   11 +-
 sys/arch/vax/vax/ka88.c                    |   15 ++-
 sys/arch/vax/vax/locore.c                  |  112 +++++++++++++++-------------
 sys/arch/vax/vax/machdep.c                 |    7 +-
 sys/arch/x68k/x68k/machdep.c               |   12 +--
 sys/arch/x86/x86/identcpu.c                |   17 +--
 sys/arch/x86/x86/procfs_machdep.c          |    6 +-
 47 files changed, 267 insertions(+), 276 deletions(-)

diffs (truncated from 2142 to 300 lines):

diff -r e1ca101c89ca -r a03c1d898a19 sys/arch/acorn26/acorn26/machdep.c
--- a/sys/arch/acorn26/acorn26/machdep.c        Mon Mar 24 20:05:20 2014 +0000
+++ b/sys/arch/acorn26/acorn26/machdep.c        Mon Mar 24 20:06:31 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.37 2012/08/16 17:35:01 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.38 2014/03/24 20:06:31 christos Exp $ */
 
 /*-
  * Copyright (c) 1998 Ben Harris
@@ -32,7 +32,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.37 2012/08/16 17:35:01 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.38 2014/03/24 20:06:31 christos Exp $");
 
 #include <sys/buf.h>
 #include <sys/kernel.h>
@@ -56,7 +56,6 @@
 #include <machine/machdep.h>
 #include <machine/memcreg.h>
 
-char cpu_model[] = "Archimedes";
 
 struct vm_map *phys_map = NULL;
 
@@ -147,6 +146,7 @@
        /* Stuff to do here: */
        /* initmsgbuf() is called from start() */
 
+       cpu_setmodel("Archimedes");
        printf("%s%s", copyright, version);
        format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
        printf("total memory = %s\n", pbuf);
diff -r e1ca101c89ca -r a03c1d898a19 sys/arch/algor/algor/machdep.c
--- a/sys/arch/algor/algor/machdep.c    Mon Mar 24 20:05:20 2014 +0000
+++ b/sys/arch/algor/algor/machdep.c    Mon Mar 24 20:06:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.52 2012/03/02 16:19:52 matt Exp $        */
+/*     $NetBSD: machdep.c,v 1.53 2014/03/24 20:06:31 christos Exp $    */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.52 2012/03/02 16:19:52 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.53 2014/03/24 20:06:31 christos Exp $");
 
 #include "opt_algor_p4032.h"
 #include "opt_algor_p5064.h" 
@@ -93,6 +93,7 @@
 #include <sys/reboot.h>
 #include <sys/systm.h>
 #include <sys/termios.h>
+#include <sys/cpu.h>
 
 #include <net/if.h>
 #include <net/if_ether.h>
@@ -208,7 +209,7 @@
                struct vtpbc_config *vt = &vtpbc_configuration; 
                bus_space_handle_t sh;
 
-               strcpy(cpu_model, "Algorithmics P-4032");
+               cpu_setmodel("Algorithmics P-4032");
 
                vt->vt_addr = MIPS_PHYS_TO_KSEG1(P4032_V962PBC);
                vt->vt_cfgbase = MIPS_PHYS_TO_KSEG1(P4032_PCICFG);
@@ -255,7 +256,7 @@
                struct vtpbc_config *vt = &vtpbc_configuration;
                bus_space_handle_t sh;
 
-               strcpy(cpu_model, "Algorithmics P-5064");
+               cpu_setmodel("Algorithmics P-5064");
 
                vt->vt_addr = MIPS_PHYS_TO_KSEG1(P5064_V360EPC);
                vt->vt_cfgbase = MIPS_PHYS_TO_KSEG1(P5064_PCICFG);
@@ -299,7 +300,7 @@
                struct bonito_config *bc = &acp->ac_bonito;
                bus_space_handle_t sh;
 
-               strcpy(cpu_model, "Algorithmics P-6032");
+               cpu_setmodel("Algorithmics P-6032");
 
                bc->bc_adbase = 11;
                
@@ -523,7 +524,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), ptoa(physmem));
        printf("total memory = %s\n", pbuf);
 
diff -r e1ca101c89ca -r a03c1d898a19 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Mon Mar 24 20:05:20 2014 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Mon Mar 24 20:06:31 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.343 2014/03/20 20:51:40 christos Exp $ */
+/* $NetBSD: machdep.c,v 1.344 2014/03/24 20:06:31 christos Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.343 2014/03/20 20:51:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.344 2014/03/24 20:06:31 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -160,7 +160,6 @@
 /* the following is used externally (sysctl_hw) */
 char   machine[] = MACHINE;            /* from <machine/param.h> */
 char   machine_arch[] = MACHINE_ARCH;  /* from <machine/param.h> */
-char   cpu_model[128];
 
 /* Number of machine cycles per microsecond */
 uint64_t       cycles_per_usec;
@@ -391,7 +390,7 @@
                /* NOTREACHED */
        }
        (*c->init)();
-       strcpy(cpu_model, platform.model);
+       cpu_setmodel("%s", platform.model);
 
        /*
         * Initialize the real console, so that the bootstrap console is
@@ -936,14 +935,14 @@
 void
 identifycpu(void)
 {
-       char *s;
+       const char *s;
        int i;
 
        /*
         * print out CPU identification information.
         */
-       printf("%s", cpu_model);
-       for(s = cpu_model; *s; ++s)
+       printf("%s", cpu_getmodel());
+       for(s = cpu_getmodel(); *s; ++s)
                if(strncasecmp(s, "MHz", 3) == 0)
                        goto skipMHz;
        printf(", %ldMHz", hwrpb->rpb_cc_freq / 1000000);
diff -r e1ca101c89ca -r a03c1d898a19 sys/arch/amiga/amiga/machdep.c
--- a/sys/arch/amiga/amiga/machdep.c    Mon Mar 24 20:05:20 2014 +0000
+++ b/sys/arch/amiga/amiga/machdep.c    Mon Mar 24 20:06:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.242 2014/03/22 01:52:44 christos Exp $   */
+/*     $NetBSD: machdep.c,v 1.243 2014/03/24 20:06:31 christos Exp $   */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -50,7 +50,7 @@
 #include "empm.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.242 2014/03/22 01:52:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.243 2014/03/24 20:06:31 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -286,8 +286,6 @@
 /*
  * Info for CTL_HW
  */
-char cpu_model[120];
-
 #if defined(M68060)
 int m68060_pcr_init = 0x21;    /* make this patchable */
 #endif
@@ -367,9 +365,8 @@
                        fputype = FPU_NONE;
                }
        }
-       snprintf(cpu_model, sizeof(cpu_model), "%s (%s CPU%s%s)", mach,
-           cpu_type, mmu, fpu);
-       printf("%s\n", cpu_model);
+       cpu_setmodel("%s (%s CPU%s%s)", mach, cpu_type, mmu, fpu);
+       printf("%s\n", cpu_getmodel());
 }
 
 /*
diff -r e1ca101c89ca -r a03c1d898a19 sys/arch/arc/arc/machdep.c
--- a/sys/arch/arc/arc/machdep.c        Mon Mar 24 20:05:20 2014 +0000
+++ b/sys/arch/arc/arc/machdep.c        Mon Mar 24 20:06:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.127 2013/12/16 15:46:57 mrg Exp $        */
+/*     $NetBSD: machdep.c,v 1.128 2014/03/24 20:06:31 christos Exp $   */
 /*     $OpenBSD: machdep.c,v 1.36 1999/05/22 21:22:19 weingart Exp $   */
 
 /*
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.127 2013/12/16 15:46:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.128 2014/03/24 20:06:31 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_ddbparam.h"
@@ -68,6 +68,7 @@
 #include <sys/syscallargs.h>
 #include <sys/kcore.h>
 #include <sys/ksyms.h>
+#include <sys/cpu.h>
 #include <ufs/mfs/mfs_extern.h>                /* mfs_initminiroot() */
 
 #include <machine/bootinfo.h>
@@ -347,7 +348,7 @@
                curcpu()->ci_divisor_delay /= 2;
                curcpu()->ci_cctr_freq /= 2;
        }
-       sprintf(cpu_model, "%s %s%s",
+       cpu_setmodel("%s %s%s",
            platform->vendor, platform->model, platform->variant);
 
        /*
@@ -507,7 +508,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 e1ca101c89ca -r a03c1d898a19 sys/arch/arm/arm32/bus_dma.c
--- a/sys/arch/arm/arm32/bus_dma.c      Mon Mar 24 20:05:20 2014 +0000
+++ b/sys/arch/arm/arm32/bus_dma.c      Mon Mar 24 20:06:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bus_dma.c,v 1.82 2014/02/26 07:57:09 skrll Exp $       */
+/*     $NetBSD: bus_dma.c,v 1.83 2014/03/24 20:06:31 christos Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_arm_bus_space.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.82 2014/02/26 07:57:09 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.83 2014/03/24 20:06:31 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1389,7 +1389,7 @@
        printf("dmamem_unmap: t=%p kva=%p size=%zx\n", t, kva, size);
 #endif /* DEBUG_DMA */
        KASSERTMSG(((uintptr_t)kva & PAGE_MASK) == 0,
-           "kva %p (%#"PRIxPTR")", kva, (uintptr_t)kva & PAGE_MASK);
+           "kva %p (%#"PRIxPTR")", kva, ((uintptr_t)kva & PAGE_MASK));
 
        size = round_page(size);
        pmap_kremove((vaddr_t)kva, size);
diff -r e1ca101c89ca -r a03c1d898a19 sys/arch/arm/arm32/cpu.c
--- a/sys/arch/arm/arm32/cpu.c  Mon Mar 24 20:05:20 2014 +0000
+++ b/sys/arch/arm/arm32/cpu.c  Mon Mar 24 20:06:31 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.102 2014/03/20 22:19:38 matt Exp $   */
+/*     $NetBSD: cpu.c,v 1.103 2014/03/24 20:06:31 christos Exp $       */
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.102 2014/03/20 22:19:38 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.103 2014/03/24 20:06:31 christos Exp $");
 
 #include <sys/systm.h>
 #include <sys/conf.h>
@@ -60,7 +60,6 @@
 #include <arm/locore.h>
 #include <arm/undefined.h>
 
-char cpu_model[256];
 extern const char *cpu_arch;
 
 #ifdef MULTIPROCESSOR
@@ -164,8 +163,8 @@
         * and we are done if this is a secondary processor.
         */
        if (!CPU_IS_PRIMARY(ci)) {
-               aprint_naive(": %s\n", cpu_model);
-               aprint_normal(": %s\n", cpu_model);
+               aprint_naive(": %s\n", cpu_getmodel());
+               aprint_normal(": %s\n", cpu_getmodel());
                mi_cpu_attach(ci);
                return;
        }
@@ -606,8 +605,8 @@
                        cpu_arch = cpuids[i].cpu_arch;
                        steppingstr = cpuids[i].cpu_steppings[cpuid &
                            CPU_ID_REVISION_MASK];



Home | Main Index | Thread Index | Old Index