Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sparc/sparc - convert CPU_INFO_ITERATOR in the !MP ...



details:   https://anonhg.NetBSD.org/src/rev/f9c5f5026a1f
branches:  trunk
changeset: 791412:f9c5f5026a1f
user:      mrg <mrg%NetBSD.org@localhost>
date:      Sat Nov 16 23:54:01 2013 +0000

description:
- 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

diffstat:

 sys/arch/sparc/sparc/cpu.c          |   7 ++++---
 sys/arch/sparc/sparc/cpuvar.h       |   7 ++++---
 sys/arch/sparc/sparc/intr.c         |   8 ++++----
 sys/arch/sparc/sparc/msiiep.c       |   9 +++++----
 sys/arch/sparc/sparc/pmap.c         |   6 +++---
 sys/arch/sparc/sparc/timer_msiiep.c |  15 +++++----------
 sys/arch/sparc/sparc/timer_sun4m.c  |   9 +++++----
 7 files changed, 30 insertions(+), 31 deletions(-)

diffs (241 lines):

diff -r 6d614f26979c -r f9c5f5026a1f sys/arch/sparc/sparc/cpu.c
--- a/sys/arch/sparc/sparc/cpu.c        Sat Nov 16 17:58:27 2013 +0000
+++ b/sys/arch/sparc/sparc/cpu.c        Sat Nov 16 23:54:01 2013 +0000
@@ -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 @@
 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 */
diff -r 6d614f26979c -r f9c5f5026a1f sys/arch/sparc/sparc/cpuvar.h
--- a/sys/arch/sparc/sparc/cpuvar.h     Sat Nov 16 17:58:27 2013 +0000
+++ b/sys/arch/sparc/sparc/cpuvar.h     Sat Nov 16 23:54:01 2013 +0000
@@ -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 @@
 #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 @@
  */
 #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
 
 
diff -r 6d614f26979c -r f9c5f5026a1f sys/arch/sparc/sparc/intr.c
--- a/sys/arch/sparc/sparc/intr.c       Sat Nov 16 17:58:27 2013 +0000
+++ b/sys/arch/sparc/sparc/intr.c       Sat Nov 16 23:54:01 2013 +0000
@@ -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 @@
 
                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;
diff -r 6d614f26979c -r f9c5f5026a1f sys/arch/sparc/sparc/msiiep.c
--- a/sys/arch/sparc/sparc/msiiep.c     Sat Nov 16 17:58:27 2013 +0000
+++ b/sys/arch/sparc/sparc/msiiep.c     Sat Nov 16 23:54:01 2013 +0000
@@ -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 @@
        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) {
+#ifdef DIAGNOSTICS
+               uint32_t mid;
+
                mid = bus_space_read_4(ma->ma_bustag, hmid, 0);
-#ifdef DIAGNOSTICS
                printf("MID: %08x\n", mid);
 #endif
                msiiep_mid = (volatile uint32_t *)bus_space_vaddr(ma->ma_bustag,
diff -r 6d614f26979c -r f9c5f5026a1f sys/arch/sparc/sparc/pmap.c
--- a/sys/arch/sparc/sparc/pmap.c       Sat Nov 16 17:58:27 2013 +0000
+++ b/sys/arch/sparc/sparc/pmap.c       Sat Nov 16 23:54:01 2013 +0000
@@ -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 @@
 
 #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));
diff -r 6d614f26979c -r f9c5f5026a1f sys/arch/sparc/sparc/timer_msiiep.c
--- a/sys/arch/sparc/sparc/timer_msiiep.c       Sat Nov 16 17:58:27 2013 +0000
+++ b/sys/arch/sparc/sparc/timer_msiiep.c       Sat Nov 16 23:54:01 2013 +0000
@@ -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 @@
         */
        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 @@
 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 @@
 {
        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);
 
diff -r 6d614f26979c -r f9c5f5026a1f sys/arch/sparc/sparc/timer_sun4m.c
--- a/sys/arch/sparc/sparc/timer_sun4m.c        Sat Nov 16 17:58:27 2013 +0000
+++ b/sys/arch/sparc/sparc/timer_sun4m.c        Sat Nov 16 23:54:01 2013 +0000
@@ -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 @@
 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 @@
        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);



Home | Main Index | Thread Index | Old Index