]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/PeiMemoryLib/MemLibInternals.h
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Library / PeiMemoryLib / MemLibInternals.h
CommitLineData
dd51a993 1/** @file\r
2 Declaration of internal functions for Base Memory Library.\r
3\r
9095d37b 4 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
19388d29 5 This program and the accompanying materials\r
dd51a993 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
2fc59a00 8 http://opensource.org/licenses/bsd-license.php.\r
dd51a993 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
dd51a993 13**/\r
14\r
15#ifndef __MEM_LIB_INTERNALS__\r
16#define __MEM_LIB_INTERNALS__\r
17\r
bad46384 18#include <PiPei.h>\r
c892d846 19\r
bad46384 20#include <Library/BaseMemoryLib.h>\r
21#include <Library/PeiServicesTablePointerLib.h>\r
22#include <Library/DebugLib.h>\r
23#include <Library/BaseLib.h>\r
24\r
dd51a993 25/**\r
0c3437e0 26 Copies a source buffer to a destination buffer, and returns the destination buffer.\r
dd51a993 27\r
1fef058f 28 This function wraps the (*PeiServices)->CopyMem ().\r
9095d37b 29\r
2fc59a00 30 @param DestinationBuffer The pointer to the destination buffer of the memory copy.\r
31 @param SourceBuffer The pointer to the source buffer of the memory copy.\r
32 @param Length The number of bytes to copy from SourceBuffer to DestinationBuffer.\r
dd51a993 33\r
0c3437e0 34 @return DestinationBuffer.\r
dd51a993 35\r
36**/\r
37VOID *\r
38EFIAPI\r
39InternalMemCopyMem (\r
0c3437e0 40 OUT VOID *Destination,\r
41 IN CONST VOID *Source,\r
dd51a993 42 IN UINTN Length\r
43 );\r
44\r
45/**\r
0c3437e0 46 Fills a target buffer with a byte value, and returns the target buffer.\r
dd51a993 47\r
1fef058f 48 This function wraps the (*PeiServices)->SetMem ().\r
9095d37b 49\r
58380e9c 50 @param Buffer The memory to set.\r
2fc59a00 51 @param Size The number of bytes to set.\r
0c3437e0 52 @param Value Value of the set operation.\r
dd51a993 53\r
0c3437e0 54 @return Buffer.\r
dd51a993 55\r
56**/\r
57VOID *\r
58EFIAPI\r
59InternalMemSetMem (\r
60 OUT VOID *Buffer,\r
0c3437e0 61 IN UINTN Size,\r
dd51a993 62 IN UINT8 Value\r
63 );\r
64\r
65/**\r
66 Fills a target buffer with a 16-bit value, and returns the target buffer.\r
67\r
2fc59a00 68 @param Buffer The pointer to the target buffer to fill.\r
69 @param Length The count of 16-bit value to fill.\r
70 @param Value The value with which to fill Length bytes of Buffer.\r
dd51a993 71\r
72 @return Buffer\r
73\r
74**/\r
75VOID *\r
76EFIAPI\r
77InternalMemSetMem16 (\r
78 OUT VOID *Buffer,\r
79 IN UINTN Length,\r
80 IN UINT16 Value\r
81 );\r
82\r
83/**\r
84 Fills a target buffer with a 32-bit value, and returns the target buffer.\r
85\r
2fc59a00 86 @param Buffer The pointer to the target buffer to fill.\r
87 @param Length The count of 32-bit value to fill.\r
88 @param Value The value with which to fill Length bytes of Buffer.\r
dd51a993 89\r
90 @return Buffer\r
91\r
92**/\r
93VOID *\r
94EFIAPI\r
95InternalMemSetMem32 (\r
96 OUT VOID *Buffer,\r
97 IN UINTN Length,\r
98 IN UINT32 Value\r
99 );\r
100\r
101/**\r
102 Fills a target buffer with a 64-bit value, and returns the target buffer.\r
103\r
2fc59a00 104 @param Buffer The pointer to the target buffer to fill.\r
105 @param Length The count of 64-bit value to fill.\r
106 @param Value The value with which to fill Length bytes of Buffer.\r
dd51a993 107\r
108 @return Buffer\r
109\r
110**/\r
111VOID *\r
112EFIAPI\r
113InternalMemSetMem64 (\r
114 OUT VOID *Buffer,\r
115 IN UINTN Length,\r
116 IN UINT64 Value\r
117 );\r
118\r
119/**\r
120 Set Buffer to 0 for Size bytes.\r
121\r
58380e9c 122 @param Buffer The memory to set.\r
2fc59a00 123 @param Length The number of bytes to set\r
dd51a993 124\r
125 @return Buffer\r
126\r
127**/\r
128VOID *\r
129EFIAPI\r
130InternalMemZeroMem (\r
131 OUT VOID *Buffer,\r
132 IN UINTN Length\r
133 );\r
134\r
135/**\r
136 Compares two memory buffers of a given length.\r
137\r
58380e9c 138 @param DestinationBuffer The first memory buffer\r
139 @param SourceBuffer The second memory buffer\r
140 @param Length The length of DestinationBuffer and SourceBuffer memory\r
dd51a993 141 regions to compare. Must be non-zero.\r
142\r
d531bfee 143 @return 0 All Length bytes of the two buffers are identical.\r
144 @retval Non-zero The first mismatched byte in SourceBuffer subtracted from the first\r
145 mismatched byte in DestinationBuffer.\r
dd51a993 146\r
147**/\r
148INTN\r
149EFIAPI\r
150InternalMemCompareMem (\r
151 IN CONST VOID *DestinationBuffer,\r
152 IN CONST VOID *SourceBuffer,\r
153 IN UINTN Length\r
154 );\r
155\r
156/**\r
157 Scans a target buffer for an 8-bit value, and returns a pointer to the\r
158 matching 8-bit value in the target buffer.\r
159\r
2fc59a00 160 @param Buffer The pointer to the target buffer to scan.\r
161 @param Length The count of 8-bit value to scan. Must be non-zero.\r
162 @param Value The value to search for in the target buffer.\r
dd51a993 163\r
58380e9c 164 @return The pointer to the first occurrence, or NULL if not found.\r
dd51a993 165\r
166**/\r
167CONST VOID *\r
168EFIAPI\r
169InternalMemScanMem8 (\r
170 IN CONST VOID *Buffer,\r
171 IN UINTN Length,\r
172 IN UINT8 Value\r
173 );\r
174\r
175/**\r
176 Scans a target buffer for a 16-bit value, and returns a pointer to the\r
177 matching 16-bit value in the target buffer.\r
178\r
2fc59a00 179 @param Buffer The pointer to the target buffer to scan.\r
180 @param Length The count of 16-bit value to scan. Must be non-zero.\r
181 @param Value The value to search for in the target buffer.\r
dd51a993 182\r
58380e9c 183 @return The pointer to the first occurrence, or NULL if not found.\r
dd51a993 184\r
185**/\r
186CONST VOID *\r
187EFIAPI\r
188InternalMemScanMem16 (\r
189 IN CONST VOID *Buffer,\r
190 IN UINTN Length,\r
191 IN UINT16 Value\r
192 );\r
193\r
194/**\r
195 Scans a target buffer for a 32-bit value, and returns a pointer to the\r
196 matching 32-bit value in the target buffer.\r
197\r
2fc59a00 198 @param Buffer The pointer to the target buffer to scan.\r
199 @param Length The count of 32-bit value to scan. Must be non-zero.\r
200 @param Value The value to search for in the target buffer.\r
dd51a993 201\r
58380e9c 202 @return The pointer to the first occurrence, or NULL if not found.\r
dd51a993 203\r
204**/\r
205CONST VOID *\r
206EFIAPI\r
207InternalMemScanMem32 (\r
208 IN CONST VOID *Buffer,\r
209 IN UINTN Length,\r
210 IN UINT32 Value\r
211 );\r
212\r
213/**\r
214 Scans a target buffer for a 64-bit value, and returns a pointer to the\r
215 matching 64-bit value in the target buffer.\r
216\r
2fc59a00 217 @param Buffer The pointer to the target buffer to scan.\r
218 @param Length The count of 64-bit value to scan. Must be non-zero.\r
219 @param Value The value to search for in the target buffer.\r
dd51a993 220\r
58380e9c 221 @return The pointer to the first occurrence, or NULL if not found.\r
dd51a993 222\r
223**/\r
224CONST VOID *\r
225EFIAPI\r
226InternalMemScanMem64 (\r
227 IN CONST VOID *Buffer,\r
228 IN UINTN Length,\r
229 IN UINT64 Value\r
230 );\r
231\r
1944b02b
HW
232/**\r
233 Checks whether the contents of a buffer are all zeros.\r
234\r
235 @param Buffer The pointer to the buffer to be checked.\r
236 @param Length The size of the buffer (in bytes) to be checked.\r
237\r
238 @retval TRUE Contents of the buffer are all zeros.\r
239 @retval FALSE Contents of the buffer are not all zeros.\r
240\r
241**/\r
242BOOLEAN\r
243EFIAPI\r
244InternalMemIsZeroBuffer (\r
245 IN CONST VOID *Buffer,\r
246 IN UINTN Length\r
247 );\r
248\r
dd51a993 249#endif\r