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