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