]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Foundation/Library/EdkIIGlueLib/Include/Library/EdkIIGlueHobLib.h
Maintainers.txt: Remove EdkCompatibilityPkg information
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / EdkIIGlueLib / Include / Library / EdkIIGlueHobLib.h
1 /*++
2
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
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 @retval NULL The GUID HOB could not be allocated.
214 @retval others The start address of GUID HOB data.
215
216 **/
217 VOID *
218 EFIAPI
219 BuildGuidHob (
220 IN CONST EFI_GUID *Guid,
221 IN UINTN DataLength
222 );
223
224 /**
225 Copies a data buffer to a newly-built HOB.
226
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().
236
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.
240
241 @retval NULL The GUID HOB could not be allocated.
242 @retval others The start address of GUID HOB data.
243
244 **/
245 VOID *
246 EFIAPI
247 BuildGuidDataHob (
248 IN CONST EFI_GUID *Guid,
249 IN VOID *Data,
250 IN UINTN DataLength
251 );
252
253 /**
254 Builds a Firmware Volume HOB.
255
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().
260
261 @param BaseAddress The base address of the Firmware Volume.
262 @param Length The size of the Firmware Volume in bytes.
263
264 **/
265 VOID
266 EFIAPI
267 BuildFvHob (
268 IN EFI_PHYSICAL_ADDRESS BaseAddress,
269 IN UINT64 Length
270 );
271
272 /**
273 Builds a Capsule Volume HOB.
274
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().
279
280 @param BaseAddress The base address of the Capsule Volume.
281 @param Length The size of the Capsule Volume in bytes.
282
283 **/
284 VOID
285 EFIAPI
286 BuildCvHob (
287 IN EFI_PHYSICAL_ADDRESS BaseAddress,
288 IN UINT64 Length
289 );
290
291 /**
292 Builds a HOB for the CPU.
293
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().
298
299 @param SizeOfMemorySpace The maximum physical memory addressability of the processor.
300 @param SizeOfIoSpace The maximum physical I/O addressability of the processor.
301
302 **/
303 VOID
304 EFIAPI
305 BuildCpuHob (
306 IN UINT8 SizeOfMemorySpace,
307 IN UINT8 SizeOfIoSpace
308 );
309
310 /**
311 Builds a HOB for the Stack.
312
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().
317
318 @param BaseAddress The 64 bit physical address of the Stack.
319 @param Length The length of the stack in bytes.
320
321 **/
322 VOID
323 EFIAPI
324 BuildStackHob (
325 IN EFI_PHYSICAL_ADDRESS BaseAddress,
326 IN UINT64 Length
327 );
328
329 /**
330 Builds a HOB for the BSP store.
331
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().
336
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.
340
341 **/
342 VOID
343 EFIAPI
344 BuildBspStoreHob (
345 IN EFI_PHYSICAL_ADDRESS BaseAddress,
346 IN UINT64 Length,
347 IN EFI_MEMORY_TYPE MemoryType
348 );
349
350 /**
351 Builds a HOB for the memory allocation.
352
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().
357
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.
361
362 **/
363 VOID
364 EFIAPI
365 GlueBuildMemoryAllocationHob (
366 IN EFI_PHYSICAL_ADDRESS BaseAddress,
367 IN UINT64 Length,
368 IN EFI_MEMORY_TYPE MemoryType
369 );
370
371 #endif