Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/rmi minor cleanups.



details:   https://anonhg.NetBSD.org/src/rev/2794ad26c380
branches:  trunk
changeset: 764640:2794ad26c380
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Apr 29 22:00:03 2011 +0000

description:
minor cleanups.

diffstat:

 sys/arch/mips/rmi/rmixl_cpu.c        |  17 +++++++----------
 sys/arch/mips/rmi/rmixl_cpucore.c    |  17 ++++++++---------
 sys/arch/mips/rmi/rmixl_cpucorevar.h |  12 +++++++-----
 3 files changed, 22 insertions(+), 24 deletions(-)

diffs (175 lines):

diff -r d0c4801b179a -r 2794ad26c380 sys/arch/mips/rmi/rmixl_cpu.c
--- a/sys/arch/mips/rmi/rmixl_cpu.c     Fri Apr 29 21:59:09 2011 +0000
+++ b/sys/arch/mips/rmi/rmixl_cpu.c     Fri Apr 29 22:00:03 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmixl_cpu.c,v 1.3 2011/04/14 05:12:58 cliff Exp $      */
+/*     $NetBSD: rmixl_cpu.c,v 1.4 2011/04/29 22:00:03 matt Exp $       */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,13 +38,11 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.3 2011/04/14 05:12:58 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.4 2011/04/29 22:00:03 matt Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_ddb.h"
 
-#include "opt_multiprocessor.h"
-
 #include <sys/param.h>
 #include <sys/device.h>
 #include <sys/systm.h>
@@ -100,7 +98,7 @@
 #endif
 
 /*
- * cpu_rmixl_db_watch_init - initialize COP0 watchpoint stuff
+ * cpu_rmixl_watchpoint_init - initialize COP0 watchpoint stuff
  *
  * clear IEU_DEFEATURE[DBE] to ensure T_WATCH on watchpoint exception
  * set COP0 watchhi and watchlo
@@ -108,7 +106,7 @@
  * disable all watchpoints
  */
 static void
-cpu_rmixl_db_watch_init(void)
+cpu_rmixl_watchpoint_init(void)
 {
        uint32_t r;
 
@@ -195,7 +193,7 @@
                mips_locoresw.lsw_cpu_init = cpu_rmixl_hatch;
                mips_locoresw.lsw_cpu_run = cpu_rmixl_run;
        } else {
-               struct cpucore_attach_args *ca = aux;
+               struct cpucore_attach_args * const ca = aux;
                struct cpucore_softc * const ccsc = device_private(parent);
                rmixlfw_psb_type_t psb_type = rmixl_configuration.rc_psb_type;
                cpuid_t cpuid;
@@ -263,7 +261,7 @@
        asm volatile("dmfc0 %0, $15, 1;" : "=r"(ebase));
        ci->ci_cpuid = ebase & __BITS(9,0);
 
-       cpu_rmixl_db_watch_init();
+       cpu_rmixl_watchpoint_init();
 
        rmixl_fmn_init();
 
@@ -280,7 +278,6 @@
                        __func__);
        sc->sc_ih_fmn = ih;
 #endif
-
 }
 
 #ifdef NOTYET
@@ -336,7 +333,7 @@
 
        cpucore_rmixl_hatch(device_parent(sc->sc_dev));
 
-       cpu_rmixl_db_watch_init();
+       cpu_rmixl_watchpoint_init();
 }
 
 static int
diff -r d0c4801b179a -r 2794ad26c380 sys/arch/mips/rmi/rmixl_cpucore.c
--- a/sys/arch/mips/rmi/rmixl_cpucore.c Fri Apr 29 21:59:09 2011 +0000
+++ b/sys/arch/mips/rmi/rmixl_cpucore.c Fri Apr 29 22:00:03 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $  */
+/*     $NetBSD: rmixl_cpucore.c,v 1.5 2011/04/29 22:00:03 matt Exp $   */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,9 +38,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $");
-
-#include "opt_multiprocessor.h"
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.5 2011/04/29 22:00:03 matt Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -93,7 +91,7 @@
 
        sc->sc_dev = self;
        sc->sc_core = na->na_core;
-       sc->sc_hatched = false;
+       KASSERT(sc->sc_hatched == false);
 
 #if 0
 #ifdef MULTIPROCESSOR
@@ -150,7 +148,7 @@
                aprint_normal_dev(self, "threads");
                u_int d = threads_dis;
                while (d != 0) {
-                       u_int t = ffs(d) - 1;
+                       const u_int t = ffs(d) - 1;
                        d ^= (1 << t);
                        aprint_normal(" %d%s", t, (d==0) ? "" : ",");
                }
@@ -159,8 +157,9 @@
 
        u_int threads_try_attach = threads_enb;
        while (threads_try_attach != 0) {
-               u_int t = ffs(threads_try_attach) - 1;
-               threads_try_attach ^= (1 << t);
+               const u_int t = ffs(threads_try_attach) - 1;
+               const u_int bit = 1 << t;
+               threads_try_attach ^= bit;
                ca.ca_name = "cpu";
                ca.ca_thread = t;
                ca.ca_core = sc->sc_core;
@@ -169,11 +168,11 @@
                         * thread did not attach, e.g. not configured
                         * arrange to have it disabled in THREADEN PCR
                         */
-                       u_int bit = 1 << t;
                        threads_enb ^= bit;
                        threads_dis |= bit;
                }
        }
+
        sc->sc_threads_enb = threads_enb;
        sc->sc_threads_dis = threads_dis;
 
diff -r d0c4801b179a -r 2794ad26c380 sys/arch/mips/rmi/rmixl_cpucorevar.h
--- a/sys/arch/mips/rmi/rmixl_cpucorevar.h      Fri Apr 29 21:59:09 2011 +0000
+++ b/sys/arch/mips/rmi/rmixl_cpucorevar.h      Fri Apr 29 22:00:03 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rmixl_cpucorevar.h,v 1.3 2011/04/14 05:15:22 cliff Exp $       */
+/*     $NetBSD: rmixl_cpucorevar.h,v 1.4 2011/04/29 22:00:03 matt Exp $        */
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -37,11 +37,11 @@
 
 struct cpucore_softc {
        device_t        sc_dev;
-       bool            sc_attached;
-       bool            sc_running;
        u_int           sc_core;
        u_int           sc_threads_enb;
        u_int           sc_threads_dis;
+       bool            sc_attached;
+       bool            sc_running;
        bool            sc_hatched;
 #ifdef MULTIPROCESSOR
        struct pmap_tlb_info *sc_tlbinfo;
@@ -54,7 +54,9 @@
        int             ca_thread;
 };
 
-extern void cpucore_rmixl_hatch(device_t);
-extern void cpucore_rmixl_run(device_t);
+#ifdef _KERNEL
+void cpucore_rmixl_hatch(device_t);
+void cpucore_rmixl_run(device_t);
+#endif
 
 #endif /* _ARCH_MIPS_RMI_RMIXL_CPUCOREVAR_H_ */



Home | Main Index | Thread Index | Old Index