Sun Oct 20 09:30:41 2013 UTC ()
Use cpuctrlmask in the arm1[01] case.


(skrll)
diff -r1.125 -r1.126 src/sys/arch/arm/arm/cpufunc.c

cvs diff -r1.125 -r1.126 src/sys/arch/arm/arm/cpufunc.c (expand / switch to unified diff)

--- src/sys/arch/arm/arm/cpufunc.c 2013/08/18 07:57:27 1.125
+++ src/sys/arch/arm/arm/cpufunc.c 2013/10/20 09:30:41 1.126
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: cpufunc.c,v 1.125 2013/08/18 07:57:27 matt Exp $ */ 1/* $NetBSD: cpufunc.c,v 1.126 2013/10/20 09:30:41 skrll Exp $ */
2 2
3/* 3/*
4 * arm7tdmi support code Copyright (c) 2001 John Fremlin 4 * arm7tdmi support code Copyright (c) 2001 John Fremlin
5 * arm8 support code Copyright (c) 1997 ARM Limited 5 * arm8 support code Copyright (c) 1997 ARM Limited
6 * arm8 support code Copyright (c) 1997 Causality Limited 6 * arm8 support code Copyright (c) 1997 Causality Limited
7 * arm9 support code Copyright (C) 2001 ARM Ltd 7 * arm9 support code Copyright (C) 2001 ARM Ltd
8 * arm11 support code Copyright (c) 2007 Microsoft 8 * arm11 support code Copyright (c) 2007 Microsoft
9 * cortexa8 support code Copyright (c) 2008 3am Software Foundry 9 * cortexa8 support code Copyright (c) 2008 3am Software Foundry
10 * cortexa8 improvements Copyright (c) Goeran Weinholt 10 * cortexa8 improvements Copyright (c) Goeran Weinholt
11 * Copyright (c) 1997 Mark Brinicombe. 11 * Copyright (c) 1997 Mark Brinicombe.
12 * Copyright (c) 1997 Causality Limited 12 * Copyright (c) 1997 Causality Limited
13 * All rights reserved. 13 * All rights reserved.
14 * 14 *
@@ -39,27 +39,27 @@ @@ -39,27 +39,27 @@
39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
40 * SUCH DAMAGE. 40 * SUCH DAMAGE.
41 * 41 *
42 * RiscBSD kernel project 42 * RiscBSD kernel project
43 * 43 *
44 * cpufuncs.c 44 * cpufuncs.c
45 * 45 *
46 * C functions for supporting CPU / MMU / TLB specific operations. 46 * C functions for supporting CPU / MMU / TLB specific operations.
47 * 47 *
48 * Created : 30/01/97 48 * Created : 30/01/97
49 */ 49 */
50 50
51#include <sys/cdefs.h> 51#include <sys/cdefs.h>
52__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.125 2013/08/18 07:57:27 matt Exp $"); 52__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.126 2013/10/20 09:30:41 skrll Exp $");
53 53
54#include "opt_compat_netbsd.h" 54#include "opt_compat_netbsd.h"
55#include "opt_cpuoptions.h" 55#include "opt_cpuoptions.h"
56#include "opt_perfctrs.h" 56#include "opt_perfctrs.h"
57 57
58#include <sys/types.h> 58#include <sys/types.h>
59#include <sys/param.h> 59#include <sys/param.h>
60#include <sys/pmc.h> 60#include <sys/pmc.h>
61#include <sys/systm.h> 61#include <sys/systm.h>
62#include <machine/cpu.h> 62#include <machine/cpu.h>
63#include <machine/bootconfig.h> 63#include <machine/bootconfig.h>
64#include <arch/arm/arm/disassem.h> 64#include <arch/arm/arm/disassem.h>
65 65
@@ -2861,27 +2861,27 @@ arm10_setup(char *args) @@ -2861,27 +2861,27 @@ arm10_setup(char *args)
2861#ifndef ARM_HAS_VBAR 2861#ifndef ARM_HAS_VBAR
2862 if (vector_page == ARM_VECTORS_HIGH) 2862 if (vector_page == ARM_VECTORS_HIGH)
2863 cpuctrl |= CPU_CONTROL_VECRELOC; 2863 cpuctrl |= CPU_CONTROL_VECRELOC;
2864#endif 2864#endif
2865 2865
2866 /* Clear out the cache */ 2866 /* Clear out the cache */
2867 cpu_idcache_wbinv_all(); 2867 cpu_idcache_wbinv_all();
2868 2868
2869 /* Now really make sure they are clean. */ 2869 /* Now really make sure they are clean. */
2870 __asm volatile ("mcr\tp15, 0, r0, c7, c7, 0" : : ); 2870 __asm volatile ("mcr\tp15, 0, r0, c7, c7, 0" : : );
2871 2871
2872 /* Set the control register */ 2872 /* Set the control register */
2873 curcpu()->ci_ctrl = cpuctrl; 2873 curcpu()->ci_ctrl = cpuctrl;
2874 cpu_control(0xffffffff, cpuctrl); 2874 cpu_control(cpuctrlmask, cpuctrl);
2875 2875
2876 /* And again. */ 2876 /* And again. */
2877 cpu_idcache_wbinv_all(); 2877 cpu_idcache_wbinv_all();
2878} 2878}
2879#endif /* CPU_ARM9E || CPU_ARM10 */ 2879#endif /* CPU_ARM9E || CPU_ARM10 */
2880 2880
2881#if defined(CPU_ARM11) 2881#if defined(CPU_ARM11)
2882struct cpu_option arm11_options[] = { 2882struct cpu_option arm11_options[] = {
2883 { "cpu.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, 2883 { "cpu.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) },
2884 { "cpu.nocache", OR, BIC, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, 2884 { "cpu.nocache", OR, BIC, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) },
2885 { "arm11.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, 2885 { "arm11.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) },
2886 { "arm11.icache", BIC, OR, CPU_CONTROL_IC_ENABLE }, 2886 { "arm11.icache", BIC, OR, CPU_CONTROL_IC_ENABLE },
2887 { "arm11.dcache", BIC, OR, CPU_CONTROL_DC_ENABLE }, 2887 { "arm11.dcache", BIC, OR, CPU_CONTROL_DC_ENABLE },
@@ -2920,27 +2920,27 @@ arm11_setup(char *args) @@ -2920,27 +2920,27 @@ arm11_setup(char *args)
2920#endif 2920#endif
2921 2921
2922 /* Clear out the cache */ 2922 /* Clear out the cache */
2923 cpu_idcache_wbinv_all(); 2923 cpu_idcache_wbinv_all();
2924 2924
2925 /* Now really make sure they are clean. */ 2925 /* Now really make sure they are clean. */
2926 __asm volatile ("mcr\tp15, 0, r0, c7, c7, 0" : : ); 2926 __asm volatile ("mcr\tp15, 0, r0, c7, c7, 0" : : );
2927 2927
2928 /* Allow detection code to find the VFP if it's fitted. */ 2928 /* Allow detection code to find the VFP if it's fitted. */
2929 __asm volatile ("mcr\tp15, 0, %0, c1, c0, 2" : : "r" (0x0fffffff)); 2929 __asm volatile ("mcr\tp15, 0, %0, c1, c0, 2" : : "r" (0x0fffffff));
2930 2930
2931 /* Set the control register */ 2931 /* Set the control register */
2932 curcpu()->ci_ctrl = cpuctrl; 2932 curcpu()->ci_ctrl = cpuctrl;
2933 cpu_control(0xffffffff, cpuctrl); 2933 cpu_control(cpuctrlmask, cpuctrl);
2934 2934
2935 /* And again. */ 2935 /* And again. */
2936 cpu_idcache_wbinv_all(); 2936 cpu_idcache_wbinv_all();
2937} 2937}
2938#endif /* CPU_ARM11 */ 2938#endif /* CPU_ARM11 */
2939 2939
2940#if defined(CPU_ARM11MPCORE) 2940#if defined(CPU_ARM11MPCORE)
2941 2941
2942void 2942void
2943arm11mpcore_setup(char *args) 2943arm11mpcore_setup(char *args)
2944{ 2944{
2945 int cpuctrl, cpuctrlmask; 2945 int cpuctrl, cpuctrlmask;
2946 2946