From fb105d926ee1212ec80164cbe433e90c8c65eda8 Mon Sep 17 00:00:00 2001 From: christos Date: Mon, 24 Mar 2014 19:52:27 +0000 Subject: [PATCH] use cpu_{g,s}etmodel fix unused --- 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(-) diff --git a/sys/arch/mvme68k/dev/sbic.c b/sys/arch/mvme68k/dev/sbic.c index 921113215291..7ce9000c404c 100644 --- a/sys/arch/mvme68k/dev/sbic.c +++ b/sys/arch/mvme68k/dev/sbic.c @@ -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 -__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 @@ sbicreset(struct sbic_softc *dev) 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 @@ sbicxfin(sbic_regmap_p regs, int len, void *bp) } else { u_char foo; GET_SBIC_data (regs, foo); + __USE(foo); } wait = sbic_data_wait; } diff --git a/sys/arch/mvme68k/mvme68k/machdep.c b/sys/arch/mvme68k/mvme68k/machdep.c index a25d961e08a9..6d9456c46fe4 100644 --- a/sys/arch/mvme68k/mvme68k/machdep.c +++ b/sys/arch/mvme68k/mvme68k/machdep.c @@ -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 -__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 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.152 2012/07/28 19:08:24 matt Exp $"); #include #include #include +#include #include "ksyms.h" @@ -478,51 +479,39 @@ cpu_startup(void) 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 @@ identifycpu(void) /* 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 @@ identifycpu(void) 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 --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 15dcc4798a7a..0b21cabe0255 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -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 -__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 @@ trap(struct frame *fp, int type, unsigned int code, unsigned int v) 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;