summaryrefslogtreecommitdiffstats
path: root/sys/arm
diff options
context:
space:
mode:
authormmel <mmel@FreeBSD.org>2016-02-04 12:11:18 +0000
committermmel <mmel@FreeBSD.org>2016-02-04 12:11:18 +0000
commit444874ded476cb85cea4f20deced485f0aabf91c (patch)
treecd0e5a6c042fddd50b97c13efdc55cb93588bc2b /sys/arm
parent281991463be88ccea048efc7431bace6c07144f6 (diff)
downloadFreeBSD-src-444874ded476cb85cea4f20deced485f0aabf91c.zip
FreeBSD-src-444874ded476cb85cea4f20deced485f0aabf91c.tar.gz
ARM: Don't use ugly (and hidden) global variable, control register is
readable at any time.
Diffstat (limited to 'sys/arm')
-rw-r--r--sys/arm/arm/cpufunc.c9
-rw-r--r--sys/arm/arm/identcpu.c4
-rw-r--r--sys/arm/include/cpufunc.h1
3 files changed, 3 insertions, 11 deletions
diff --git a/sys/arm/arm/cpufunc.c b/sys/arm/arm/cpufunc.c
index 370bab7..a2b8180 100644
--- a/sys/arm/arm/cpufunc.c
+++ b/sys/arm/arm/cpufunc.c
@@ -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);
diff --git a/sys/arm/arm/identcpu.c b/sys/arm/arm/identcpu.c
index 6c5764c..2b7fec4 100644
--- a/sys/arm/arm/identcpu.c
+++ b/sys/arm/arm/identcpu.c
@@ -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) {
diff --git a/sys/arm/include/cpufunc.h b/sys/arm/include/cpufunc.h
index b533002..afbcac8 100644
--- a/sys/arm/include/cpufunc.h
+++ b/sys/arm/include/cpufunc.h
@@ -202,6 +202,7 @@ u_int cpufunc_control (u_int clear, u_int bic);
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)
OpenPOWER on IntegriCloud