]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueHobLib.h
Update the copyright notice format
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Include / Library / EdkIIGlueHobLib.h
1 /*++
2
3 Copyright (c) 2004 - 2006, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12
13 Module Name:
14
15 EdkIIGlueHobLib.h
16
17 Abstract:
18
19 Public header file for Hob Lib
20
21 --*/
22
23 #ifndef __EDKII_GLUE_HOB_LIB_H__
24 #define __EDKII_GLUE_HOB_LIB_H__
25
26
27 #define GetFirstGuidHob(_GUID) GlueGetFirstGuidHob(_GUID)
28 #define GetNextGuidHob(_GUID, _HobStart) GlueGetNextGuidHob(_GUID, _HobStart)
29 #define BuildFvHob(_BASEADDRESS, _LENGTH) GlueBuildFvHob(_BASEADDRESS, _LENGTH)
30 #define BuildModuleHob(_MODULENAME, _MEMORYALLOCATIONMODULE, _MODULELENGTH, _ENTRYPOINT) GlueBuildModuleHob(_MODULENAME, _MEMORYALLOCATIONMODULE, _MODULELENGTH, _ENTRYPOINT)
31 #define BuildMemoryAllocationHob(_BASEADDRESS, _LENGTH, _MEMORYTYPE) GlueBuildMemoryAllocationHob(_BASEADDRESS, _LENGTH, _MEMORYTYPE)
32
33
34 /**
35 Returns the pointer to the HOB list.
36
37 This function returns the pointer to first HOB in the list.
38
39 @return The pointer to the HOB list.
40
41 **/
42 VOID *
43 EFIAPI
44 GetHobList (
45 VOID
46 );
47
48 /**
49 Returns the next instance of a HOB type from the starting HOB.
50
51 This function searches the first instance of a HOB type from the starting HOB pointer.
52 If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
53 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
54 unconditionally: it returns HobStart back if HobStart itself meets the requirement;
55 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
56 If HobStart is NULL, then ASSERT().
57
58 @param Type The HOB type to return.
59 @param HobStart The starting HOB pointer to search from.
60
61 @return The next instance of a HOB type from the starting HOB.
62
63 **/
64 VOID *
65 EFIAPI
66 GetNextHob (
67 IN UINT16 Type,
68 IN CONST VOID *HobStart
69 );
70
71 /**
72 Returns the first instance of a HOB type among the whole HOB list.
73
74 This function searches the first instance of a HOB type among the whole HOB list.
75 If there does not exist such HOB type in the HOB list, it will return NULL.
76
77 @param Type The HOB type to return.
78
79 @return The next instance of a HOB type from the starting HOB.
80
81 **/
82 VOID *
83 EFIAPI
84 GetFirstHob (
85 IN UINT16 Type
86 );
87
88 /**
89 This function searches the first instance of a HOB from the starting HOB pointer.
90 Such HOB should satisfy two conditions:
91 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
92 If there does not exist such HOB from the starting HOB pointer, it will return NULL.
93 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
94 to extract the data section and its size info respectively.
95 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
96 unconditionally: it returns HobStart back if HobStart itself meets the requirement;
97 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
98 If Guid is NULL, then ASSERT().
99 If HobStart is NULL, then ASSERT().
100
101 @param Guid The GUID to match with in the HOB list.
102 @param HobStart A pointer to a Guid.
103
104 @return The next instance of the matched GUID HOB from the starting HOB.
105
106 **/
107 VOID *
108 EFIAPI
109 GlueGetNextGuidHob (
110 IN CONST EFI_GUID *Guid,
111 IN CONST VOID *HobStart
112 );
113
114 /**
115 This function searches the first instance of a HOB among the whole HOB list.
116 Such HOB should satisfy two conditions:
117 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
118 If there does not exist such HOB from the starting HOB pointer, it will return NULL.
119 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
120 to extract the data section and its size info respectively.
121 If Guid is NULL, then ASSERT().
122
123 @param Guid The GUID to match with in the HOB list.
124
125 @return The first instance of the matched GUID HOB among the whole HOB list.
126
127 **/
128 VOID *
129 EFIAPI
130 GlueGetFirstGuidHob (
131 IN CONST EFI_GUID *Guid
132 );
133
134 /**
135 Get the Boot Mode from the HOB list.
136
137 This function returns the system boot mode information from the
138 PHIT HOB in HOB list.
139
140 @param VOID
141
142 @return The Boot Mode.
143
144 **/
145 EFI_BOOT_MODE
146 EFIAPI
147 GetBootModeHob (
148 VOID
149 );
150
151 /**
152 Builds a HOB for a loaded PE32 module.
153
154 This function builds a HOB for a loaded PE32 module.
155 It can only be invoked during PEI phase;
156 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
157 If ModuleName is NULL, then ASSERT().
158 If there is no additional space for HOB creation, then ASSERT().
159
160 @param ModuleName The GUID File Name of the module.
161 @param MemoryAllocationModule The 64 bit physical address of the module.
162 @param ModuleLength The length of the module in bytes.
163 @param EntryPoint The 64 bit physical address of the module entry point.
164
165 **/
166 VOID
167 EFIAPI
168 GlueBuildModuleHob (
169 IN CONST EFI_GUID *ModuleName,
170 IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
171 IN UINT64 ModuleLength,
172 IN EFI_PHYSICAL_ADDRESS EntryPoint
173 );
174
175 /**
176 Builds a HOB that describes a chunk of system memory.
177
178 This function builds a HOB that describes a chunk of system memory.
179 It can only be invoked during PEI phase;
180 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
181 If there is no additional space for HOB creation, then ASSERT().
182
183 @param ResourceType The type of resource described by this HOB.
184 @param ResourceAttribute The resource attributes of the memory described by this HOB.
185 @param PhysicalStart The 64 bit physical address of memory described by this HOB.
186 @param NumberOfBytes The length of the memory described by this HOB in bytes.
187
188 **/
189 VOID
190 EFIAPI
191 BuildResourceDescriptorHob (
192 IN EFI_RESOURCE_TYPE ResourceType,
193 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
194 IN EFI_PHYSICAL_ADDRESS PhysicalStart,
195 IN UINT64 NumberOfBytes
196 );
197
198 /**
199 Builds a GUID HOB with a certain data length.
200
201 This function builds a customized HOB tagged with a GUID for identification
202 and returns the start address of GUID HOB data so that caller can fill the customized data.
203 The HOB Header and Name field is already stripped.
204 It can only be invoked during PEI phase;
205 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
206 If Guid is NULL, then ASSERT().
207 If there is no additional space for HOB creation, then ASSERT().
208 If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
209
210 @param Guid The GUID to tag the customized HOB.
211 @param DataLength The size of the data payload for the GUID HOB.
212
213 @return The start address of GUID HOB data.
214
215 **/
216 VOID *
217 EFIAPI
218 BuildGuidHob (
219 IN CONST EFI_GUID *Guid,
220 IN UINTN DataLength
221 );
222
223 /**
224 Copies a data buffer to a newly-built HOB.
225
226 This function builds a customized HOB tagged with a GUID for identification,
227 copies the input data to the HOB data field and returns the start address of the GUID HOB data.
228 The HOB Header and Name field is already stripped.
229 It can only be invoked during PEI phase;
230 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
231 If Guid is NULL, then ASSERT().
232 If Data is NULL and DataLength > 0, then ASSERT().
233 If there is no additional space for HOB creation, then ASSERT().
234 If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
235
236 @param Guid The GUID to tag the customized HOB.
237 @param Data The data to be copied into the data field of the GUID HOB.
238 @param DataLength The size of the data payload for the GUID HOB.
239
240 @return The start address of GUID HOB data.
241
242 **/
243 VOID *
244 EFIAPI
245 BuildGuidDataHob (
246 IN CONST EFI_GUID *Guid,
247 IN VOID *Data,
248 IN UINTN DataLength
249 );
250
251 /**
252 Builds a Firmware Volume HOB.
253
254 This function builds a Firmware Volume HOB.
255 It can only be invoked during PEI phase;
256 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
257 If there is no additional space for HOB creation, then ASSERT().
258
259 @param BaseAddress The base address of the Firmware Volume.
260 @param Length The size of the Firmware Volume in bytes.
261
262 **/
263 VOID
264 EFIAPI
265 BuildFvHob (
266 IN EFI_PHYSICAL_ADDRESS BaseAddress,
267 IN UINT64 Length
268 );
269
270 /**
271 Builds a Capsule Volume HOB.
272
273 This function builds a Capsule Volume HOB.
274 It can only be invoked during PEI phase;
275 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
276 If there is no additional space for HOB creation, then ASSERT().
277
278 @param BaseAddress The base address of the Capsule Volume.
279 @param Length The size of the Capsule Volume in bytes.
280
281 **/
282 VOID
283 EFIAPI
284 BuildCvHob (
285 IN EFI_PHYSICAL_ADDRESS BaseAddress,
286 IN UINT64 Length
287 );
288
289 /**
290 Builds a HOB for the CPU.
291
292 This function builds a HOB for the CPU.
293 It can only be invoked during PEI phase;
294 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
295 If there is no additional space for HOB creation, then ASSERT().
296
297 @param SizeOfMemorySpace The maximum physical memory addressability of the processor.
298 @param SizeOfIoSpace The maximum physical I/O addressability of the processor.
299
300 **/
301 VOID
302 EFIAPI
303 BuildCpuHob (
304 IN UINT8 SizeOfMemorySpace,
305 IN UINT8 SizeOfIoSpace
306 );
307
308 /**
309 Builds a HOB for the Stack.
310
311 This function builds a HOB for the stack.
312 It can only be invoked during PEI phase;
313 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
314 If there is no additional space for HOB creation, then ASSERT().
315
316 @param BaseAddress The 64 bit physical address of the Stack.
317 @param Length The length of the stack in bytes.
318
319 **/
320 VOID
321 EFIAPI
322 BuildStackHob (
323 IN EFI_PHYSICAL_ADDRESS BaseAddress,
324 IN UINT64 Length
325 );
326
327 /**
328 Builds a HOB for the BSP store.
329
330 This function builds a HOB for BSP store.
331 It can only be invoked during PEI phase;
332 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
333 If there is no additional space for HOB creation, then ASSERT().
334
335 @param BaseAddress The 64 bit physical address of the BSP.
336 @param Length The length of the BSP store in bytes.
337 @param MemoryType Type of memory allocated by this HOB.
338
339 **/
340 VOID
341 EFIAPI
342 BuildBspStoreHob (
343 IN EFI_PHYSICAL_ADDRESS BaseAddress,
344 IN UINT64 Length,
345 IN EFI_MEMORY_TYPE MemoryType
346 );
347
348 /**
349 Builds a HOB for the memory allocation.
350
351 This function builds a HOB for the memory allocation.
352 It can only be invoked during PEI phase;
353 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
354 If there is no additional space for HOB creation, then ASSERT().
355
356 @param BaseAddress The 64 bit physical address of the memory.
357 @param Length The length of the memory allocation in bytes.
358 @param MemoryType Type of memory allocated by this HOB.
359
360 **/
361 VOID
362 EFIAPI
363 GlueBuildMemoryAllocationHob (
364 IN EFI_PHYSICAL_ADDRESS BaseAddress,
365 IN UINT64 Length,
366 IN EFI_MEMORY_TYPE MemoryType
367 );
368
369 #endif