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