3 Copyright (c) 2004 - 2011, 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
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.
19 Public header file for Hob Lib
23 #ifndef __EDKII_GLUE_HOB_LIB_H__
24 #define __EDKII_GLUE_HOB_LIB_H__
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)
35 Returns the pointer to the HOB list.
37 This function returns the pointer to first HOB in the list.
39 @return The pointer to the HOB list.
49 Returns the next instance of a HOB type from the starting HOB.
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().
58 @param Type The HOB type to return.
59 @param HobStart The starting HOB pointer to search from.
61 @return The next instance of a HOB type from the starting HOB.
68 IN CONST VOID
*HobStart
72 Returns the first instance of a HOB type among the whole HOB list.
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.
77 @param Type The HOB type to return.
79 @return The next instance of a HOB type from the starting HOB.
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().
101 @param Guid The GUID to match with in the HOB list.
102 @param HobStart A pointer to a Guid.
104 @return The next instance of the matched GUID HOB from the starting HOB.
110 IN CONST EFI_GUID
*Guid
,
111 IN CONST VOID
*HobStart
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().
123 @param Guid The GUID to match with in the HOB list.
125 @return The first instance of the matched GUID HOB among the whole HOB list.
130 GlueGetFirstGuidHob (
131 IN CONST EFI_GUID
*Guid
135 Get the Boot Mode from the HOB list.
137 This function returns the system boot mode information from the
138 PHIT HOB in HOB list.
142 @return The Boot Mode.
152 Builds a HOB for a loaded PE32 module.
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().
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.
169 IN CONST EFI_GUID
*ModuleName
,
170 IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule
,
171 IN UINT64 ModuleLength
,
172 IN EFI_PHYSICAL_ADDRESS EntryPoint
176 Builds a HOB that describes a chunk of system memory.
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().
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.
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
199 Builds a GUID HOB with a certain data length.
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().
210 @param Guid The GUID to tag the customized HOB.
211 @param DataLength The size of the data payload for the GUID HOB.
213 @retval NULL The GUID HOB could not be allocated.
214 @retval others The start address of GUID HOB data.
220 IN CONST EFI_GUID
*Guid
,
225 Copies a data buffer to a newly-built HOB.
227 This function builds a customized HOB tagged with a GUID for identification,
228 copies the input data to the HOB data field and returns the start address of the GUID HOB data.
229 The HOB Header and Name field is already stripped.
230 It can only be invoked during PEI phase;
231 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
232 If Guid is NULL, then ASSERT().
233 If Data is NULL and DataLength > 0, then ASSERT().
234 If there is no additional space for HOB creation, then ASSERT().
235 If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
237 @param Guid The GUID to tag the customized HOB.
238 @param Data The data to be copied into the data field of the GUID HOB.
239 @param DataLength The size of the data payload for the GUID HOB.
241 @retval NULL The GUID HOB could not be allocated.
242 @retval others The start address of GUID HOB data.
248 IN CONST EFI_GUID
*Guid
,
254 Builds a Firmware Volume HOB.
256 This function builds a Firmware Volume HOB.
257 It can only be invoked during PEI phase;
258 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
259 If there is no additional space for HOB creation, then ASSERT().
261 @param BaseAddress The base address of the Firmware Volume.
262 @param Length The size of the Firmware Volume in bytes.
268 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
273 Builds a Capsule Volume HOB.
275 This function builds a Capsule Volume HOB.
276 It can only be invoked during PEI phase;
277 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
278 If there is no additional space for HOB creation, then ASSERT().
280 @param BaseAddress The base address of the Capsule Volume.
281 @param Length The size of the Capsule Volume in bytes.
287 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
292 Builds a HOB for the CPU.
294 This function builds a HOB for the CPU.
295 It can only be invoked during PEI phase;
296 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
297 If there is no additional space for HOB creation, then ASSERT().
299 @param SizeOfMemorySpace The maximum physical memory addressability of the processor.
300 @param SizeOfIoSpace The maximum physical I/O addressability of the processor.
306 IN UINT8 SizeOfMemorySpace
,
307 IN UINT8 SizeOfIoSpace
311 Builds a HOB for the Stack.
313 This function builds a HOB for the stack.
314 It can only be invoked during PEI phase;
315 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
316 If there is no additional space for HOB creation, then ASSERT().
318 @param BaseAddress The 64 bit physical address of the Stack.
319 @param Length The length of the stack in bytes.
325 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
330 Builds a HOB for the BSP store.
332 This function builds a HOB for BSP store.
333 It can only be invoked during PEI phase;
334 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
335 If there is no additional space for HOB creation, then ASSERT().
337 @param BaseAddress The 64 bit physical address of the BSP.
338 @param Length The length of the BSP store in bytes.
339 @param MemoryType Type of memory allocated by this HOB.
345 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
347 IN EFI_MEMORY_TYPE MemoryType
351 Builds a HOB for the memory allocation.
353 This function builds a HOB for the memory allocation.
354 It can only be invoked during PEI phase;
355 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
356 If there is no additional space for HOB creation, then ASSERT().
358 @param BaseAddress The 64 bit physical address of the memory.
359 @param Length The length of the memory allocation in bytes.
360 @param MemoryType Type of memory allocated by this HOB.
365 GlueBuildMemoryAllocationHob (
366 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
368 IN EFI_MEMORY_TYPE MemoryType