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