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