Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mvme68k use cpu_{g,s}etmodel
details: https://anonhg.NetBSD.org/src/rev/e9dc2e6fd8d1
branches: trunk
changeset: 328044:e9dc2e6fd8d1
user: christos <christos%NetBSD.org@localhost>
date: Mon Mar 24 19:52:27 2014 +0000
description:
use cpu_{g,s}etmodel
fix unused
diffstat:
sys/arch/mvme68k/dev/sbic.c | 6 +-
sys/arch/mvme68k/mvme68k/machdep.c | 92 ++++++++++++++-----------------------
sys/arch/mvme68k/mvme68k/trap.c | 6 +-
3 files changed, 41 insertions(+), 63 deletions(-)
diffs (245 lines):
diff -r 3a7e0a318f17 -r e9dc2e6fd8d1 sys/arch/mvme68k/dev/sbic.c
--- a/sys/arch/mvme68k/dev/sbic.c Mon Mar 24 19:46:24 2014 +0000
+++ b/sys/arch/mvme68k/dev/sbic.c Mon Mar 24 19:52:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sbic.c,v 1.33 2012/10/27 17:18:04 chs Exp $ */
+/* $NetBSD: sbic.c,v 1.34 2014/03/24 19:52:27 christos Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
@@ -86,7 +86,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sbic.c,v 1.33 2012/10/27 17:18:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbic.c,v 1.34 2014/03/24 19:52:27 christos Exp $");
#include "opt_ddb.h"
@@ -900,6 +900,7 @@
SBIC_WAIT(regs, SBIC_ASR_INT, 0);
GET_SBIC_csr(regs, csr); /* clears interrupt also */
+ __USE(csr);
/*
* Set up various chip parameters
@@ -1258,6 +1259,7 @@
} else {
u_char foo;
GET_SBIC_data (regs, foo);
+ __USE(foo);
}
wait = sbic_data_wait;
}
diff -r 3a7e0a318f17 -r e9dc2e6fd8d1 sys/arch/mvme68k/mvme68k/machdep.c
--- a/sys/arch/mvme68k/mvme68k/machdep.c Mon Mar 24 19:46:24 2014 +0000
+++ b/sys/arch/mvme68k/mvme68k/machdep.c Mon Mar 24 19:52:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.152 2012/07/28 19:08:24 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.152 2012/07/28 19:08:24 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.153 2014/03/24 19:52:27 christos Exp $");
#include "opt_ddb.h"
#include "opt_m060sp.h"
@@ -71,6 +71,7 @@
#include <sys/ksyms.h>
#include <sys/module.h>
#include <sys/device.h>
+#include <sys/cpu.h>
#include "ksyms.h"
@@ -478,51 +479,39 @@
initcpu();
}
-/*
- * Info for CTL_HW
- */
-char cpu_model[124];
-
void
identifycpu(void)
{
char board_str[16];
- char cpu_str[32];
- char mmu_str[16];
- char fpu_str[16];
- int len = 0;
-
- memset(cpu_model, 0, sizeof(cpu_model));
- memset(board_str, 0, sizeof(board_str));
- memset(cpu_str, 0, sizeof(cpu_str));
- memset(mmu_str, 0, sizeof(mmu_str));
- memset(fpu_str, 0, sizeof(fpu_str));
+ const char *cpu_str, *mmu_str, *fpu_str, *cache_str;
/* Fill in the CPU string. */
switch (cputype) {
#ifdef M68020
case CPU_68020:
- sprintf(cpu_str, "MC68020 CPU");
- sprintf(fpu_str, "MC68881 FPU"); /* XXX */
+ cpu_str = "MC68020 CPU";
+ fpu_str = ", MC68881 FPU"; /* XXX */
break;
#endif
#ifdef M68030
case CPU_68030:
- sprintf(cpu_str, "MC68030 CPU+MMU");
- sprintf(fpu_str, "MC68882 FPU"); /* XXX */
+ cpu_str = "MC68030 CPU+MMU";
+ fpu_str = ", MC68882 FPU"; /* XXX */
break;
#endif
#ifdef M68040
case CPU_68040:
- sprintf(cpu_str, "MC68040 CPU+MMU+FPU");
+ cpu_str = "MC68040 CPU+MMU+FPU";
+ fpu_str = "";
break;
#endif
#ifdef M68060
case CPU_68060:
- sprintf(cpu_str, "MC68060 CPU+MMU+FPU");
+ cpu_str = "MC68060 CPU+MMU+FPU";
+ fpu_str = "";
break;
#endif
@@ -534,40 +523,31 @@
/* Fill in the MMU string; only need to handle one case. */
switch (mmutype) {
case MMU_68851:
- sprintf(mmu_str, "MC68851 MMU");
+ mmu_str = ", MC68851 MMU";
+ break;
+ default:
+ mmu_str = "";
break;
}
- /* XXX Find out FPU type and fill in string here. */
-
/* Fill in board model string. */
switch (machineid) {
-#ifdef MVME147
+#if defined(MVME_147) || defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177)
case MVME_147:
- {
- char *suffix = (char *)&boardid.suffix;
- len = sprintf(board_str, "%x", machineid);
- if (suffix[0] != '\0') {
- board_str[len++] = suffix[0];
- if (suffix[1] != '\0')
- board_str[len++] = suffix[1];
- }
- break;
- }
-#endif
-
-#if defined(MVME162) || defined(MVME167) || defined(MVME172) || defined(MVME177)
case MVME_162:
case MVME_167:
case MVME_172:
case MVME_177:
{
char *suffix = (char *)&boardid.suffix;
- len = sprintf(board_str, "%x", machineid);
- if (suffix[0] != '\0') {
+ int len = snprintf(board_str, sizeof(board_str), "%x",
+ machineid);
+ if (suffix[0] != '\0' && len > 0 &&
+ len + 3 < sizeof(board_str)) {
board_str[len++] = suffix[0];
if (suffix[1] != '\0')
board_str[len++] = suffix[1];
+ board_str[len] = '\0';
}
break;
}
@@ -577,33 +557,29 @@
panic("startup");
}
- len = sprintf(cpu_model, "Motorola MVME-%s: %d.%dMHz %s", board_str,
- cpuspeed / 100, (cpuspeed % 100) / 10, cpu_str);
-
- cpuspeed /= 100;
-
- if (mmu_str[0] != '\0')
- len += sprintf(cpu_model + len, ", %s", mmu_str);
-
- if (fpu_str[0] != '\0')
- len += sprintf(cpu_model + len, ", %s", fpu_str);
-
-#if defined(M68040) || defined(M68060)
switch (cputype) {
#if defined(M68040)
case CPU_68040:
- strcat(cpu_model, ", 4k+4k on-chip physical I/D caches");
+ cache_str = ", 4k+4k on-chip physical I/D caches";
break;
#endif
#if defined(M68060)
case CPU_68060:
- strcat(cpu_model, ", 8k+8k on-chip physical I/D caches");
+ cache_str = ", 8k+8k on-chip physical I/D caches";
break;
#endif
+ default:
+ cache_str = "";
+ break;
}
-#endif
- printf("%s\n", cpu_model);
+ cpu_setmodel("Motorola MVME-%s: %d.%dMHz %s%s%s%s",
+ board_str, cpuspeed / 100, (cpuspeed % 100) / 10, cpu_str,
+ mmu_str, fpu_str, cache_str);
+
+ cpuspeed /= 100;
+
+ printf("%s\n", cpu_getmodel());
}
/*
diff -r 3a7e0a318f17 -r e9dc2e6fd8d1 sys/arch/mvme68k/mvme68k/trap.c
--- a/sys/arch/mvme68k/mvme68k/trap.c Mon Mar 24 19:46:24 2014 +0000
+++ b/sys/arch/mvme68k/mvme68k/trap.c Mon Mar 24 19:52:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.106 2012/02/19 21:06:21 rmind Exp $ */
+/* $NetBSD: trap.c,v 1.107 2014/03/24 19:52:27 christos Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.106 2012/02/19 21:06:21 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.107 2014/03/24 19:52:27 christos Exp $");
#include "opt_ddb.h"
#include "opt_execfmt.h"
@@ -283,7 +283,7 @@
int s;
int rv;
u_quad_t sticks = 0 /* XXX initialiser works around compiler bug */;
- static int panicking = 0;
+ static int panicking __diagused;
curcpu()->ci_data.cpu_ntrap++;
l = curlwp;
Home |
Main Index |
Thread Index |
Old Index