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