Module Name:    src
Committed By:   christos
Date:           Mon Mar 24 19:29:59 UTC 2014

Modified Files:
        src/sys/arch/powerpc/booke: booke_machdep.c
        src/sys/arch/powerpc/ibm4xx: cpu.c
        src/sys/arch/powerpc/include: cpu.h
        src/sys/arch/powerpc/oea: cpu_subr.c oea_machdep.c

Log Message:
use cpu_{g,s}etmodel


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/booke/booke_machdep.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/powerpc/ibm4xx/cpu.c
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/powerpc/include/cpu.h
cvs rdiff -u -r1.81 -r1.82 src/sys/arch/powerpc/oea/cpu_subr.c
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/powerpc/oea/oea_machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/booke/booke_machdep.c
diff -u src/sys/arch/powerpc/booke/booke_machdep.c:1.19 src/sys/arch/powerpc/booke/booke_machdep.c:1.20
--- src/sys/arch/powerpc/booke/booke_machdep.c:1.19	Tue Mar 18 14:20:41 2014
+++ src/sys/arch/powerpc/booke/booke_machdep.c	Mon Mar 24 15:29:59 2014
@@ -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 @@ __KERNEL_RCSID(0, "$NetBSD: booke_machde
 #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 @@ __CTASSERT(__arraycount(cpu_info) == __a
 /*
  * 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 @@ booke_cpu_startup(const char *model)
 	vaddr_t 	minaddr, maxaddr;
 	char 		pbuf[9];
 
-	strlcpy(cpu_model, model, sizeof(cpu_model));
+	cpu_setmodel("%s", model);
 
 	printf("%s%s", copyright, version);
 

Index: src/sys/arch/powerpc/ibm4xx/cpu.c
diff -u src/sys/arch/powerpc/ibm4xx/cpu.c:1.32 src/sys/arch/powerpc/ibm4xx/cpu.c:1.33
--- src/sys/arch/powerpc/ibm4xx/cpu.c:1.32	Tue Jun 21 00:21:16 2011
+++ src/sys/arch/powerpc/ibm4xx/cpu.c	Mon Mar 24 15:29:59 2014
@@ -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 @@ struct cpu_info cpu_info[1] = {
 	}
 };
 
-char cpu_model[80];
-
 bool cpufound;
 
 static int
@@ -257,16 +255,16 @@ cpuattach(device_t parent, device_t self
 	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();

Index: src/sys/arch/powerpc/include/cpu.h
diff -u src/sys/arch/powerpc/include/cpu.h:1.99 src/sys/arch/powerpc/include/cpu.h:1.100
--- src/sys/arch/powerpc/include/cpu.h:1.99	Mon Mar  3 10:36:36 2014
+++ src/sys/arch/powerpc/include/cpu.h	Mon Mar 24 15:29:59 2014
@@ -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.
@@ -361,7 +361,6 @@ extern char *booted_kernel;
 extern int powersave;
 extern int cpu_timebase;
 extern int cpu_printfataltraps;
-extern char cpu_model[];
 
 struct cpu_info *
 	cpu_attach_common(device_t, int);

Index: src/sys/arch/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.81 src/sys/arch/powerpc/oea/cpu_subr.c:1.82
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.81	Fri Mar 14 17:59:41 2014
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Mon Mar 24 15:29:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.81 2014/03/14 21:59:41 mrg Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.82 2014/03/24 19:29:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.81 2014/03/14 21:59:41 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.82 2014/03/24 19:29:59 christos Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -73,7 +73,7 @@ static void cpu_tau_setup(struct cpu_inf
 static void cpu_tau_refresh(struct sysmon_envsys *, envsys_data_t *);
 #endif
 
-int cpu;
+int cpu = -1;
 int ncpus;
 
 struct fmttab {
@@ -255,7 +255,6 @@ int cpu_altivec;
 register_t cpu_psluserset;
 register_t cpu_pslusermod;
 register_t cpu_pslusermask = 0xffff;
-char cpu_model[80];
 
 /* This is to be called from locore.S, and nowhere else. */
 
@@ -772,11 +771,8 @@ cpu_identify(char *str, size_t len)
 			break;
 	}
 
-	if (str == NULL) {
-		str = cpu_model;
-		len = sizeof(cpu_model);
+	if (cpu == -1)
 		cpu = vers;
-	}
 
 	revfmt = cp->revfmt;
 	if (rev == MPC750 && pvr == 15) {

Index: src/sys/arch/powerpc/oea/oea_machdep.c
diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.70 src/sys/arch/powerpc/oea/oea_machdep.c:1.71
--- src/sys/arch/powerpc/oea/oea_machdep.c:1.70	Mon Mar  3 10:36:36 2014
+++ src/sys/arch/powerpc/oea/oea_machdep.c	Mon Mar 24 15:29:59 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: oea_machdep.c,v 1.70 2014/03/03 15:36:36 macallan Exp $	*/
+/*	$NetBSD: oea_machdep.c,v 1.71 2014/03/24 19:29:59 christos Exp $	*/
 
 /*
  * Copyright (C) 2002 Matt Thomas
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.70 2014/03/03 15:36:36 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.71 2014/03/24 19:29:59 christos Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: oea_machdep.
 #include <sys/syscallargs.h>
 #include <sys/syslog.h>
 #include <sys/systm.h>
+#include <sys/cpu.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -936,7 +937,7 @@ oea_startup(const char *model)
 	uintptr_t sz;
 	void *v;
 	vaddr_t minaddr, maxaddr;
-	char pbuf[9];
+	char pbuf[9], mstr[128];
 
 	KASSERT(curcpu() != NULL);
 	KASSERT(lwp0.l_cpu != NULL);
@@ -973,7 +974,8 @@ oea_startup(const char *model)
 	printf("%s%s", copyright, version);
 	if (model != NULL)
 		printf("Model: %s\n", model);
-	cpu_identify(NULL, 0);
+	cpu_identify(mstr, sizeof(mstr));
+	cpu_setmodel("%s", mstr);
 
 	format_bytes(pbuf, sizeof(pbuf), ctob((u_int)physmem));
 	printf("total memory = %s\n", pbuf);

Reply via email to