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