]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseCacheMaintenanceLib/LoongArchCache.c
2 Cache Maintenance Functions for LoongArch.
3 LoongArch cache maintenance functions has not yet been completed, and will added in later.
4 Functions are null functions now.
6 Copyright (c) 2022, Loongson Technology Corporation Limited. All rights reserved.<BR>
8 SPDX-License-Identifier: BSD-2-Clause-Patent
13 // Include common header file for this module.
16 #include <Library/BaseLib.h>
17 #include <Library/DebugLib.h>
20 LoongArch data barrier operation.
24 AsmDataBarrierLoongArch (
29 LoongArch instruction barrier operation.
33 AsmInstructionBarrierLoongArch (
38 Invalidates the entire instruction cache in cache coherency domain of the
44 InvalidateInstructionCache (
48 AsmInstructionBarrierLoongArch ();
52 Invalidates a range of instruction cache lines in the cache coherency domain
55 Invalidates the instruction cache lines specified by Address and Length. If
56 Address is not aligned on a cache line boundary, then entire instruction
57 cache line containing Address is invalidated. If Address + Length is not
58 aligned on a cache line boundary, then the entire instruction cache line
59 containing Address + Length -1 is invalidated. This function may choose to
60 invalidate the entire instruction cache if that is more efficient than
61 invalidating the specified range. If Length is 0, the no instruction cache
62 lines are invalidated. Address is returned.
64 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
66 @param[in] Address The base address of the instruction cache lines to
67 invalidate. If the CPU is in a physical addressing mode, then
68 Address is a physical address. If the CPU is in a virtual
69 addressing mode, then Address is a virtual address.
71 @param[in] Length The number of bytes to invalidate from the instruction cache.
78 InvalidateInstructionCacheRange (
83 AsmInstructionBarrierLoongArch ();
88 Writes Back and Invalidates the entire data cache in cache coherency domain
91 Writes Back and Invalidates the entire data cache in cache coherency domain
92 of the calling CPU. This function guarantees that all dirty cache lines are
93 written back to system memory, and also invalidates all the data cache lines
94 in the cache coherency domain of the calling CPU.
99 WriteBackInvalidateDataCache (
103 DEBUG ((DEBUG_ERROR
, "%a: Not currently implemented on LoongArch.\n", __FUNCTION__
));
107 Writes Back and Invalidates a range of data cache lines in the cache
108 coherency domain of the calling CPU.
110 Writes Back and Invalidate the data cache lines specified by Address and
111 Length. If Address is not aligned on a cache line boundary, then entire data
112 cache line containing Address is written back and invalidated. If Address +
113 Length is not aligned on a cache line boundary, then the entire data cache
114 line containing Address + Length -1 is written back and invalidated. This
115 function may choose to write back and invalidate the entire data cache if
116 that is more efficient than writing back and invalidating the specified
117 range. If Length is 0, the no data cache lines are written back and
118 invalidated. Address is returned.
120 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
122 @param[in] Address The base address of the data cache lines to write back and
123 invalidate. If the CPU is in a physical addressing mode, then
124 Address is a physical address. If the CPU is in a virtual
125 addressing mode, then Address is a virtual address.
126 @param[in] Length The number of bytes to write back and invalidate from the
129 @return Address of cache invalidation.
134 WriteBackInvalidateDataCacheRange (
139 DEBUG ((DEBUG_ERROR
, "%a: Not currently implemented on LoongArch.\n", __FUNCTION__
));
144 Writes Back the entire data cache in cache coherency domain of the calling
147 Writes Back the entire data cache in cache coherency domain of the calling
148 CPU. This function guarantees that all dirty cache lines are written back to
149 system memory. This function may also invalidate all the data cache lines in
150 the cache coherency domain of the calling CPU.
159 WriteBackInvalidateDataCache ();
163 Writes Back a range of data cache lines in the cache coherency domain of the
166 Writes Back the data cache lines specified by Address and Length. If Address
167 is not aligned on a cache line boundary, then entire data cache line
168 containing Address is written back. If Address + Length is not aligned on a
169 cache line boundary, then the entire data cache line containing Address +
170 Length -1 is written back. This function may choose to write back the entire
171 data cache if that is more efficient than writing back the specified range.
172 If Length is 0, the no data cache lines are written back. This function may
173 also invalidate all the data cache lines in the specified range of the cache
174 coherency domain of the calling CPU. Address is returned.
176 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
178 @param[in] Address The base address of the data cache lines to write back. If
179 the CPU is in a physical addressing mode, then Address is a
180 physical address. If the CPU is in a virtual addressing
181 mode, then Address is a virtual address.
182 @param[in] Length The number of bytes to write back from the data cache.
184 @return Address of cache written in main memory.
189 WriteBackDataCacheRange (
194 DEBUG ((DEBUG_ERROR
, "%a: Not currently implemented on LoongArch.\n", __FUNCTION__
));
199 Invalidates the entire data cache in cache coherency domain of the calling
202 Invalidates the entire data cache in cache coherency domain of the calling
203 CPU. This function must be used with care because dirty cache lines are not
204 written back to system memory. It is typically used for cache diagnostics. If
205 the CPU does not support invalidation of the entire data cache, then a write
206 back and invalidate operation should be performed on the entire data cache.
211 InvalidateDataCache (
215 AsmDataBarrierLoongArch ();
219 Invalidates a range of data cache lines in the cache coherency domain of the
222 Invalidates the data cache lines specified by Address and Length. If Address
223 is not aligned on a cache line boundary, then entire data cache line
224 containing Address is invalidated. If Address + Length is not aligned on a
225 cache line boundary, then the entire data cache line containing Address +
226 Length -1 is invalidated. This function must never invalidate any cache lines
227 outside the specified range. If Length is 0, the no data cache lines are
228 invalidated. Address is returned. This function must be used with care
229 because dirty cache lines are not written back to system memory. It is
230 typically used for cache diagnostics. If the CPU does not support
231 invalidation of a data cache range, then a write back and invalidate
232 operation should be performed on the data cache range.
234 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
236 @param[in] Address The base address of the data cache lines to invalidate. If
237 the CPU is in a physical addressing mode, then Address is a
238 physical address. If the CPU is in a virtual addressing mode,
239 then Address is a virtual address.
240 @param[in] Length The number of bytes to invalidate from the data cache.
247 InvalidateDataCacheRange (
252 AsmDataBarrierLoongArch ();