- convert CPU_INFO_ITERATOR in the !MP case to be __unused, and convert

all the iterators to use it
- print the right variables in nmi_hard_msiiep() (thanks set-but-unused)
- move variable inside usage #ifdef
- use (void) instead of a "volatile int" junk variable
- remove unused variables
This commit is contained in:
mrg 2013-11-16 23:54:01 +00:00
parent 3033c7dc60
commit 2a627e63bd
7 changed files with 30 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.c,v 1.239 2012/10/27 17:18:12 chs Exp $ */
/* $NetBSD: cpu.c,v 1.240 2013/11/16 23:54:01 mrg Exp $ */
/*
* Copyright (c) 1996
@ -52,7 +52,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.239 2012/10/27 17:18:12 chs Exp $");
__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.240 2013/11/16 23:54:01 mrg Exp $");
#include "opt_multiprocessor.h"
#include "opt_lockdebug.h"
@ -1823,7 +1823,8 @@ int
viking_module_error(void)
{
uint64_t v;
int n = 0, fatal = 0;
int fatal = 0;
CPU_INFO_ITERATOR n;
struct cpu_info *cpi;
/* Report on MXCC error registers in each module */

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpuvar.h,v 1.91 2013/10/19 19:40:23 mrg Exp $ */
/* $NetBSD: cpuvar.h,v 1.92 2013/11/16 23:54:01 mrg Exp $ */
/*
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -421,7 +421,6 @@ struct cpu_info {
#define CPUFLG_GOTMSG 0x4000 /* CPU got an lev13 IPI */
#define CPU_INFO_ITERATOR int
/*
* Provide two forms of CPU_INFO_FOREACH. One fast one for non-modular
* non-SMP kernels, and the other for everyone else. Both work in the
@ -430,8 +429,10 @@ struct cpu_info {
*/
#if defined(MULTIPROCESSOR) || defined(MODULAR) || defined(_MODULE)
#define CPU_INFO_FOREACH(cii, cp) cii = 0; (cp = cpus[cii]) && cp->eintstack && cii < sparc_ncpus; cii++
#define CPU_INFO_ITERATOR int
#else
#define CPU_INFO_FOREACH(cii, cp) cii = 0, cp = curcpu(); cp != NULL; cp = NULL
#define CPU_INFO_FOREACH(cii, cp) cp = curcpu(); cp != NULL; cp = NULL
#define CPU_INFO_ITERATOR int __unused
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.117 2013/04/07 16:32:41 jdc Exp $ */
/* $NetBSD: intr.c,v 1.118 2013/11/16 23:54:01 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.117 2013/04/07 16:32:41 jdc Exp $");
__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.118 2013/11/16 23:54:01 mrg Exp $");
#include "opt_multiprocessor.h"
#include "opt_sparc_arch.h"
@ -420,12 +420,12 @@ nmi_hard_msiiep(void)
if (afsr & MSIIEP_AFSR_ERR) {
snprintb(bits, sizeof(bits), MSIIEP_AFSR_BITS, afsr);
printf("async fault: afsr=%s; afar=%08x\n", bits, afsr);
printf("async fault: afsr=%s; afar=%08x\n", bits, afar);
}
if (mfsr & MSIIEP_MFSR_ERR) {
snprintb(bits, sizeof(bits), MSIIEP_MFSR_BITS, mfsr);
printf("mem fault: mfsr=%s; mfar=%08x\n", bits, mfsr);
printf("mem fault: mfsr=%s; mfar=%08x\n", bits, mfar);
}
fatal = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: msiiep.c,v 1.44 2013/04/16 06:57:06 jdc Exp $ */
/* $NetBSD: msiiep.c,v 1.45 2013/11/16 23:54:01 mrg Exp $ */
/*
* Copyright (c) 2001 Valeriy E. Ushakov
@ -27,7 +27,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msiiep.c,v 1.44 2013/04/16 06:57:06 jdc Exp $");
__KERNEL_RCSID(0, "$NetBSD: msiiep.c,v 1.45 2013/11/16 23:54:01 mrg Exp $");
#include <sys/param.h>
#include <sys/malloc.h>
@ -211,13 +211,14 @@ msiiep_attach(device_t parent, device_t self, void *aux)
struct msiiep_attach_args msa;
bus_space_handle_t hmid;
struct cpu_info *cur;
uint32_t mid;
aprint_normal("\n");
if (bus_space_map(ma->ma_bustag, MSIIEP_MID_PA, 4, 0, &hmid) == 0) {
mid = bus_space_read_4(ma->ma_bustag, hmid, 0);
#ifdef DIAGNOSTICS
uint32_t mid;
mid = bus_space_read_4(ma->ma_bustag, hmid, 0);
printf("MID: %08x\n", mid);
#endif
msiiep_mid = (volatile uint32_t *)bus_space_vaddr(ma->ma_bustag,

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.351 2013/11/01 06:22:46 mrg Exp $ */
/* $NetBSD: pmap.c,v 1.352 2013/11/16 23:54:01 mrg Exp $ */
/*
* Copyright (c) 1996
@ -56,7 +56,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.351 2013/11/01 06:22:46 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.352 2013/11/16 23:54:01 mrg Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@ -2289,7 +2289,7 @@ ctx_free(struct pmap *pm)
#if defined(SUN4M) || defined(SUN4D)
if (CPU_HAS_SRMMU) {
int i;
CPU_INFO_ITERATOR i;
cache_flush_context(ctx);
tlb_flush_context(ctx, PMAP_CPUSET(pm));

View File

@ -1,4 +1,4 @@
/* $NetBSD: timer_msiiep.c,v 1.27 2012/07/31 16:38:37 martin Exp $ */
/* $NetBSD: timer_msiiep.c,v 1.28 2013/11/16 23:54:01 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: timer_msiiep.c,v 1.27 2012/07/31 16:38:37 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: timer_msiiep.c,v 1.28 2013/11/16 23:54:01 mrg Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -148,10 +148,8 @@ timerattach_msiiep(device_t parent, device_t self, void *aux)
*/
for (timerblurb = 1; ; ++timerblurb) {
int t;
volatile uint32_t junk;
/* we need 'junk' to keep the read from getting eliminated */
junk = mspcic_read_4(pcic_pclr); /* clear the limit bit */
(void)mspcic_read_4(pcic_pclr); /* clear the limit bit */
mspcic_write_4(pcic_pclr, 0); /* reset to 1, free run */
delay(100);
t = mspcic_read_4(pcic_pccr);
@ -237,9 +235,7 @@ timer_get_timecount(struct timecounter *tc)
static int
clockintr_msiiep(void *cap)
{
volatile uint32_t junk;
junk = mspcic_read_4(pcic_sclr); /* clear the interrupt */
(void)mspcic_read_4(pcic_sclr); /* clear the interrupt */
/*
* XXX this needs to be fixed in a more general way
@ -268,9 +264,8 @@ statintr_msiiep(void *cap)
{
struct clockframe *frame = cap;
u_long newint;
volatile uint32_t junk;
junk = mspcic_read_4(pcic_pclr); /* clear the interrupt */
(void)mspcic_read_4(pcic_pclr); /* clear the interrupt */
statclock(frame);

View File

@ -1,4 +1,4 @@
/* $NetBSD: timer_sun4m.c,v 1.28 2011/09/01 08:43:24 martin Exp $ */
/* $NetBSD: timer_sun4m.c,v 1.29 2013/11/16 23:54:01 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: timer_sun4m.c,v 1.28 2011/09/01 08:43:24 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: timer_sun4m.c,v 1.29 2013/11/16 23:54:01 mrg Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -87,7 +87,7 @@ void
timer_init_4m(void)
{
struct cpu_info *cpi;
int n;
CPU_INFO_ITERATOR n;
timerreg4m->t_limit = tmr_ustolim4m(tick);
for (CPU_INFO_FOREACH(n, cpi)) {
@ -212,7 +212,8 @@ timerattach_obio_4m(device_t parent, device_t self, void *aux)
struct sbus_attach_args *sa = &uoba->uoba_sbus;
struct cpu_info *cpi;
bus_space_handle_t bh;
int i, n;
int i;
CPU_INFO_ITERATOR n;
if (sa->sa_nreg < 2) {
printf(": only %d register sets\n", sa->sa_nreg);