Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Rename 'ncpus' to 'sparc_ncpus' to avoid shadow war...



details:   https://anonhg.NetBSD.org/src/rev/b0dde12d281c
branches:  trunk
changeset: 582085:b0dde12d281c
user:      briggs <briggs%NetBSD.org@localhost>
date:      Thu Jun 16 04:17:49 2005 +0000

description:
Rename 'ncpus' to 'sparc_ncpus' to avoid shadow warnings in m.i. code.
Also sprinkle an __UNVOLATILE() for sparc.
n.b. sparc64 'cpus' should probably be renamed to 'cpu_info_list' to
     match i386 et al.

diffstat:

 sys/arch/sparc/include/cpu.h        |   4 +-
 sys/arch/sparc/sparc/autoconf.c     |   6 ++--
 sys/arch/sparc/sparc/cache.c        |   6 ++--
 sys/arch/sparc/sparc/cpu.c          |  43 ++++++++++++++++++------------------
 sys/arch/sparc/sparc/cpuvar.h       |   4 +-
 sys/arch/sparc/sparc/db_interface.c |   6 ++--
 sys/arch/sparc/sparc/intr.c         |  10 ++++----
 sys/arch/sparc/sparc/machdep.c      |   6 ++--
 sys/arch/sparc/sparc/pmap.c         |  30 ++++++++++++-------------
 sys/arch/sparc/sparc/timer_sun4m.c  |  10 ++++----
 sys/arch/sparc64/include/cpu.h      |   4 +-
 sys/arch/sparc64/sparc64/autoconf.c |  10 ++++----
 sys/arch/sparc64/sparc64/cpu.c      |   6 ++--
 sys/arch/sparc64/sparc64/pmap.c     |   6 ++--
 14 files changed, 75 insertions(+), 76 deletions(-)

diffs (truncated from 633 to 300 lines):

diff -r 6369643ec364 -r b0dde12d281c sys/arch/sparc/include/cpu.h
--- a/sys/arch/sparc/include/cpu.h      Thu Jun 16 00:04:25 2005 +0000
+++ b/sys/arch/sparc/include/cpu.h      Thu Jun 16 04:17:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.71 2005/06/03 22:15:49 martin Exp $ */
+/*     $NetBSD: cpu.h,v 1.72 2005/06/16 04:17:49 briggs Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -157,7 +157,7 @@
 extern int cpu_arch;
 
 /* Number of CPUs in the system */
-extern int ncpus;
+extern int sparc_ncpus;
 
 /*
  * Interrupt handler chains.  Interrupt handlers should return 0 for
diff -r 6369643ec364 -r b0dde12d281c sys/arch/sparc/sparc/autoconf.c
--- a/sys/arch/sparc/sparc/autoconf.c   Thu Jun 16 00:04:25 2005 +0000
+++ b/sys/arch/sparc/sparc/autoconf.c   Thu Jun 16 04:17:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.209 2005/06/03 22:15:48 martin Exp $ */
+/*     $NetBSD: autoconf.c,v 1.210 2005/06/16 04:17:49 briggs Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -48,7 +48,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.209 2005/06/03 22:15:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.210 2005/06/16 04:17:49 briggs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -276,7 +276,7 @@
        prom_init();
 
        /* Find the number of CPUs as early as possible */
-       ncpus = find_cpus();
+       sparc_ncpus = find_cpus();
 
        /* Attach user structure to proc0 */
        lwp0.l_addr = proc0paddr;
diff -r 6369643ec364 -r b0dde12d281c sys/arch/sparc/sparc/cache.c
--- a/sys/arch/sparc/sparc/cache.c      Thu Jun 16 00:04:25 2005 +0000
+++ b/sys/arch/sparc/sparc/cache.c      Thu Jun 16 04:17:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cache.c,v 1.92 2005/06/03 22:15:48 martin Exp $ */
+/*     $NetBSD: cache.c,v 1.93 2005/06/16 04:17:49 briggs Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.92 2005/06/03 22:15:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cache.c,v 1.93 2005/06/16 04:17:49 briggs Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -247,7 +247,7 @@
         * Enable instruction cache and, on single-processor machines,
         * disable `Unimplemented Flush Traps'.
         */
-       v = HYPERSPARC_ICCR_ICE | (ncpus <= 1 ? HYPERSPARC_ICCR_FTD : 0);
+       v = HYPERSPARC_ICCR_ICE | (sparc_ncpus <= 1 ? HYPERSPARC_ICCR_FTD : 0);
        wrasr(v, HYPERSPARC_ASRNUM_ICCR);
 }
 
diff -r 6369643ec364 -r b0dde12d281c sys/arch/sparc/sparc/cpu.c
--- a/sys/arch/sparc/sparc/cpu.c        Thu Jun 16 00:04:25 2005 +0000
+++ b/sys/arch/sparc/sparc/cpu.c        Thu Jun 16 04:17:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.190 2005/06/03 22:15:48 martin Exp $ */
+/*     $NetBSD: cpu.c,v 1.191 2005/06/16 04:17:49 briggs Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.190 2005/06/03 22:15:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.191 2005/06/16 04:17:49 briggs Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -101,7 +101,7 @@
 char   cpu_model[100];                 /* machine model (primary CPU) */
 extern char machine_model[];
 
-int    ncpus;                          /* # of CPUs detected by PROM */
+int    sparc_ncpus;                    /* # of CPUs detected by PROM */
 struct cpu_info **cpus;
 u_int  cpu_ready_mask;                 /* the set of CPUs marked as READY */
 static int cpu_instance;               /* current # of CPUs wired by us */
@@ -427,8 +427,8 @@
        if (cpus == NULL) {
                extern struct pcb idle_u[];
 
-               cpus = malloc(ncpus * sizeof(cpi), M_DEVBUF, M_NOWAIT);
-               bzero(cpus, ncpus * sizeof(cpi));
+               cpus = malloc(sparc_ncpus * sizeof(cpi), M_DEVBUF, M_NOWAIT);
+               bzero(cpus, sparc_ncpus * sizeof(cpi));
 
                getcpuinfo(&cpuinfo, node);
 
@@ -492,7 +492,7 @@
        cpi->mid = mid;
        cpi->node = node;
 
-       if (ncpus > 1) {
+       if (sparc_ncpus > 1) {
                printf(": mid %d", mid);
                if (mid == 0 && !CPU_ISSUN4D)
                        printf(" [WARNING: mid should not be 0]");
@@ -524,14 +524,14 @@
 
        cache_print(sc);
 
-       if (ncpus > 1 && cpu_instance == ncpus) {
+       if (sparc_ncpus > 1 && cpu_instance == sparc_ncpus) {
                int n;
                /*
                 * Install MP cache flush functions, unless the
                 * single-processor versions are no-ops.
                 */
-               for (n = 0; n < ncpus; n++) {
-                       struct cpu_info *cpi = cpus[n];
+               for (n = 0; n < sparc_ncpus; n++) {
+                       cpi = cpus[n];
                        if (cpi == NULL)
                                continue;
 #define SET_CACHE_FUNC(x) \
@@ -554,14 +554,14 @@
 {
        int n;
 
-       if (cpu_instance != ncpus) {
+       if (cpu_instance != sparc_ncpus) {
                printf("NOTICE: only %d out of %d CPUs were configured\n",
-                       cpu_instance, ncpus);
+                       cpu_instance, sparc_ncpus);
                return;
        }
 
        printf("cpu0: booting secondary processors:");
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
 
                if (cpi == NULL || cpuinfo.mid == cpi->mid ||
@@ -647,7 +647,8 @@
         * Wait for this CPU to spin up.
         */
        for (n = 10000; n != 0; n--) {
-               cache_flush((caddr_t)&cpi->flags, sizeof(cpi->flags));
+               cache_flush((caddr_t) __UNVOLATILE(&cpi->flags),
+                           sizeof(cpi->flags));
                if (cpi->flags & CPUFLG_HATCHED)
                        return;
                delay(100);
@@ -708,7 +709,7 @@
         * finished by the time we start looking.
         */
        fasttrap = trap != NULL ? 1 : 0;
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
 
                /* Note: n == cpi->ci_cpuid */
@@ -748,7 +749,7 @@
                }
 
                done = 1;
-               for (n = 0; n < ncpus; n++) {
+               for (n = 0; n < sparc_ncpus; n++) {
                        struct cpu_info *cpi = cpus[n];
 
                        if ((cpuset & (1 << n)) == 0)
@@ -782,7 +783,7 @@
        if (cpus == NULL)
                return;
 
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
 
                if (cpi == NULL || cpuinfo.mid == cpi->mid)
@@ -809,7 +810,7 @@
        if (cpus == NULL)
                return;
 
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
 
                if (cpi == NULL || cpuinfo.mid == cpi->mid)
@@ -835,7 +836,7 @@
        if (cpus == NULL)
                return;
 
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
                int r;
 
@@ -862,7 +863,7 @@
        if (cpus == NULL)
                return;
 
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
 
                if (cpi == NULL || cpi->mid == cpuinfo.mid)
@@ -881,7 +882,7 @@
        if (cpus == NULL)
                return;
 
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
 
                if (cpi == NULL || cpuinfo.mid == cpi->mid)
@@ -1787,7 +1788,7 @@
        int n, fatal = 0;
 
        /* Report on MXCC error registers in each module */
-       for (n = 0; n < ncpus; n++) {
+       for (n = 0; n < sparc_ncpus; n++) {
                struct cpu_info *cpi = cpus[n];
 
                if (cpi == NULL)
diff -r 6369643ec364 -r b0dde12d281c sys/arch/sparc/sparc/cpuvar.h
--- a/sys/arch/sparc/sparc/cpuvar.h     Thu Jun 16 00:04:25 2005 +0000
+++ b/sys/arch/sparc/sparc/cpuvar.h     Thu Jun 16 04:17:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpuvar.h,v 1.64 2005/06/03 22:15:48 martin Exp $ */
+/*     $NetBSD: cpuvar.h,v 1.65 2005/06/16 04:17:49 briggs Exp $ */
 
 /*
  *  Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -419,7 +419,7 @@
 
 
 #define CPU_INFO_ITERATOR              int
-#define CPU_INFO_FOREACH(cii, ci)      cii = 0; ci = cpus[cii], cii < ncpus; cii++
+#define CPU_INFO_FOREACH(cii, ci)      cii = 0; ci = cpus[cii], cii < sparc_ncpus; cii++
 
 /*
  * Useful macros.
diff -r 6369643ec364 -r b0dde12d281c sys/arch/sparc/sparc/db_interface.c
--- a/sys/arch/sparc/sparc/db_interface.c       Thu Jun 16 00:04:25 2005 +0000
+++ b/sys/arch/sparc/sparc/db_interface.c       Thu Jun 16 04:17:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.62 2005/06/03 22:15:48 martin Exp $ */
+/*     $NetBSD: db_interface.c,v 1.63 2005/06/16 04:17:49 briggs Exp $ */
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.62 2005/06/03 22:15:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.63 2005/06/16 04:17:49 briggs Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -533,7 +533,7 @@
                return;
        }
        
-       if ((addr < 0) || (addr >= ncpus)) {
+       if ((addr < 0) || (addr >= sparc_ncpus)) {
                db_printf("%ld: CPU out of range\n", addr);
                return;
        }
diff -r 6369643ec364 -r b0dde12d281c sys/arch/sparc/sparc/intr.c
--- a/sys/arch/sparc/sparc/intr.c       Thu Jun 16 00:04:25 2005 +0000
+++ b/sys/arch/sparc/sparc/intr.c       Thu Jun 16 04:17:49 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.86 2005/06/03 22:15:48 martin Exp $ */
+/*     $NetBSD: intr.c,v 1.87 2005/06/16 04:17:49 briggs Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.86 2005/06/03 22:15:48 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.87 2005/06/16 04:17:49 briggs Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"



Home | Main Index | Thread Index | Old Index