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