svn commit: r295252 - in head/sys/arm: arm include

Michal Meloun mmel at FreeBSD.org
Thu Feb 4 12:11:20 UTC 2016


Author: mmel
Date: Thu Feb  4 12:11:18 2016
New Revision: 295252
URL: https://svnweb.freebsd.org/changeset/base/295252

Log:
  ARM: Don't use ugly (and hidden) global variable, control register is
  readable at any time.

Modified:
  head/sys/arm/arm/cpufunc.c
  head/sys/arm/arm/identcpu.c
  head/sys/arm/include/cpufunc.h

Modified: head/sys/arm/arm/cpufunc.c
==============================================================================
--- head/sys/arm/arm/cpufunc.c	Thu Feb  4 12:06:06 2016	(r295251)
+++ head/sys/arm/arm/cpufunc.c	Thu Feb  4 12:11:18 2016	(r295252)
@@ -88,8 +88,6 @@ u_int	arm_cache_level;
 u_int	arm_cache_type[14];
 u_int	arm_cache_loc;
 
-int ctrl;
-
 #ifdef CPU_ARM9
 struct cpu_functions arm9_cpufuncs = {
 	/* CPU functions */
@@ -889,7 +887,6 @@ arm9_setup(void)
 
 	/* Set the control register */
 	cpu_control(cpuctrlmask, cpuctrl);
-	ctrl = cpuctrl;
 
 }
 #endif	/* CPU_ARM9 */
@@ -928,7 +925,6 @@ arm10_setup(void)
 		cpuctrl |= CPU_CONTROL_VECRELOC;
 
 	/* Set the control register */
-	ctrl = cpuctrl;
 	cpu_control(0xffffffff, cpuctrl);
 
 	/* And again. */
@@ -1032,7 +1028,6 @@ arm11x6_setup(void)
 	cp15_cpacr_set(0x0fffffff);
 
 	/* Set the control register */
-	ctrl = cpuctrl;
 	cpu_control(~cpuctrl_wax, cpuctrl);
 
 	tmp = cp15_actlr_get();
@@ -1074,7 +1069,6 @@ pj4bv7_setup(void)
 	cpu_idcache_wbinv_all();
 
 	/* Set the control register */
-	ctrl = cpuctrl;
 	cpu_control(0xFFFFFFFF, cpuctrl);
 
 	/* And again. */
@@ -1120,7 +1114,6 @@ cortexa_setup(void)
 	cpu_idcache_wbinv_all();
 
 	/* Set the control register */
-	ctrl = cpuctrl;
 	cpu_control(cpuctrlmask, cpuctrl);
 
 	/* And again. */
@@ -1167,7 +1160,6 @@ fa526_setup(void)
 	cpu_idcache_wbinv_all();
 
 	/* Set the control register */
-	ctrl = cpuctrl;
 	cpu_control(0xffffffff, cpuctrl);
 }
 #endif	/* CPU_FA526 */
@@ -1221,7 +1213,6 @@ xscale_setup(void)
 	 * Set the control register.  Note that bits 6:3 must always
 	 * be set to 1.
 	 */
-	ctrl = cpuctrl;
 /*	cpu_control(cpuctrlmask, cpuctrl);*/
 	cpu_control(0xffffffff, cpuctrl);
 

Modified: head/sys/arm/arm/identcpu.c
==============================================================================
--- head/sys/arm/arm/identcpu.c	Thu Feb  4 12:06:06 2016	(r295251)
+++ head/sys/arm/arm/identcpu.c	Thu Feb  4 12:11:18 2016	(r295252)
@@ -321,7 +321,6 @@ print_enadis(int enadis, char *s)
 	printf(" %s %sabled", s, (enadis == 0) ? "dis" : "en");
 }
 
-extern int ctrl;
 enum cpu_class cpu_class = CPU_CLASS_NONE;
 
 u_int cpu_pfr(int num)
@@ -388,9 +387,10 @@ void
 identify_arm_cpu(void)
 {
 	u_int cpuid, reg, size, sets, ways;
-	u_int8_t type, linesize;
+	u_int8_t type, linesize, ctrl;
 	int i;
 
+	ctrl = cpu_get_control();
 	cpuid = cpu_ident();
 
 	if (cpuid == 0) {

Modified: head/sys/arm/include/cpufunc.h
==============================================================================
--- head/sys/arm/include/cpufunc.h	Thu Feb  4 12:06:06 2016	(r295251)
+++ head/sys/arm/include/cpufunc.h	Thu Feb  4 12:11:18 2016	(r295252)
@@ -202,6 +202,7 @@ u_int	cpufunc_control		(u_int clear, u_i
 void	cpu_domains		(u_int domains);
 u_int	cpu_faultstatus		(void);
 u_int	cpu_faultaddress	(void);
+u_int	cpu_get_control		(void);
 u_int	cpu_pfr			(int);
 
 #if defined(CPU_FA526)


More information about the svn-src-all mailing list