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