1 | /* |
2 | * Copyright (c) 2007 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License |
8 | * Version 2.0 (the 'License'). You may not use this file except in |
9 | * compliance with the License. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | #ifndef _ARM_CACHES_INTERNAL |
29 | #define _ARM_CACHES_INTERNAL 1 |
30 | |
31 | #include <arm64/proc_reg.h> |
32 | |
33 | #include <kern/kern_types.h> |
34 | |
35 | extern void flush_dcache_syscall( vm_offset_t addr, unsigned length); |
36 | |
37 | #ifdef MACH_KERNEL_PRIVATE |
38 | |
39 | extern void enable_dc_mva_ops(void); |
40 | extern void disable_dc_mva_ops(void); |
41 | |
42 | extern void flush_dcache(vm_offset_t addr, unsigned count, int phys); |
43 | extern void flush_dcache64(addr64_t addr, unsigned count, int phys); |
44 | extern void invalidate_icache(vm_offset_t addr, unsigned cnt, int phys); |
45 | extern void invalidate_icache64(addr64_t addr, unsigned cnt, int phys); |
46 | |
47 | #if defined(ARMA7) |
48 | #define LWFlush 1 |
49 | #define LWClean 2 |
50 | extern void cache_xcall(unsigned int op); |
51 | extern void cache_xcall_handler(unsigned int op); |
52 | #endif |
53 | #endif |
54 | extern void clean_dcache(vm_offset_t addr, unsigned count, int phys); |
55 | extern void clean_dcache64(addr64_t addr, unsigned count, int phys); |
56 | |
57 | extern void CleanPoC_Dcache(void); |
58 | extern void CleanPoU_Dcache(void); |
59 | |
60 | /* |
61 | * May not actually perform a flush on platforms |
62 | * where AP caches are snooped by all agents on SoC. |
63 | * |
64 | * This is the one you need unless you really know what |
65 | * you're doing. |
66 | */ |
67 | extern void CleanPoC_DcacheRegion(vm_offset_t va, size_t length); |
68 | |
69 | /* |
70 | * Always actually flushes the cache, even on platforms |
71 | * where AP caches are snooped by all agents. You |
72 | * probably don't need to use this. Intended for use in |
73 | * panic save routine (where caches will be yanked by reset |
74 | * and coherency doesn't help). |
75 | */ |
76 | extern void CleanPoC_DcacheRegion_Force(vm_offset_t va, size_t length); |
77 | |
78 | extern void CleanPoU_DcacheRegion(vm_offset_t va, size_t length); |
79 | |
80 | extern void FlushPoC_Dcache(void); |
81 | extern void FlushPoU_Dcache(void); |
82 | extern void FlushPoC_DcacheRegion(vm_offset_t va, size_t length); |
83 | |
84 | extern void InvalidatePoU_Icache(void); |
85 | extern void InvalidatePoU_IcacheRegion(vm_offset_t va, size_t length); |
86 | |
87 | extern void cache_sync_page(ppnum_t pp); |
88 | |
89 | extern void platform_cache_init(void); |
90 | extern void platform_cache_idle_enter(void); |
91 | extern void platform_cache_flush(void); |
92 | extern boolean_t platform_cache_batch_wimg(unsigned int new_wimg, unsigned int size); |
93 | extern void platform_cache_flush_wimg(unsigned int new_wimg); |
94 | extern void platform_cache_clean(void); |
95 | extern void platform_cache_shutdown(void); |
96 | extern void platform_cache_disable(void); |
97 | |
98 | #endif /* #ifndef _ARM_CACHES_INTERNAL */ |
99 | |