]>
git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Library/BaseCacheMaintenanceLib/EbcCache.c
2 Cache Maintenance Functions.
4 Copyright (c) 2006, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 // Include common header file for this module.
18 #include "CommonHeader.h"
21 Invalidates the entire instruction cache in cache coherency domain of the
24 Invalidates the entire instruction cache in cache coherency domain of the
30 InvalidateInstructionCache (
37 Invalidates a range of instruction cache lines in the cache coherency domain
40 Invalidates the instruction cache lines specified by Address and Length. If
41 Address is not aligned on a cache line boundary, then entire instruction
42 cache line containing Address is invalidated. If Address + Length is not
43 aligned on a cache line boundary, then the entire instruction cache line
44 containing Address + Length -1 is invalidated. This function may choose to
45 invalidate the entire instruction cache if that is more efficient than
46 invalidating the specified range. If Length is 0, the no instruction cache
47 lines are invalidated. Address is returned.
49 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
51 @param Address The base address of the instruction cache lines to
52 invalidate. If the CPU is in a physical addressing mode, then
53 Address is a physical address. If the CPU is in a virtual
54 addressing mode, then Address is a virtual address.
56 @param Length The number of bytes to invalidate from the instruction cache.
63 InvalidateInstructionCacheRange (
68 ASSERT (Length
<= MAX_ADDRESS
- (UINTN
)Address
+ 1);
73 Writes Back and Invalidates the entire data cache in cache coherency domain
76 Writes Back and Invalidates the entire data cache in cache coherency domain
77 of the calling CPU. This function guarantees that all dirty cache lines are
78 written back to system memory, and also invalidates all the data cache lines
79 in the cache coherency domain of the calling CPU.
84 WriteBackInvalidateDataCache (
91 Writes Back and Invalidates a range of data cache lines in the cache
92 coherency domain of the calling CPU.
94 Writes Back and Invalidate the data cache lines specified by Address and
95 Length. If Address is not aligned on a cache line boundary, then entire data
96 cache line containing Address is written back and invalidated. If Address +
97 Length is not aligned on a cache line boundary, then the entire data cache
98 line containing Address + Length -1 is written back and invalidated. This
99 function may choose to write back and invalidate the entire data cache if
100 that is more efficient than writing back and invalidating the specified
101 range. If Length is 0, the no data cache lines are written back and
102 invalidated. Address is returned.
104 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
106 @param Address The base address of the data cache lines to write back and
107 invalidate. If the CPU is in a physical addressing mode, then
108 Address is a physical address. If the CPU is in a virtual
109 addressing mode, then Address is a virtual address.
110 @param Length The number of bytes to write back and invalidate from the
118 WriteBackInvalidateDataCacheRange (
123 ASSERT (Length
<= MAX_ADDRESS
- (UINTN
)Address
+ 1);
128 Writes Back the entire data cache in cache coherency domain of the calling
131 Writes Back the entire data cache in cache coherency domain of the calling
132 CPU. This function guarantees that all dirty cache lines are written back to
133 system memory. This function may also invalidate all the data cache lines in
134 the cache coherency domain of the calling CPU.
146 Writes Back a range of data cache lines in the cache coherency domain of the
149 Writes Back the data cache lines specified by Address and Length. If Address
150 is not aligned on a cache line boundary, then entire data cache line
151 containing Address is written back. If Address + Length is not aligned on a
152 cache line boundary, then the entire data cache line containing Address +
153 Length -1 is written back. This function may choose to write back the entire
154 data cache if that is more efficient than writing back the specified range.
155 If Length is 0, the no data cache lines are written back. This function may
156 also invalidate all the data cache lines in the specified range of the cache
157 coherency domain of the calling CPU. Address is returned.
159 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
161 @param Address The base address of the data cache lines to write back. If
162 the CPU is in a physical addressing mode, then Address is a
163 physical address. If the CPU is in a virtual addressing
164 mode, then Address is a virtual address.
165 @param Length The number of bytes to write back from the data cache.
172 WriteBackDataCacheRange (
177 ASSERT (Length
<= MAX_ADDRESS
- (UINTN
)Address
+ 1);
182 Invalidates the entire data cache in cache coherency domain of the calling
185 Invalidates the entire data cache in cache coherency domain of the calling
186 CPU. This function must be used with care because dirty cache lines are not
187 written back to system memory. It is typically used for cache diagnostics. If
188 the CPU does not support invalidation of the entire data cache, then a write
189 back and invalidate operation should be performed on the entire data cache.
194 InvalidateDataCache (
201 Invalidates a range of data cache lines in the cache coherency domain of the
204 Invalidates the data cache lines specified by Address and Length. If Address
205 is not aligned on a cache line boundary, then entire data cache line
206 containing Address is invalidated. If Address + Length is not aligned on a
207 cache line boundary, then the entire data cache line containing Address +
208 Length -1 is invalidated. This function must never invalidate any cache lines
209 outside the specified range. If Length is 0, the no data cache lines are
210 invalidated. Address is returned. This function must be used with care
211 because dirty cache lines are not written back to system memory. It is
212 typically used for cache diagnostics. If the CPU does not support
213 invalidation of a data cache range, then a write back and invalidate
214 operation should be performed on the data cache range.
216 If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT().
218 @param Address The base address of the data cache lines to invalidate. If
219 the CPU is in a physical addressing mode, then Address is a
220 physical address. If the CPU is in a virtual addressing mode,
221 then Address is a virtual address.
222 @param Length The number of bytes to invalidate from the data cache.
229 InvalidateDataCacheRange (
234 ASSERT (Length
<= MAX_ADDRESS
- (UINTN
)Address
+ 1);