cpufunc.h revision 1.83 1 1.45 matt /* cpufunc.h,v 1.40.22.4 2007/11/08 10:59:33 matt Exp */
2 1.1 reinoud
3 1.1 reinoud /*
4 1.1 reinoud * Copyright (c) 1997 Mark Brinicombe.
5 1.1 reinoud * Copyright (c) 1997 Causality Limited
6 1.1 reinoud * All rights reserved.
7 1.1 reinoud *
8 1.1 reinoud * Redistribution and use in source and binary forms, with or without
9 1.1 reinoud * modification, are permitted provided that the following conditions
10 1.1 reinoud * are met:
11 1.1 reinoud * 1. Redistributions of source code must retain the above copyright
12 1.1 reinoud * notice, this list of conditions and the following disclaimer.
13 1.1 reinoud * 2. Redistributions in binary form must reproduce the above copyright
14 1.1 reinoud * notice, this list of conditions and the following disclaimer in the
15 1.1 reinoud * documentation and/or other materials provided with the distribution.
16 1.1 reinoud * 3. All advertising materials mentioning features or use of this software
17 1.1 reinoud * must display the following acknowledgement:
18 1.1 reinoud * This product includes software developed by Causality Limited.
19 1.1 reinoud * 4. The name of Causality Limited may not be used to endorse or promote
20 1.1 reinoud * products derived from this software without specific prior written
21 1.1 reinoud * permission.
22 1.1 reinoud *
23 1.1 reinoud * THIS SOFTWARE IS PROVIDED BY CAUSALITY LIMITED ``AS IS'' AND ANY EXPRESS
24 1.1 reinoud * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 1.1 reinoud * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 1.1 reinoud * DISCLAIMED. IN NO EVENT SHALL CAUSALITY LIMITED BE LIABLE FOR ANY DIRECT,
27 1.1 reinoud * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 1.1 reinoud * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 1.1 reinoud * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 1.1 reinoud * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 1.1 reinoud * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 1.1 reinoud * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 1.1 reinoud * SUCH DAMAGE.
34 1.1 reinoud *
35 1.1 reinoud * RiscBSD kernel project
36 1.1 reinoud *
37 1.1 reinoud * cpufunc.h
38 1.1 reinoud *
39 1.1 reinoud * Prototypes for cpu, mmu and tlb related functions.
40 1.1 reinoud */
41 1.1 reinoud
42 1.65 matt #ifndef _ARM_CPUFUNC_H_
43 1.65 matt #define _ARM_CPUFUNC_H_
44 1.1 reinoud
45 1.83 skrll #define isb() __asm __volatile("isb" : : : "memory")
46 1.83 skrll
47 1.83 skrll /*
48 1.83 skrll * Options for DMB and DSB:
49 1.83 skrll * oshld Outer Shareable, load
50 1.83 skrll * oshst Outer Shareable, store
51 1.83 skrll * osh Outer Shareable, all
52 1.83 skrll * nshld Non-shareable, load
53 1.83 skrll * nshst Non-shareable, store
54 1.83 skrll * nsh Non-shareable, all
55 1.83 skrll * ishld Inner Shareable, load
56 1.83 skrll * ishst Inner Shareable, store
57 1.83 skrll * ish Inner Shareable, all
58 1.83 skrll * ld Full system, load
59 1.83 skrll * st Full system, store
60 1.83 skrll * sy Full system, all
61 1.83 skrll */
62 1.83 skrll #define dsb(opt) __asm __volatile("dsb " __STRING(opt) : : : "memory")
63 1.83 skrll #define dmb(opt) __asm __volatile("dmb " __STRING(opt) : : : "memory")
64 1.83 skrll
65 1.79 ryo #ifdef __arm__
66 1.79 ryo
67 1.21 thorpej #ifdef _KERNEL
68 1.21 thorpej
69 1.1 reinoud #include <sys/types.h>
70 1.79 ryo
71 1.45 matt #include <arm/armreg.h>
72 1.21 thorpej #include <arm/cpuconf.h>
73 1.74 christos #include <arm/cpufunc_proto.h>
74 1.1 reinoud
75 1.1 reinoud struct cpu_functions {
76 1.1 reinoud
77 1.1 reinoud /* CPU functions */
78 1.32 uwe
79 1.39 bjh21 u_int (*cf_id) (void);
80 1.39 bjh21 void (*cf_cpwait) (void);
81 1.1 reinoud
82 1.1 reinoud /* MMU functions */
83 1.1 reinoud
84 1.39 bjh21 u_int (*cf_control) (u_int, u_int);
85 1.39 bjh21 void (*cf_domains) (u_int);
86 1.69 matt #if defined(ARM_MMU_EXTENDED)
87 1.69 matt void (*cf_setttb) (u_int, tlb_asid_t);
88 1.69 matt #else
89 1.60 matt void (*cf_setttb) (u_int, bool);
90 1.69 matt #endif
91 1.39 bjh21 u_int (*cf_faultstatus) (void);
92 1.39 bjh21 u_int (*cf_faultaddress) (void);
93 1.1 reinoud
94 1.1 reinoud /* TLB functions */
95 1.1 reinoud
96 1.39 bjh21 void (*cf_tlb_flushID) (void);
97 1.66 matt void (*cf_tlb_flushID_SE) (vaddr_t);
98 1.39 bjh21 void (*cf_tlb_flushI) (void);
99 1.66 matt void (*cf_tlb_flushI_SE) (vaddr_t);
100 1.39 bjh21 void (*cf_tlb_flushD) (void);
101 1.66 matt void (*cf_tlb_flushD_SE) (vaddr_t);
102 1.1 reinoud
103 1.17 thorpej /*
104 1.17 thorpej * Cache operations:
105 1.17 thorpej *
106 1.17 thorpej * We define the following primitives:
107 1.17 thorpej *
108 1.17 thorpej * icache_sync_all Synchronize I-cache
109 1.17 thorpej * icache_sync_range Synchronize I-cache range
110 1.17 thorpej *
111 1.17 thorpej * dcache_wbinv_all Write-back and Invalidate D-cache
112 1.17 thorpej * dcache_wbinv_range Write-back and Invalidate D-cache range
113 1.17 thorpej * dcache_inv_range Invalidate D-cache range
114 1.17 thorpej * dcache_wb_range Write-back D-cache range
115 1.17 thorpej *
116 1.17 thorpej * idcache_wbinv_all Write-back and Invalidate D-cache,
117 1.17 thorpej * Invalidate I-cache
118 1.17 thorpej * idcache_wbinv_range Write-back and Invalidate D-cache,
119 1.17 thorpej * Invalidate I-cache range
120 1.17 thorpej *
121 1.17 thorpej * Note that the ARM term for "write-back" is "clean". We use
122 1.17 thorpej * the term "write-back" since it's a more common way to describe
123 1.17 thorpej * the operation.
124 1.17 thorpej *
125 1.17 thorpej * There are some rules that must be followed:
126 1.17 thorpej *
127 1.17 thorpej * I-cache Synch (all or range):
128 1.17 thorpej * The goal is to synchronize the instruction stream,
129 1.17 thorpej * so you may beed to write-back dirty D-cache blocks
130 1.17 thorpej * first. If a range is requested, and you can't
131 1.17 thorpej * synchronize just a range, you have to hit the whole
132 1.17 thorpej * thing.
133 1.17 thorpej *
134 1.17 thorpej * D-cache Write-Back and Invalidate range:
135 1.17 thorpej * If you can't WB-Inv a range, you must WB-Inv the
136 1.17 thorpej * entire D-cache.
137 1.17 thorpej *
138 1.17 thorpej * D-cache Invalidate:
139 1.17 thorpej * If you can't Inv the D-cache, you must Write-Back
140 1.17 thorpej * and Invalidate. Code that uses this operation
141 1.17 thorpej * MUST NOT assume that the D-cache will not be written
142 1.17 thorpej * back to memory.
143 1.17 thorpej *
144 1.17 thorpej * D-cache Write-Back:
145 1.17 thorpej * If you can't Write-back without doing an Inv,
146 1.17 thorpej * that's fine. Then treat this as a WB-Inv.
147 1.17 thorpej * Skipping the invalidate is merely an optimization.
148 1.17 thorpej *
149 1.17 thorpej * All operations:
150 1.17 thorpej * Valid virtual addresses must be passed to each
151 1.17 thorpej * cache operation.
152 1.17 thorpej */
153 1.39 bjh21 void (*cf_icache_sync_all) (void);
154 1.39 bjh21 void (*cf_icache_sync_range) (vaddr_t, vsize_t);
155 1.17 thorpej
156 1.39 bjh21 void (*cf_dcache_wbinv_all) (void);
157 1.39 bjh21 void (*cf_dcache_wbinv_range)(vaddr_t, vsize_t);
158 1.39 bjh21 void (*cf_dcache_inv_range) (vaddr_t, vsize_t);
159 1.39 bjh21 void (*cf_dcache_wb_range) (vaddr_t, vsize_t);
160 1.1 reinoud
161 1.59 matt void (*cf_sdcache_wbinv_range)(vaddr_t, paddr_t, psize_t);
162 1.59 matt void (*cf_sdcache_inv_range) (vaddr_t, paddr_t, psize_t);
163 1.59 matt void (*cf_sdcache_wb_range) (vaddr_t, paddr_t, psize_t);
164 1.59 matt
165 1.39 bjh21 void (*cf_idcache_wbinv_all) (void);
166 1.39 bjh21 void (*cf_idcache_wbinv_range)(vaddr_t, vsize_t);
167 1.1 reinoud
168 1.1 reinoud /* Other functions */
169 1.1 reinoud
170 1.39 bjh21 void (*cf_flush_prefetchbuf) (void);
171 1.39 bjh21 void (*cf_drain_writebuf) (void);
172 1.39 bjh21 void (*cf_flush_brnchtgt_C) (void);
173 1.39 bjh21 void (*cf_flush_brnchtgt_E) (u_int);
174 1.1 reinoud
175 1.39 bjh21 void (*cf_sleep) (int mode);
176 1.1 reinoud
177 1.1 reinoud /* Soft functions */
178 1.1 reinoud
179 1.39 bjh21 int (*cf_dataabt_fixup) (void *);
180 1.39 bjh21 int (*cf_prefetchabt_fixup) (void *);
181 1.1 reinoud
182 1.69 matt #if defined(ARM_MMU_EXTENDED)
183 1.69 matt void (*cf_context_switch) (u_int, tlb_asid_t);
184 1.69 matt #else
185 1.41 scw void (*cf_context_switch) (u_int);
186 1.69 matt #endif
187 1.1 reinoud
188 1.39 bjh21 void (*cf_setup) (char *);
189 1.1 reinoud };
190 1.1 reinoud
191 1.1 reinoud extern struct cpu_functions cpufuncs;
192 1.1 reinoud extern u_int cputype;
193 1.1 reinoud
194 1.76 christos #define cpu_idnum() cpufuncs.cf_id()
195 1.1 reinoud
196 1.1 reinoud #define cpu_control(c, e) cpufuncs.cf_control(c, e)
197 1.1 reinoud #define cpu_domains(d) cpufuncs.cf_domains(d)
198 1.60 matt #define cpu_setttb(t, f) cpufuncs.cf_setttb(t, f)
199 1.1 reinoud #define cpu_faultstatus() cpufuncs.cf_faultstatus()
200 1.1 reinoud #define cpu_faultaddress() cpufuncs.cf_faultaddress()
201 1.1 reinoud
202 1.1 reinoud #define cpu_tlb_flushID() cpufuncs.cf_tlb_flushID()
203 1.1 reinoud #define cpu_tlb_flushID_SE(e) cpufuncs.cf_tlb_flushID_SE(e)
204 1.1 reinoud #define cpu_tlb_flushI() cpufuncs.cf_tlb_flushI()
205 1.1 reinoud #define cpu_tlb_flushI_SE(e) cpufuncs.cf_tlb_flushI_SE(e)
206 1.1 reinoud #define cpu_tlb_flushD() cpufuncs.cf_tlb_flushD()
207 1.1 reinoud #define cpu_tlb_flushD_SE(e) cpufuncs.cf_tlb_flushD_SE(e)
208 1.1 reinoud
209 1.17 thorpej #define cpu_icache_sync_all() cpufuncs.cf_icache_sync_all()
210 1.17 thorpej #define cpu_icache_sync_range(a, s) cpufuncs.cf_icache_sync_range((a), (s))
211 1.17 thorpej
212 1.17 thorpej #define cpu_dcache_wbinv_all() cpufuncs.cf_dcache_wbinv_all()
213 1.17 thorpej #define cpu_dcache_wbinv_range(a, s) cpufuncs.cf_dcache_wbinv_range((a), (s))
214 1.17 thorpej #define cpu_dcache_inv_range(a, s) cpufuncs.cf_dcache_inv_range((a), (s))
215 1.17 thorpej #define cpu_dcache_wb_range(a, s) cpufuncs.cf_dcache_wb_range((a), (s))
216 1.17 thorpej
217 1.59 matt #define cpu_sdcache_wbinv_range(a, b, s) cpufuncs.cf_sdcache_wbinv_range((a), (b), (s))
218 1.59 matt #define cpu_sdcache_inv_range(a, b, s) cpufuncs.cf_sdcache_inv_range((a), (b), (s))
219 1.59 matt #define cpu_sdcache_wb_range(a, b, s) cpufuncs.cf_sdcache_wb_range((a), (b), (s))
220 1.59 matt
221 1.17 thorpej #define cpu_idcache_wbinv_all() cpufuncs.cf_idcache_wbinv_all()
222 1.17 thorpej #define cpu_idcache_wbinv_range(a, s) cpufuncs.cf_idcache_wbinv_range((a), (s))
223 1.1 reinoud
224 1.1 reinoud #define cpu_flush_prefetchbuf() cpufuncs.cf_flush_prefetchbuf()
225 1.1 reinoud #define cpu_drain_writebuf() cpufuncs.cf_drain_writebuf()
226 1.1 reinoud #define cpu_flush_brnchtgt_C() cpufuncs.cf_flush_brnchtgt_C()
227 1.1 reinoud #define cpu_flush_brnchtgt_E(e) cpufuncs.cf_flush_brnchtgt_E(e)
228 1.1 reinoud
229 1.1 reinoud #define cpu_sleep(m) cpufuncs.cf_sleep(m)
230 1.1 reinoud
231 1.1 reinoud #define cpu_dataabt_fixup(a) cpufuncs.cf_dataabt_fixup(a)
232 1.1 reinoud #define cpu_prefetchabt_fixup(a) cpufuncs.cf_prefetchabt_fixup(a)
233 1.7 wiz #define ABORT_FIXUP_OK 0 /* fixup succeeded */
234 1.1 reinoud #define ABORT_FIXUP_FAILED 1 /* fixup failed */
235 1.1 reinoud #define ABORT_FIXUP_RETURN 2 /* abort handler should return */
236 1.1 reinoud
237 1.41 scw #define cpu_context_switch(a) cpufuncs.cf_context_switch(a)
238 1.1 reinoud #define cpu_setup(a) cpufuncs.cf_setup(a)
239 1.1 reinoud
240 1.39 bjh21 int set_cpufuncs (void);
241 1.40 bjh21 int set_cpufuncs_id (u_int);
242 1.1 reinoud #define ARCHITECTURE_NOT_PRESENT 1 /* known but not configured */
243 1.1 reinoud #define ARCHITECTURE_NOT_SUPPORTED 2 /* not known */
244 1.1 reinoud
245 1.39 bjh21 void cpufunc_nullop (void);
246 1.39 bjh21 int cpufunc_null_fixup (void *);
247 1.39 bjh21 int early_abort_fixup (void *);
248 1.39 bjh21 int late_abort_fixup (void *);
249 1.39 bjh21 u_int cpufunc_id (void);
250 1.39 bjh21 u_int cpufunc_control (u_int, u_int);
251 1.39 bjh21 void cpufunc_domains (u_int);
252 1.39 bjh21 u_int cpufunc_faultstatus (void);
253 1.39 bjh21 u_int cpufunc_faultaddress (void);
254 1.3 bjh21
255 1.1 reinoud #define setttb cpu_setttb
256 1.1 reinoud #define drain_writebuf cpu_drain_writebuf
257 1.1 reinoud
258 1.73 matt
259 1.73 matt #if defined(CPU_XSCALE)
260 1.73 matt #define cpu_cpwait() cpufuncs.cf_cpwait()
261 1.73 matt #endif
262 1.73 matt
263 1.43 chris #ifndef cpu_cpwait
264 1.43 chris #define cpu_cpwait()
265 1.43 chris #endif
266 1.43 chris
267 1.1 reinoud /*
268 1.1 reinoud * Macros for manipulating CPU interrupts
269 1.1 reinoud */
270 1.62 skrll static __inline uint32_t __set_cpsr_c(uint32_t bic, uint32_t eor) __attribute__((__unused__));
271 1.62 skrll static __inline uint32_t disable_interrupts(uint32_t mask) __attribute__((__unused__));
272 1.62 skrll static __inline uint32_t enable_interrupts(uint32_t mask) __attribute__((__unused__));
273 1.25 briggs
274 1.43 chris static __inline uint32_t
275 1.43 chris __set_cpsr_c(uint32_t bic, uint32_t eor)
276 1.25 briggs {
277 1.43 chris uint32_t tmp, ret;
278 1.25 briggs
279 1.36 perry __asm volatile(
280 1.25 briggs "mrs %0, cpsr\n" /* Get the CPSR */
281 1.25 briggs "bic %1, %0, %2\n" /* Clear bits */
282 1.25 briggs "eor %1, %1, %3\n" /* XOR bits */
283 1.25 briggs "msr cpsr_c, %1\n" /* Set the control field of CPSR */
284 1.25 briggs : "=&r" (ret), "=&r" (tmp)
285 1.31 rearnsha : "r" (bic), "r" (eor) : "memory");
286 1.25 briggs
287 1.25 briggs return ret;
288 1.25 briggs }
289 1.25 briggs
290 1.43 chris static __inline uint32_t
291 1.43 chris disable_interrupts(uint32_t mask)
292 1.43 chris {
293 1.43 chris uint32_t tmp, ret;
294 1.43 chris mask &= (I32_bit | F32_bit);
295 1.43 chris
296 1.43 chris __asm volatile(
297 1.43 chris "mrs %0, cpsr\n" /* Get the CPSR */
298 1.43 chris "orr %1, %0, %2\n" /* set bits */
299 1.43 chris "msr cpsr_c, %1\n" /* Set the control field of CPSR */
300 1.43 chris : "=&r" (ret), "=&r" (tmp)
301 1.43 chris : "r" (mask)
302 1.43 chris : "memory");
303 1.43 chris
304 1.43 chris return ret;
305 1.43 chris }
306 1.43 chris
307 1.43 chris static __inline uint32_t
308 1.43 chris enable_interrupts(uint32_t mask)
309 1.43 chris {
310 1.69 matt uint32_t ret;
311 1.43 chris mask &= (I32_bit | F32_bit);
312 1.43 chris
313 1.69 matt /* Get the CPSR */
314 1.69 matt __asm __volatile("mrs\t%0, cpsr\n" : "=r"(ret));
315 1.69 matt #ifdef _ARM_ARCH_6
316 1.69 matt if (__builtin_constant_p(mask)) {
317 1.69 matt switch (mask) {
318 1.69 matt case I32_bit | F32_bit:
319 1.69 matt __asm __volatile("cpsie\tif");
320 1.69 matt break;
321 1.69 matt case I32_bit:
322 1.69 matt __asm __volatile("cpsie\ti");
323 1.69 matt break;
324 1.69 matt case F32_bit:
325 1.69 matt __asm __volatile("cpsie\tf");
326 1.69 matt break;
327 1.69 matt default:
328 1.69 matt break;
329 1.69 matt }
330 1.69 matt return ret;
331 1.69 matt }
332 1.69 matt #endif /* _ARM_ARCH_6 */
333 1.69 matt
334 1.69 matt /* Set the control field of CPSR */
335 1.69 matt __asm volatile("msr\tcpsr_c, %0" :: "r"(ret & ~mask));
336 1.1 reinoud
337 1.43 chris return ret;
338 1.43 chris }
339 1.1 reinoud
340 1.15 thorpej #define restore_interrupts(old_cpsr) \
341 1.25 briggs (__set_cpsr_c((I32_bit | F32_bit), (old_cpsr) & (I32_bit | F32_bit)))
342 1.45 matt
343 1.45 matt static inline void cpsie(register_t psw) __attribute__((__unused__));
344 1.45 matt static inline register_t cpsid(register_t psw) __attribute__((__unused__));
345 1.45 matt
346 1.45 matt static inline void
347 1.45 matt cpsie(register_t psw)
348 1.45 matt {
349 1.49 matt #ifdef _ARM_ARCH_6
350 1.45 matt if (!__builtin_constant_p(psw)) {
351 1.45 matt enable_interrupts(psw);
352 1.45 matt return;
353 1.45 matt }
354 1.45 matt switch (psw & (I32_bit|F32_bit)) {
355 1.45 matt case I32_bit: __asm("cpsie\ti"); break;
356 1.45 matt case F32_bit: __asm("cpsie\tf"); break;
357 1.45 matt case I32_bit|F32_bit: __asm("cpsie\tif"); break;
358 1.45 matt }
359 1.48 cliff #else
360 1.48 cliff enable_interrupts(psw);
361 1.48 cliff #endif
362 1.45 matt }
363 1.45 matt
364 1.45 matt static inline register_t
365 1.45 matt cpsid(register_t psw)
366 1.45 matt {
367 1.49 matt #ifdef _ARM_ARCH_6
368 1.45 matt register_t oldpsw;
369 1.45 matt if (!__builtin_constant_p(psw))
370 1.45 matt return disable_interrupts(psw);
371 1.45 matt
372 1.45 matt __asm("mrs %0, cpsr" : "=r"(oldpsw));
373 1.45 matt switch (psw & (I32_bit|F32_bit)) {
374 1.45 matt case I32_bit: __asm("cpsid\ti"); break;
375 1.45 matt case F32_bit: __asm("cpsid\tf"); break;
376 1.45 matt case I32_bit|F32_bit: __asm("cpsid\tif"); break;
377 1.45 matt }
378 1.45 matt return oldpsw;
379 1.80 skrll #else
380 1.48 cliff return disable_interrupts(psw);
381 1.48 cliff #endif
382 1.45 matt }
383 1.45 matt
384 1.15 thorpej
385 1.15 thorpej /* Functions to manipulate the CPSR. */
386 1.32 uwe u_int SetCPSR(u_int, u_int);
387 1.15 thorpej u_int GetCPSR(void);
388 1.1 reinoud
389 1.1 reinoud
390 1.1 reinoud /*
391 1.1 reinoud * CPU functions from locore.S
392 1.1 reinoud */
393 1.1 reinoud
394 1.58 matt void cpu_reset (void) __dead;
395 1.14 thorpej
396 1.14 thorpej /*
397 1.14 thorpej * Cache info variables.
398 1.14 thorpej */
399 1.67 matt #define CACHE_TYPE_VIVT 0
400 1.67 matt #define CACHE_TYPE_xxPT 1
401 1.67 matt #define CACHE_TYPE_VIPT 1
402 1.67 matt #define CACHE_TYPE_PIxx 2
403 1.67 matt #define CACHE_TYPE_PIPT 3
404 1.14 thorpej
405 1.14 thorpej /* PRIMARY CACHE VARIABLES */
406 1.58 matt struct arm_cache_info {
407 1.58 matt u_int icache_size;
408 1.58 matt u_int icache_line_size;
409 1.58 matt u_int icache_ways;
410 1.68 matt u_int icache_way_size;
411 1.58 matt u_int icache_sets;
412 1.58 matt
413 1.58 matt u_int dcache_size;
414 1.58 matt u_int dcache_line_size;
415 1.58 matt u_int dcache_ways;
416 1.68 matt u_int dcache_way_size;
417 1.58 matt u_int dcache_sets;
418 1.58 matt
419 1.69 matt uint8_t cache_type;
420 1.58 matt bool cache_unified;
421 1.67 matt uint8_t icache_type;
422 1.67 matt uint8_t dcache_type;
423 1.58 matt };
424 1.58 matt
425 1.77 mrg #if (ARM_MMU_V6 + ARM_MMU_V7) != 0
426 1.58 matt extern u_int arm_cache_prefer_mask;
427 1.77 mrg #endif
428 1.58 matt extern u_int arm_dcache_align;
429 1.58 matt extern u_int arm_dcache_align_mask;
430 1.1 reinoud
431 1.58 matt extern struct arm_cache_info arm_pcache;
432 1.58 matt extern struct arm_cache_info arm_scache;
433 1.79 ryo
434 1.81 skrll extern uint32_t cpu_ttb;
435 1.81 skrll
436 1.1 reinoud #endif /* _KERNEL */
437 1.55 christos
438 1.55 christos #if defined(_KERNEL) || defined(_KMEMUSER)
439 1.55 christos /*
440 1.55 christos * Miscellany
441 1.55 christos */
442 1.55 christos
443 1.55 christos int get_pc_str_offset (void);
444 1.55 christos
445 1.79 ryo bool cpu_gtmr_exists_p(void);
446 1.79 ryo u_int cpu_clusterid(void);
447 1.79 ryo bool cpu_earlydevice_va_p(void);
448 1.79 ryo
449 1.55 christos /*
450 1.55 christos * Functions to manipulate cpu r13
451 1.55 christos * (in arm/arm32/setstack.S)
452 1.55 christos */
453 1.55 christos
454 1.55 christos void set_stackptr (u_int, u_int);
455 1.55 christos u_int get_stackptr (u_int);
456 1.55 christos
457 1.55 christos #endif /* _KERNEL || _KMEMUSER */
458 1.55 christos
459 1.79 ryo #elif defined(__aarch64__)
460 1.79 ryo
461 1.79 ryo #include <aarch64/cpufunc.h>
462 1.79 ryo
463 1.79 ryo #endif /* __arm__/__aarch64__ */
464 1.79 ryo
465 1.65 matt #endif /* _ARM_CPUFUNC_H_ */
466 1.1 reinoud
467 1.1 reinoud /* End of cpufunc.h */
468