Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm Add a CPU_IS_ARMV7_P() macro (nonv7 evals to fa...



details:   https://anonhg.NetBSD.org/src/rev/d2953387ebe3
branches:  trunk
changeset: 789405:d2953387ebe3
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Aug 18 07:57:26 2013 +0000

description:
Add a CPU_IS_ARMV7_P() macro (nonv7 evals to false, v7 only true, otherwise
cpu_armv7_p is checked (and is set by cpuconf for cortex and pj4b).

diffstat:

 sys/arch/arm/arm/cpufunc.c    |  14 ++++++++++++--
 sys/arch/arm/include/locore.h |  28 ++++++++++++++++++----------
 2 files changed, 30 insertions(+), 12 deletions(-)

diffs (106 lines):

diff -r 0d874c8220f4 -r d2953387ebe3 sys/arch/arm/arm/cpufunc.c
--- a/sys/arch/arm/arm/cpufunc.c        Sun Aug 18 07:55:28 2013 +0000
+++ b/sys/arch/arm/arm/cpufunc.c        Sun Aug 18 07:57:26 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.c,v 1.124 2013/08/18 06:50:31 matt Exp $       */
+/*     $NetBSD: cpufunc.c,v 1.125 2013/08/18 07:57:27 matt Exp $       */
 
 /*
  * arm7tdmi support code Copyright (c) 2001 John Fremlin
@@ -49,7 +49,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.124 2013/08/18 06:50:31 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.125 2013/08/18 07:57:27 matt Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_cpuoptions.h"
@@ -92,6 +92,10 @@
 struct arm_pmc_funcs *arm_pmc;
 #endif
 
+#if defined(CPU_ARMV7) && (defined(CPU_ARMV6) || defined(CPU_PRE_ARMV6))
+bool cpu_armv7_p;
+#endif
+
 /* PRIMARY CACHE VARIABLES */
 #if (ARM_MMU_V6 + ARM_MMU_V7) != 0
 u_int  arm_cache_prefer_mask;
@@ -2062,6 +2066,9 @@
        if (CPU_ID_CORTEX_P(cputype)) {
                cpufuncs = cortex_cpufuncs;
                cpu_do_powersave = 1;                   /* Enable powersave */
+#if defined(CPU_ARMV6) || defined(CPU_PRE_ARMV6)
+               cpu_armv7_p = true;
+#endif
                get_cachetype_cp15();
                pmap_pte_init_armv7();
                if (arm_cache_prefer_mask)
@@ -2083,6 +2090,9 @@
            cputype == CPU_ID_ARM_88SV581X_V7) &&
            (armreg_pfr0_read() & ARM_PFR0_THUMBEE_MASK)) {
                        cpufuncs = pj4bv7_cpufuncs;
+#if defined(CPU_ARMV6) || defined(CPU_PRE_ARMV6)
+                       cpu_armv7_p = true;
+#endif
                        get_cachetype_cp15();
                        pmap_pte_init_armv7();
                        return 0;
diff -r 0d874c8220f4 -r d2953387ebe3 sys/arch/arm/include/locore.h
--- a/sys/arch/arm/include/locore.h     Sun Aug 18 07:55:28 2013 +0000
+++ b/sys/arch/arm/include/locore.h     Sun Aug 18 07:57:26 2013 +0000
@@ -48,17 +48,16 @@
 #ifndef _ARM_LOCORE_H_
 #define _ARM_LOCORE_H_
 
+#ifdef _KERNEL_OPT
+#include "opt_cpuoptions.h"
+#include "opt_cputypes.h"
+#endif
+
 #include <arm/cpuconf.h>
 #include <arm/armreg.h>
 
 #include <machine/frame.h>
 
-#ifndef _LOCORE
-/* 1 == use cpu_sleep(), 0 == don't */
-extern int cpu_do_powersave;
-extern int cpu_fpu_present;
-#endif
-
 #ifdef _LOCORE
 
 #if defined(_ARM_ARCH_6)
@@ -104,10 +103,6 @@
 #define IRQenable set_r15(R15_IRQ_DISABLE, 0);
 #endif
 
-#endif /* !_LOCORE */
-
-#ifndef _LOCORE
-
 /*
  * Validate a PC or PSR for a user process.  Used by various system calls
  * that take a context passed by the user and restore it.
@@ -150,6 +145,19 @@
 void   cpu_attach(device_t, cpuid_t);
 #endif
 
+/* 1 == use cpu_sleep(), 0 == don't */
+extern int cpu_do_powersave;
+extern int cpu_fpu_present;
+
+#if !defined(CPU_ARMV7)
+#define        CPU_IS_ARMV7_P()                false
+#elif defined(CPU_ARMV6) || defined(CPU_PRE_ARMV6)
+extern bool cpu_armv7_p;
+#define        CPU_IS_ARMV7_P()                (cpu_armv7_p)
+#else
+#define        CPU_IS_ARMV7_P()                true
+#endif
+
 /*
  * Random cruft
  */



Home | Main Index | Thread Index | Old Index