| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: cpufunc.c,v 1.89.10.1 2014/02/15 16:18:35 matt Exp $ */ | | 1 | /* $NetBSD: cpufunc.c,v 1.89.10.2 2014/03/26 02:00:45 matt 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.89.10.1 2014/02/15 16:18:35 matt Exp $"); | | 52 | __KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.89.10.2 2014/03/26 02:00:45 matt 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 | |
| @@ -3043,54 +3043,49 @@ struct cpu_option armv7_options[] = { | | | @@ -3043,54 +3043,49 @@ struct cpu_option armv7_options[] = { |
3043 | { "cpu.nocache", OR, BIC, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, | | 3043 | { "cpu.nocache", OR, BIC, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, |
3044 | { "armv7.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, | | 3044 | { "armv7.cache", BIC, OR, (CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE) }, |
3045 | { "armv7.icache", BIC, OR, CPU_CONTROL_IC_ENABLE }, | | 3045 | { "armv7.icache", BIC, OR, CPU_CONTROL_IC_ENABLE }, |
3046 | { "armv7.dcache", BIC, OR, CPU_CONTROL_DC_ENABLE }, | | 3046 | { "armv7.dcache", BIC, OR, CPU_CONTROL_DC_ENABLE }, |
3047 | { NULL, IGN, IGN, 0} | | 3047 | { NULL, IGN, IGN, 0} |
3048 | }; | | 3048 | }; |
3049 | | | 3049 | |
3050 | void | | 3050 | void |
3051 | armv7_setup(char *args) | | 3051 | armv7_setup(char *args) |
3052 | { | | 3052 | { |
3053 | int cpuctrl; | | 3053 | int cpuctrl; |
3054 | | | 3054 | |
3055 | cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_IC_ENABLE | | 3055 | cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_IC_ENABLE |
3056 | | CPU_CONTROL_DC_ENABLE | CPU_CONTROL_BPRD_ENABLE ; | | 3056 | | CPU_CONTROL_DC_ENABLE | CPU_CONTROL_BPRD_ENABLE |
3057 | #if 0 | | 3057 | #ifdef __ARMEB__ |
3058 | int cpuctrlmask = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE | | 3058 | | CPU_CONTROL_EX_BEND |
3059 | | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE | | | |
3060 | | CPU_CONTROL_ROM_ENABLE | CPU_CONTROL_BPRD_ENABLE | | | |
3061 | | CPU_CONTROL_BEND_ENABLE | CPU_CONTROL_AFLT_ENABLE | | | |
3062 | | CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK; | | | |
3063 | #endif | | 3059 | #endif |
3064 | | | | |
3065 | #ifdef ARM32_DISABLE_ALIGNMENT_FAULTS | | 3060 | #ifdef ARM32_DISABLE_ALIGNMENT_FAULTS |
3066 | cpuctrl |= CPU_CONTROL_UNAL_ENABLE; | | 3061 | | CPU_CONTROL_AFLT_ENABLE |
3067 | #else | | | |
3068 | cpuctrl |= CPU_CONTROL_AFLT_ENABLE; | | | |
3069 | #endif | | 3062 | #endif |
| | | 3063 | | CPU_CONTROL_UNAL_ENABLE; |
| | | 3064 | const int cpuctrlmask = cpuctrl | CPU_CONTROL_AFLT_ENABLE; |
3070 | | | 3065 | |
3071 | cpuctrl = parse_cpu_options(args, armv7_options, cpuctrl); | | 3066 | cpuctrl = parse_cpu_options(args, armv7_options, cpuctrl); |
3072 | | | 3067 | |
3073 | #ifndef ARM_HAS_VBAR | | 3068 | #ifndef ARM_HAS_VBAR |
3074 | if (vector_page == ARM_VECTORS_HIGH) | | 3069 | if (vector_page == ARM_VECTORS_HIGH) |
3075 | cpuctrl |= CPU_CONTROL_VECRELOC; | | 3070 | cpuctrl |= CPU_CONTROL_VECRELOC; |
3076 | #endif | | 3071 | #endif |
3077 | | | 3072 | |
3078 | /* Clear out the cache */ | | 3073 | /* Clear out the cache */ |
3079 | cpu_idcache_wbinv_all(); | | 3074 | cpu_idcache_wbinv_all(); |
3080 | | | 3075 | |
3081 | /* Set the control register */ | | 3076 | /* Set the control register */ |
3082 | curcpu()->ci_ctrl = cpuctrl; | | 3077 | curcpu()->ci_ctrl = cpuctrl; |
3083 | cpu_control(0xffffffff, cpuctrl); | | 3078 | cpu_control(cpuctrlmask, cpuctrl); |
3084 | } | | 3079 | } |
3085 | #endif /* CPU_CORTEX */ | | 3080 | #endif /* CPU_CORTEX */ |
3086 | | | 3081 | |
3087 | | | 3082 | |
3088 | #if defined(CPU_ARM1136) || defined(CPU_ARM1176) | | 3083 | #if defined(CPU_ARM1136) || defined(CPU_ARM1176) |
3089 | void | | 3084 | void |
3090 | arm11x6_setup(char *args) | | 3085 | arm11x6_setup(char *args) |
3091 | { | | 3086 | { |
3092 | int cpuctrl, cpuctrl_wax; | | 3087 | int cpuctrl, cpuctrl_wax; |
3093 | uint32_t auxctrl, auxctrl_wax; | | 3088 | uint32_t auxctrl, auxctrl_wax; |
3094 | uint32_t tmp, tmp2; | | 3089 | uint32_t tmp, tmp2; |
3095 | uint32_t sbz=0; | | 3090 | uint32_t sbz=0; |
3096 | uint32_t cpuid; | | 3091 | uint32_t cpuid; |