]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides services to maintain instruction and data caches.\r |
d80b2f71 | 3 | \r |
4 | The Cache Maintenance Library provides abstractions for basic processor cache operations.\r | |
5 | It removes the need to use assembly in C code.\r | |
6 | \r | |
50a64e5b | 7 | Copyright (c) 2006 - 2008, Intel Corporation\r |
8 | All rights reserved. This program and the accompanying materials\r | |
9 | are licensed and made available under the terms and conditions of the BSD License\r | |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
fb3df220 | 12 | \r |
50a64e5b | 13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 15 | \r |
fb3df220 | 16 | **/\r |
17 | \r | |
18 | #ifndef __CACHE_MAINTENANCE_LIB__\r | |
19 | #define __CACHE_MAINTENANCE_LIB__\r | |
20 | \r | |
21 | /**\r | |
22 | Invalidates the entire instruction cache in cache coherency domain of the\r | |
23 | calling CPU.\r | |
24 | \r | |
25 | Invalidates the entire instruction cache in cache coherency domain of the\r | |
26 | calling CPU.\r | |
27 | \r | |
28 | **/\r | |
29 | VOID\r | |
30 | EFIAPI\r | |
31 | InvalidateInstructionCache (\r | |
32 | VOID\r | |
33 | );\r | |
34 | \r | |
35 | /**\r | |
36 | Invalidates a range of instruction cache lines in the cache coherency domain\r | |
37 | of the calling CPU.\r | |
38 | \r | |
39 | Invalidates the instruction cache lines specified by Address and Length. If\r | |
40 | Address is not aligned on a cache line boundary, then entire instruction\r | |
41 | cache line containing Address is invalidated. If Address + Length is not\r | |
42 | aligned on a cache line boundary, then the entire instruction cache line\r | |
43 | containing Address + Length -1 is invalidated. This function may choose to\r | |
44 | invalidate the entire instruction cache if that is more efficient than\r | |
45 | invalidating the specified range. If Length is 0, the no instruction cache\r | |
46 | lines are invalidated. Address is returned.\r | |
47 | \r | |
48 | If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r | |
49 | \r | |
50 | @param Address The base address of the instruction cache lines to\r | |
51 | invalidate. If the CPU is in a physical addressing mode, then\r | |
52 | Address is a physical address. If the CPU is in a virtual\r | |
53 | addressing mode, then Address is a virtual address.\r | |
54 | \r | |
55 | @param Length The number of bytes to invalidate from the instruction cache.\r | |
56 | \r | |
57 | @return Address\r | |
58 | \r | |
59 | **/\r | |
60 | VOID *\r | |
61 | EFIAPI\r | |
62 | InvalidateInstructionCacheRange (\r | |
63 | IN VOID *Address,\r | |
64 | IN UINTN Length\r | |
65 | );\r | |
66 | \r | |
67 | /**\r | |
68 | Writes Back and Invalidates the entire data cache in cache coherency domain\r | |
69 | of the calling CPU.\r | |
70 | \r | |
71 | Writes Back and Invalidates the entire data cache in cache coherency domain\r | |
72 | of the calling CPU. This function guarantees that all dirty cache lines are\r | |
73 | written back to system memory, and also invalidates all the data cache lines\r | |
74 | in the cache coherency domain of the calling CPU.\r | |
75 | \r | |
76 | **/\r | |
77 | VOID\r | |
78 | EFIAPI\r | |
79 | WriteBackInvalidateDataCache (\r | |
80 | VOID\r | |
81 | );\r | |
82 | \r | |
83 | /**\r | |
84 | Writes Back and Invalidates a range of data cache lines in the cache\r | |
85 | coherency domain of the calling CPU.\r | |
86 | \r | |
87 | Writes Back and Invalidate the data cache lines specified by Address and\r | |
88 | Length. If Address is not aligned on a cache line boundary, then entire data\r | |
89 | cache line containing Address is written back and invalidated. If Address +\r | |
90 | Length is not aligned on a cache line boundary, then the entire data cache\r | |
91 | line containing Address + Length -1 is written back and invalidated. This\r | |
92 | function may choose to write back and invalidate the entire data cache if\r | |
93 | that is more efficient than writing back and invalidating the specified\r | |
94 | range. If Length is 0, the no data cache lines are written back and\r | |
95 | invalidated. Address is returned.\r | |
96 | \r | |
97 | If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r | |
98 | \r | |
99 | @param Address The base address of the data cache lines to write back and\r | |
100 | invalidate. If the CPU is in a physical addressing mode, then\r | |
101 | Address is a physical address. If the CPU is in a virtual\r | |
102 | addressing mode, then Address is a virtual address.\r | |
103 | @param Length The number of bytes to write back and invalidate from the\r | |
104 | data cache.\r | |
105 | \r | |
106 | @return Address\r | |
107 | \r | |
108 | **/\r | |
109 | VOID *\r | |
110 | EFIAPI\r | |
111 | WriteBackInvalidateDataCacheRange (\r | |
112 | IN VOID *Address,\r | |
113 | IN UINTN Length\r | |
114 | );\r | |
115 | \r | |
116 | /**\r | |
117 | Writes Back the entire data cache in cache coherency domain of the calling\r | |
118 | CPU.\r | |
119 | \r | |
120 | Writes Back the entire data cache in cache coherency domain of the calling\r | |
121 | CPU. This function guarantees that all dirty cache lines are written back to\r | |
122 | system memory. This function may also invalidate all the data cache lines in\r | |
123 | the cache coherency domain of the calling CPU.\r | |
124 | \r | |
125 | **/\r | |
126 | VOID\r | |
127 | EFIAPI\r | |
128 | WriteBackDataCache (\r | |
129 | VOID\r | |
130 | );\r | |
131 | \r | |
132 | /**\r | |
133 | Writes Back a range of data cache lines in the cache coherency domain of the\r | |
134 | calling CPU.\r | |
135 | \r | |
136 | Writes Back the data cache lines specified by Address and Length. If Address\r | |
137 | is not aligned on a cache line boundary, then entire data cache line\r | |
138 | containing Address is written back. If Address + Length is not aligned on a\r | |
139 | cache line boundary, then the entire data cache line containing Address +\r | |
140 | Length -1 is written back. This function may choose to write back the entire\r | |
141 | data cache if that is more efficient than writing back the specified range.\r | |
142 | If Length is 0, the no data cache lines are written back. This function may\r | |
143 | also invalidate all the data cache lines in the specified range of the cache\r | |
144 | coherency domain of the calling CPU. Address is returned.\r | |
145 | \r | |
146 | If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r | |
147 | \r | |
148 | @param Address The base address of the data cache lines to write back. If\r | |
149 | the CPU is in a physical addressing mode, then Address is a\r | |
150 | physical address. If the CPU is in a virtual addressing\r | |
151 | mode, then Address is a virtual address.\r | |
152 | @param Length The number of bytes to write back from the data cache.\r | |
153 | \r | |
154 | @return Address\r | |
155 | \r | |
156 | **/\r | |
157 | VOID *\r | |
158 | EFIAPI\r | |
159 | WriteBackDataCacheRange (\r | |
160 | IN VOID *Address,\r | |
161 | IN UINTN Length\r | |
162 | );\r | |
163 | \r | |
164 | /**\r | |
165 | Invalidates the entire data cache in cache coherency domain of the calling\r | |
166 | CPU.\r | |
167 | \r | |
168 | Invalidates the entire data cache in cache coherency domain of the calling\r | |
169 | CPU. This function must be used with care because dirty cache lines are not\r | |
170 | written back to system memory. It is typically used for cache diagnostics. If\r | |
171 | the CPU does not support invalidation of the entire data cache, then a write\r | |
172 | back and invalidate operation should be performed on the entire data cache.\r | |
173 | \r | |
174 | **/\r | |
175 | VOID\r | |
176 | EFIAPI\r | |
177 | InvalidateDataCache (\r | |
178 | VOID\r | |
179 | );\r | |
180 | \r | |
181 | /**\r | |
182 | Invalidates a range of data cache lines in the cache coherency domain of the\r | |
183 | calling CPU.\r | |
184 | \r | |
185 | Invalidates the data cache lines specified by Address and Length. If Address\r | |
186 | is not aligned on a cache line boundary, then entire data cache line\r | |
187 | containing Address is invalidated. If Address + Length is not aligned on a\r | |
188 | cache line boundary, then the entire data cache line containing Address +\r | |
189 | Length -1 is invalidated. This function must never invalidate any cache lines\r | |
190 | outside the specified range. If Length is 0, the no data cache lines are\r | |
191 | invalidated. Address is returned. This function must be used with care\r | |
192 | because dirty cache lines are not written back to system memory. It is\r | |
193 | typically used for cache diagnostics. If the CPU does not support\r | |
194 | invalidation of a data cache range, then a write back and invalidate\r | |
195 | operation should be performed on the data cache range.\r | |
196 | \r | |
197 | If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r | |
198 | \r | |
199 | @param Address The base address of the data cache lines to invalidate. If\r | |
200 | the CPU is in a physical addressing mode, then Address is a\r | |
201 | physical address. If the CPU is in a virtual addressing mode,\r | |
202 | then Address is a virtual address.\r | |
203 | @param Length The number of bytes to invalidate from the data cache.\r | |
204 | \r | |
205 | @return Address\r | |
206 | \r | |
207 | **/\r | |
208 | VOID *\r | |
209 | EFIAPI\r | |
210 | InvalidateDataCacheRange (\r | |
211 | IN VOID *Address,\r | |
212 | IN UINTN Length\r | |
213 | );\r | |
214 | \r | |
215 | #endif\r |