]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c
Removed CommonHeader.h generated file from the MdePkg.
[mirror_edk2.git] / MdePkg / Library / BaseCacheMaintenanceLib / EbcCache.c
CommitLineData
e1f414b6 1/** @file\r
2 Cache Maintenance Functions.\r
3\r
4 Copyright (c) 2006, Intel Corporation<BR>\r
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
15//\r
16// Include common header file for this module.\r
17//\r
f734a10a
A
18#include <Base.h>\r
19#include <Library/DebugLib.h>\r
e1f414b6 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
29VOID\r
30EFIAPI\r
31InvalidateInstructionCache (\r
32 VOID\r
33 )\r
34{\r
35}\r
36\r
37/**\r
38 Invalidates a range of instruction cache lines in the cache coherency domain\r
39 of the calling CPU.\r
40\r
41 Invalidates the instruction cache lines specified by Address and Length. If\r
42 Address is not aligned on a cache line boundary, then entire instruction\r
43 cache line containing Address is invalidated. If Address + Length is not\r
44 aligned on a cache line boundary, then the entire instruction cache line\r
45 containing Address + Length -1 is invalidated. This function may choose to\r
46 invalidate the entire instruction cache if that is more efficient than\r
47 invalidating the specified range. If Length is 0, the no instruction cache\r
48 lines are invalidated. Address is returned.\r
49\r
50 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r
51\r
52 @param Address The base address of the instruction cache lines to\r
53 invalidate. If the CPU is in a physical addressing mode, then\r
54 Address is a physical address. If the CPU is in a virtual\r
55 addressing mode, then Address is a virtual address.\r
56\r
57 @param Length The number of bytes to invalidate from the instruction cache.\r
58\r
59 @return Address\r
60\r
61**/\r
62VOID *\r
63EFIAPI\r
64InvalidateInstructionCacheRange (\r
65 IN VOID *Address,\r
66 IN UINTN Length\r
67 )\r
68{\r
69 ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);\r
70 return Address;\r
71}\r
72\r
73/**\r
74 Writes Back and Invalidates the entire data cache in cache coherency domain\r
75 of the calling CPU.\r
76\r
77 Writes Back and Invalidates the entire data cache in cache coherency domain\r
78 of the calling CPU. This function guarantees that all dirty cache lines are\r
79 written back to system memory, and also invalidates all the data cache lines\r
80 in the cache coherency domain of the calling CPU.\r
81\r
82**/\r
83VOID\r
84EFIAPI\r
85WriteBackInvalidateDataCache (\r
86 VOID\r
87 )\r
88{\r
89}\r
90\r
91/**\r
92 Writes Back and Invalidates a range of data cache lines in the cache\r
93 coherency domain of the calling CPU.\r
94\r
95 Writes Back and Invalidate the data cache lines specified by Address and\r
96 Length. If Address is not aligned on a cache line boundary, then entire data\r
97 cache line containing Address is written back and invalidated. If Address +\r
98 Length is not aligned on a cache line boundary, then the entire data cache\r
99 line containing Address + Length -1 is written back and invalidated. This\r
100 function may choose to write back and invalidate the entire data cache if\r
101 that is more efficient than writing back and invalidating the specified\r
102 range. If Length is 0, the no data cache lines are written back and\r
103 invalidated. Address is returned.\r
104\r
105 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r
106\r
107 @param Address The base address of the data cache lines to write back and\r
108 invalidate. If the CPU is in a physical addressing mode, then\r
109 Address is a physical address. If the CPU is in a virtual\r
110 addressing mode, then Address is a virtual address.\r
111 @param Length The number of bytes to write back and invalidate from the\r
112 data cache.\r
113\r
114 @return Address\r
115\r
116**/\r
117VOID *\r
118EFIAPI\r
119WriteBackInvalidateDataCacheRange (\r
120 IN VOID *Address,\r
121 IN UINTN Length\r
122 )\r
123{\r
124 ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);\r
125 return Address;\r
126}\r
127\r
128/**\r
129 Writes Back the entire data cache in cache coherency domain of the calling\r
130 CPU.\r
131\r
132 Writes Back the entire data cache in cache coherency domain of the calling\r
133 CPU. This function guarantees that all dirty cache lines are written back to\r
134 system memory. This function may also invalidate all the data cache lines in\r
135 the cache coherency domain of the calling CPU.\r
136\r
137**/\r
138VOID\r
139EFIAPI\r
140WriteBackDataCache (\r
141 VOID\r
142 )\r
143{\r
144}\r
145\r
146/**\r
147 Writes Back a range of data cache lines in the cache coherency domain of the\r
148 calling CPU.\r
149\r
150 Writes Back the data cache lines specified by Address and Length. If Address\r
151 is not aligned on a cache line boundary, then entire data cache line\r
152 containing Address is written back. If Address + Length is not aligned on a\r
153 cache line boundary, then the entire data cache line containing Address +\r
154 Length -1 is written back. This function may choose to write back the entire\r
155 data cache if that is more efficient than writing back the specified range.\r
156 If Length is 0, the no data cache lines are written back. This function may\r
157 also invalidate all the data cache lines in the specified range of the cache\r
158 coherency domain of the calling CPU. Address is returned.\r
159\r
160 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r
161\r
162 @param Address The base address of the data cache lines to write back. If\r
163 the CPU is in a physical addressing mode, then Address is a\r
164 physical address. If the CPU is in a virtual addressing\r
165 mode, then Address is a virtual address.\r
166 @param Length The number of bytes to write back from the data cache.\r
167\r
168 @return Address\r
169\r
170**/\r
171VOID *\r
172EFIAPI\r
173WriteBackDataCacheRange (\r
174 IN VOID *Address,\r
175 IN UINTN Length\r
176 )\r
177{\r
178 ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);\r
179 return Address;\r
180}\r
181\r
182/**\r
183 Invalidates the entire data cache in cache coherency domain of the calling\r
184 CPU.\r
185\r
186 Invalidates the entire data cache in cache coherency domain of the calling\r
187 CPU. This function must be used with care because dirty cache lines are not\r
188 written back to system memory. It is typically used for cache diagnostics. If\r
189 the CPU does not support invalidation of the entire data cache, then a write\r
190 back and invalidate operation should be performed on the entire data cache.\r
191\r
192**/\r
193VOID\r
194EFIAPI\r
195InvalidateDataCache (\r
196 VOID\r
197 )\r
198{\r
199}\r
200\r
201/**\r
202 Invalidates a range of data cache lines in the cache coherency domain of the\r
203 calling CPU.\r
204\r
205 Invalidates the data cache lines specified by Address and Length. If Address\r
206 is not aligned on a cache line boundary, then entire data cache line\r
207 containing Address is invalidated. If Address + Length is not aligned on a\r
208 cache line boundary, then the entire data cache line containing Address +\r
209 Length -1 is invalidated. This function must never invalidate any cache lines\r
210 outside the specified range. If Length is 0, the no data cache lines are\r
211 invalidated. Address is returned. This function must be used with care\r
212 because dirty cache lines are not written back to system memory. It is\r
213 typically used for cache diagnostics. If the CPU does not support\r
214 invalidation of a data cache range, then a write back and invalidate\r
215 operation should be performed on the data cache range.\r
216\r
217 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().\r
218\r
219 @param Address The base address of the data cache lines to invalidate. If\r
220 the CPU is in a physical addressing mode, then Address is a\r
221 physical address. If the CPU is in a virtual addressing mode,\r
222 then Address is a virtual address.\r
223 @param Length The number of bytes to invalidate from the data cache.\r
224\r
225 @return Address\r
226\r
227**/\r
228VOID *\r
229EFIAPI\r
230InvalidateDataCacheRange (\r
231 IN VOID *Address,\r
232 IN UINTN Length\r
233 )\r
234{\r
235 ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1);\r
236 return Address;\r
237}\r