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
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.
19 STATIC VOID
*mHobList
= NULL
;
22 The constructor function caches the pointer to HOB list.
24 The constructor function gets the start address of HOB list from system configuration table.
25 It will ASSERT() if that operation fails and it will always return EFI_SUCCESS.
27 @param ImageHandle The firmware allocated handle for the EFI image.
28 @param SystemTable A pointer to the EFI System Table.
30 @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
36 IN EFI_HANDLE ImageHandle
,
37 IN EFI_SYSTEM_TABLE
*SystemTable
42 Status
= EfiGetSystemConfigurationTable (&gEfiHobListGuid
, &mHobList
);
43 ASSERT_EFI_ERROR (Status
);
44 ASSERT (mHobList
!= NULL
);
49 Returns the pointer to the HOB list.
53 The pointer to the HOB list.
66 This function searches the first instance of a HOB type from the starting HOB pointer.
67 If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
69 @param Type The HOB type to return.
70 @param HobStart The starting HOB pointer to search from.
72 @return The next instance of a HOB type from the starting HOB.
79 IN CONST VOID
*HobStart
82 EFI_PEI_HOB_POINTERS Hob
;
84 ASSERT (HobStart
!= NULL
);
86 Hob
.Raw
= (UINT8
*) HobStart
;
88 // Parse the HOB list, stop if end of list or matching type found.
90 while (!END_OF_HOB_LIST (Hob
)) {
91 if (Hob
.Header
->HobType
== Type
) {
94 Hob
.Raw
= GET_NEXT_HOB (Hob
);
100 This function searches the first instance of a HOB type among the whole HOB list.
101 If there does not exist such HOB type in the HOB list, it will return NULL.
103 @param Type The HOB type to return.
105 @return The next instance of a HOB type from the starting HOB.
116 HobList
= GetHobList ();
117 return GetNextHob (Type
, HobList
);
121 This function searches the first instance of a HOB from the starting HOB pointer.
122 Such HOB should satisfy two conditions:
123 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
124 If there does not exist such HOB from the starting HOB pointer, it will return NULL.
126 @param Guid The GUID to match with in the HOB list.
127 @param HobStart A pointer to a Guid.
129 @return The next instance of the matched GUID HOB from the starting HOB.
135 IN CONST EFI_GUID
*Guid
,
136 IN CONST VOID
*HobStart
139 EFI_PEI_HOB_POINTERS GuidHob
;
141 GuidHob
.Raw
= (UINT8
*) HobStart
;
142 while ((GuidHob
.Raw
= GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION
, GuidHob
.Raw
)) != NULL
) {
143 if (CompareGuid (Guid
, &GuidHob
.Guid
->Name
)) {
146 GuidHob
.Raw
= GET_NEXT_HOB (GuidHob
);
152 This function searches the first instance of a HOB among the whole HOB list.
153 Such HOB should satisfy two conditions:
154 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
155 If there does not exist such HOB from the starting HOB pointer, it will return NULL.
157 @param Guid The GUID to match with in the HOB list.
159 @return The first instance of the matched GUID HOB among the whole HOB list.
165 IN CONST EFI_GUID
*Guid
170 HobList
= GetHobList ();
171 return GetNextGuidHob (Guid
, HobList
);
175 This function builds a HOB for a loaded PE32 module.
177 @param ModuleName The GUID File Name of the module.
178 @param MemoryAllocationModule The 64 bit physical address of the module.
179 @param ModuleLength The length of the module in bytes.
180 @param EntryPoint The 64 bit physical address of the module\92s entry point.
186 IN CONST EFI_GUID
*ModuleName
,
187 IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule
,
188 IN UINT64 ModuleLength
,
189 IN EFI_PHYSICAL_ADDRESS EntryPoint
193 // PEI HOB is read only for DXE phase
199 Builds a HOB that describes a chunk of system memory.
201 @param ResourceType The type of resource described by this HOB.
202 @param ResourceAttribute The resource attributes of the memory described by this HOB.
203 @param PhysicalStart The 64 bit physical address of memory described by this HOB.
204 @param NumberOfBytes The length of the memory described by this HOB in bytes.
209 BuildResourceDescriptorHob (
210 IN EFI_RESOURCE_TYPE ResourceType
,
211 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute
,
212 IN EFI_PHYSICAL_ADDRESS PhysicalStart
,
213 IN UINT64 NumberOfBytes
217 // PEI HOB is read only for DXE phase
223 This function builds a customized HOB tagged with a GUID for identification
224 and returns the start address of GUID HOB data so that caller can fill the customized data.
226 @param Guid The GUID to tag the customized HOB.
227 @param DataLength The size of the data payload for the GUID HOB.
229 @return The start address of GUID HOB data.
235 IN CONST EFI_GUID
*Guid
,
240 // PEI HOB is read only for DXE phase
247 This function builds a customized HOB tagged with a GUID for identification,
248 copies the input data to the HOB data field, and returns the start address of GUID HOB data.
250 @param Guid The GUID to tag the customized HOB.
251 @param Data The data to be copied into the data field of the GUID HOB.
252 @param DataLength The size of the data payload for the GUID HOB.
254 @return The start address of GUID HOB data.
260 IN CONST EFI_GUID
*Guid
,
266 // PEI HOB is read only for DXE phase
273 Builds a Firmware Volume HOB.
275 @param BaseAddress The base address of the Firmware Volume.
276 @param Length The size of the Firmware Volume in bytes.
282 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
287 // PEI HOB is read only for DXE phase
293 Builds a Capsule Volume HOB.
295 @param BaseAddress The base address of the Capsule Volume.
296 @param Length The size of the Capsule Volume in bytes.
302 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
307 // PEI HOB is read only for DXE phase
313 Builds a HOB for the CPU.
315 @param SizeOfMemorySpace The maximum physical memory addressability of the processor.
316 @param SizeOfIoSpace The maximum physical I/O addressability of the processor.
322 IN UINT8 SizeOfMemorySpace
,
323 IN UINT8 SizeOfIoSpace
327 // PEI HOB is read only for DXE phase
333 Builds a HOB for the Stack.
335 @param BaseAddress The 64 bit physical address of the Stack.
336 @param Length The length of the stack in bytes.
342 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
347 // PEI HOB is read only for DXE phase
353 Builds a HOB for the BSP store.
355 @param BaseAddress The 64 bit physical address of the BSP.
356 @param Length The length of the BSP store in bytes.
357 @param MemoryType Type of memory allocated by this HOB.
363 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
365 IN EFI_MEMORY_TYPE MemoryType
369 // PEI HOB is read only for DXE phase
375 Builds a HOB for the memory allocation.
377 @param BaseAddress The 64 bit physical address of the memory.
378 @param Length The length of the memory allocation in bytes.
379 @param MemoryType Type of memory allocated by this HOB.
384 BuildMemoryAllocationHob (
385 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
387 IN EFI_MEMORY_TYPE MemoryType
391 // PEI HOB is read only for DXE phase