Fri Oct 19 13:47:03 2012 UTC ()
Add armv7_drain_writebuf (which is just a dsb).


(matt)
diff -r1.116 -r1.117 src/sys/arch/arm/arm/cpufunc.c
diff -r1.8 -r1.9 src/sys/arch/arm/arm/cpufunc_asm_armv7.S
diff -r1.60 -r1.61 src/sys/arch/arm/include/cpufunc.h

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

--- 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

cvs diff -r1.8 -r1.9 src/sys/arch/arm/arm/cpufunc_asm_armv7.S (expand / switch to unified diff)

--- 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
65ENTRY(armv7_tlb_flushID_SE) 65ENTRY(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
74END(armv7_tlb_flushID_SE) 74END(armv7_tlb_flushID_SE)
75 75
76 76
77ENTRY(armv7_setttb) 77ENTRY_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
92END(armv7_setttb) 92END(armv7_setttb)
93 93
 94/* Other functions. */
 95
 96ENTRY_NP(armv7_drain_writebuf)
 97 dsb @ data synchronization barrier
 98 RET
 99END(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); */
97ENTRY_NP(armv7_icache_sync_range) 104ENTRY_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.
1061: 1131:

cvs diff -r1.60 -r1.61 src/sys/arch/arm/include/cpufunc.h (expand / switch to unified diff)

--- 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
465void armv7_icache_sync_range(vaddr_t, vsize_t); 465void armv7_icache_sync_range(vaddr_t, vsize_t);
466void armv7_dcache_wb_range(vaddr_t, vsize_t); 466void armv7_dcache_wb_range(vaddr_t, vsize_t);
467void armv7_dcache_wbinv_range(vaddr_t, vsize_t); 467void armv7_dcache_wbinv_range(vaddr_t, vsize_t);
468void armv7_dcache_inv_range(vaddr_t, vsize_t); 468void armv7_dcache_inv_range(vaddr_t, vsize_t);
469void armv7_idcache_wbinv_range(vaddr_t, vsize_t); 469void armv7_idcache_wbinv_range(vaddr_t, vsize_t);
470 470
471void armv7_dcache_wbinv_all (void); 471void armv7_dcache_wbinv_all (void);
472void armv7_idcache_wbinv_all(void); 472void armv7_idcache_wbinv_all(void);
473void armv7_icache_sync_all(void); 473void armv7_icache_sync_all(void);
474void armv7_cpu_sleep(int); 474void armv7_cpu_sleep(int);
475void armv7_context_switch(u_int); 475void armv7_context_switch(u_int);
476void armv7_tlb_flushID_SE(u_int); 476void armv7_tlb_flushID_SE(u_int);
477void armv7_setup (char *string); 477void armv7_drain_writebuf(void);
 478void 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)
482void arm11x6_setttb (u_int, bool); 483void arm11x6_setttb (u_int, bool);
483void arm11x6_idcache_wbinv_all (void); 484void arm11x6_idcache_wbinv_all (void);
484void arm11x6_dcache_wbinv_all (void); 485void arm11x6_dcache_wbinv_all (void);
485void arm11x6_icache_sync_all (void); 486void arm11x6_icache_sync_all (void);
486void arm11x6_flush_prefetchbuf (void); 487void arm11x6_flush_prefetchbuf (void);
487void arm11x6_icache_sync_range (vaddr_t, vsize_t); 488void arm11x6_icache_sync_range (vaddr_t, vsize_t);
488void arm11x6_idcache_wbinv_range (vaddr_t, vsize_t); 489void arm11x6_idcache_wbinv_range (vaddr_t, vsize_t);
489void arm11x6_setup (char *string); 490void arm11x6_setup (char *string);
490void arm11x6_sleep (int); /* no ref. for errata */ 491void arm11x6_sleep (int); /* no ref. for errata */