Add armv7_drain_writebuf (which is just a dsb).diff -r1.116 -r1.117 src/sys/arch/arm/arm/cpufunc.c
(matt)
--- src/sys/arch/arm/arm/cpufunc.c 2012/09/11 17:51:38 1.116
+++ src/sys/arch/arm/arm/cpufunc.c 2012/10/19 13:47:03 1.117
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: cpufunc.c,v 1.116 2012/09/11 17:51:38 matt Exp $ */ | 1 | /* $NetBSD: cpufunc.c,v 1.117 2012/10/19 13:47:03 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.116 2012/09/11 17:51:38 matt Exp $"); | 52 | __KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.117 2012/10/19 13:47:03 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 | |||
@@ -1301,27 +1301,27 @@ struct cpu_functions cortex_cpufuncs = { | @@ -1301,27 +1301,27 @@ struct cpu_functions cortex_cpufuncs = { | |||
1301 | .cf_sdcache_wbinv_range = (void *)cpufunc_nullop, | 1301 | .cf_sdcache_wbinv_range = (void *)cpufunc_nullop, | |
1302 | .cf_sdcache_inv_range = (void *)cpufunc_nullop, | 1302 | .cf_sdcache_inv_range = (void *)cpufunc_nullop, | |
1303 | .cf_sdcache_wb_range = (void *)cpufunc_nullop, | 1303 | .cf_sdcache_wb_range = (void *)cpufunc_nullop, | |
1304 | 1304 | |||
1305 | .cf_icache_sync_range = armv7_icache_sync_range, | 1305 | .cf_icache_sync_range = armv7_icache_sync_range, | |
1306 | .cf_idcache_wbinv_range = armv7_idcache_wbinv_range, | 1306 | .cf_idcache_wbinv_range = armv7_idcache_wbinv_range, | |
1307 | 1307 | |||
1308 | 1308 | |||
1309 | .cf_idcache_wbinv_all = armv7_idcache_wbinv_all, | 1309 | .cf_idcache_wbinv_all = armv7_idcache_wbinv_all, | |
1310 | 1310 | |||
1311 | /* Other functions */ | 1311 | /* Other functions */ | |
1312 | 1312 | |||
1313 | .cf_flush_prefetchbuf = cpufunc_nullop, | 1313 | .cf_flush_prefetchbuf = cpufunc_nullop, | |
1314 | .cf_drain_writebuf = arm11_drain_writebuf, | 1314 | .cf_drain_writebuf = armv7_drain_writebuf, | |
1315 | .cf_flush_brnchtgt_C = cpufunc_nullop, | 1315 | .cf_flush_brnchtgt_C = cpufunc_nullop, | |
1316 | .cf_flush_brnchtgt_E = (void *)cpufunc_nullop, | 1316 | .cf_flush_brnchtgt_E = (void *)cpufunc_nullop, | |
1317 | 1317 | |||
1318 | .cf_sleep = armv7_cpu_sleep, | 1318 | .cf_sleep = armv7_cpu_sleep, | |
1319 | 1319 | |||
1320 | /* Soft functions */ | 1320 | /* Soft functions */ | |
1321 | 1321 | |||
1322 | .cf_dataabt_fixup = cpufunc_null_fixup, | 1322 | .cf_dataabt_fixup = cpufunc_null_fixup, | |
1323 | .cf_prefetchabt_fixup = cpufunc_null_fixup, | 1323 | .cf_prefetchabt_fixup = cpufunc_null_fixup, | |
1324 | 1324 | |||
1325 | .cf_context_switch = armv7_context_switch, | 1325 | .cf_context_switch = armv7_context_switch, | |
1326 | 1326 | |||
1327 | .cf_setup = armv7_setup | 1327 | .cf_setup = armv7_setup |
--- src/sys/arch/arm/arm/cpufunc_asm_armv7.S 2012/10/17 18:55:43 1.8
+++ src/sys/arch/arm/arm/cpufunc_asm_armv7.S 2012/10/19 13:47:03 1.9
@@ -64,43 +64,50 @@ END(armv7_context_switch) | @@ -64,43 +64,50 @@ END(armv7_context_switch) | |||
64 | 64 | |||
65 | ENTRY(armv7_tlb_flushID_SE) | 65 | ENTRY(armv7_tlb_flushID_SE) | |
66 | #ifdef MULTIPROCESSOR | 66 | #ifdef MULTIPROCESSOR | |
67 | mcr p15, 0, r0, c8, c3, 1 @ flush I+D tlb single entry | 67 | mcr p15, 0, r0, c8, c3, 1 @ flush I+D tlb single entry | |
68 | #else | 68 | #else | |
69 | mcr p15, 0, r0, c8, c7, 1 @ flush I+D tlb single entry | 69 | mcr p15, 0, r0, c8, c7, 1 @ flush I+D tlb single entry | |
70 | #endif | 70 | #endif | |
71 | dsb @ data synchronization barrier | 71 | dsb @ data synchronization barrier | |
72 | isb | 72 | isb | |
73 | bx lr | 73 | bx lr | |
74 | END(armv7_tlb_flushID_SE) | 74 | END(armv7_tlb_flushID_SE) | |
75 | 75 | |||
76 | 76 | |||
77 | ENTRY(armv7_setttb) | 77 | ENTRY_NP(armv7_setttb) | |
78 | mrc p15, 0, r2, c0, c0, 5 @ get MPIDR | 78 | mrc p15, 0, r2, c0, c0, 5 @ get MPIDR | |
79 | cmp r2, #0 | 79 | cmp r2, #0 | |
80 | orrlt r0, #0x5b @ MP, cachable (Normal WB) | 80 | orrlt r0, #0x5b @ MP, cachable (Normal WB) | |
81 | orrge r0, #0x1b @ Non-MP, cacheable, normal WB | 81 | orrge r0, #0x1b @ Non-MP, cacheable, normal WB | |
82 | mcr p15, 0, r0, c2, c0, 0 @ load new TTB | 82 | mcr p15, 0, r0, c2, c0, 0 @ load new TTB | |
83 | cmp r1, #0 | 83 | cmp r1, #0 | |
84 | #ifdef MULTIPROCESSOR | 84 | #ifdef MULTIPROCESSOR | |
85 | mcrne p15, 0, r0, c8, c3, 0 @ invalidate all I+D TLBs | 85 | mcrne p15, 0, r0, c8, c3, 0 @ invalidate all I+D TLBs | |
86 | #else | 86 | #else | |
87 | mcrne p15, 0, r0, c8, c7, 0 @ invalidate all I+D TLBs | 87 | mcrne p15, 0, r0, c8, c7, 0 @ invalidate all I+D TLBs | |
88 | #endif | 88 | #endif | |
89 | dsb @ data synchronization barrier | 89 | dsb @ data synchronization barrier | |
90 | isb | 90 | isb | |
91 | bx lr | 91 | bx lr | |
92 | END(armv7_setttb) | 92 | END(armv7_setttb) | |
93 | 93 | |||
94 | /* Other functions. */ | |||
95 | ||||
96 | ENTRY_NP(armv7_drain_writebuf) | |||
97 | dsb @ data synchronization barrier | |||
98 | RET | |||
99 | END(armv7_drain_writebuf) | |||
100 | ||||
94 | /* Cache operations. */ | 101 | /* Cache operations. */ | |
95 | 102 | |||
96 | /* LINTSTUB: void armv7_icache_sync_range(vaddr_t, vsize_t); */ | 103 | /* LINTSTUB: void armv7_icache_sync_range(vaddr_t, vsize_t); */ | |
97 | ENTRY_NP(armv7_icache_sync_range) | 104 | ENTRY_NP(armv7_icache_sync_range) | |
98 | mrc p15, 1, r2, c0, c0, 0 @ read CCSIDR | 105 | mrc p15, 1, r2, c0, c0, 0 @ read CCSIDR | |
99 | and r2, r2, #7 @ get line size (log2(size)-4, 0=16) | 106 | and r2, r2, #7 @ get line size (log2(size)-4, 0=16) | |
100 | mov ip, #16 @ make a bit mask | 107 | mov ip, #16 @ make a bit mask | |
101 | lsl r2, ip, r2 @ and shift into position | 108 | lsl r2, ip, r2 @ and shift into position | |
102 | sub ip, r2, #1 @ make into a mask | 109 | sub ip, r2, #1 @ make into a mask | |
103 | and r3, r0, ip @ get offset into cache line | 110 | and r3, r0, ip @ get offset into cache line | |
104 | add r1, r1, r3 @ add to length | 111 | add r1, r1, r3 @ add to length | |
105 | bic r0, r0, ip @ clear offset from start. | 112 | bic r0, r0, ip @ clear offset from start. | |
106 | 1: | 113 | 1: |
--- src/sys/arch/arm/include/cpufunc.h 2012/09/22 00:33:37 1.60
+++ src/sys/arch/arm/include/cpufunc.h 2012/10/19 13:47:03 1.61
@@ -464,27 +464,28 @@ void armv7_setttb(u_int, bool); | @@ -464,27 +464,28 @@ void armv7_setttb(u_int, bool); | |||
464 | 464 | |||
465 | void armv7_icache_sync_range(vaddr_t, vsize_t); | 465 | void armv7_icache_sync_range(vaddr_t, vsize_t); | |
466 | void armv7_dcache_wb_range(vaddr_t, vsize_t); | 466 | void armv7_dcache_wb_range(vaddr_t, vsize_t); | |
467 | void armv7_dcache_wbinv_range(vaddr_t, vsize_t); | 467 | void armv7_dcache_wbinv_range(vaddr_t, vsize_t); | |
468 | void armv7_dcache_inv_range(vaddr_t, vsize_t); | 468 | void armv7_dcache_inv_range(vaddr_t, vsize_t); | |
469 | void armv7_idcache_wbinv_range(vaddr_t, vsize_t); | 469 | void armv7_idcache_wbinv_range(vaddr_t, vsize_t); | |
470 | 470 | |||
471 | void armv7_dcache_wbinv_all (void); | 471 | void armv7_dcache_wbinv_all (void); | |
472 | void armv7_idcache_wbinv_all(void); | 472 | void armv7_idcache_wbinv_all(void); | |
473 | void armv7_icache_sync_all(void); | 473 | void armv7_icache_sync_all(void); | |
474 | void armv7_cpu_sleep(int); | 474 | void armv7_cpu_sleep(int); | |
475 | void armv7_context_switch(u_int); | 475 | void armv7_context_switch(u_int); | |
476 | void armv7_tlb_flushID_SE(u_int); | 476 | void armv7_tlb_flushID_SE(u_int); | |
477 | void armv7_setup (char *string); | 477 | void armv7_drain_writebuf(void); | |
478 | void armv7_setup(char *string); | |||
478 | #endif | 479 | #endif | |
479 | 480 | |||
480 | 481 | |||
481 | #if defined(CPU_ARM1136) || defined(CPU_ARM1176) | 482 | #if defined(CPU_ARM1136) || defined(CPU_ARM1176) | |
482 | void arm11x6_setttb (u_int, bool); | 483 | void arm11x6_setttb (u_int, bool); | |
483 | void arm11x6_idcache_wbinv_all (void); | 484 | void arm11x6_idcache_wbinv_all (void); | |
484 | void arm11x6_dcache_wbinv_all (void); | 485 | void arm11x6_dcache_wbinv_all (void); | |
485 | void arm11x6_icache_sync_all (void); | 486 | void arm11x6_icache_sync_all (void); | |
486 | void arm11x6_flush_prefetchbuf (void); | 487 | void arm11x6_flush_prefetchbuf (void); | |
487 | void arm11x6_icache_sync_range (vaddr_t, vsize_t); | 488 | void arm11x6_icache_sync_range (vaddr_t, vsize_t); | |
488 | void arm11x6_idcache_wbinv_range (vaddr_t, vsize_t); | 489 | void arm11x6_idcache_wbinv_range (vaddr_t, vsize_t); | |
489 | void arm11x6_setup (char *string); | 490 | void arm11x6_setup (char *string); | |
490 | void arm11x6_sleep (int); /* no ref. for errata */ | 491 | void arm11x6_sleep (int); /* no ref. for errata */ |