]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides services to create and parse HOBs. Only available for PEI\r |
3 | and DXE module types.\r | |
fb3df220 | 4 | \r |
f9eb929d | 5 | The HOB Library supports the efficient creation and searching of HOBs\r |
fbb393ab LL |
6 | defined in the PI Specification.\r |
7 | A HOB is a Hand-Off Block, defined in the Framework architecture, that\r | |
8 | allows the PEI phase to pass information to the DXE phase. HOBs are position\r | |
f9eb929d | 9 | independent and can be relocated easily to different memory memory locations.\r |
10 | \r | |
471d6210 | 11 | Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 | 12 | This program and the accompanying materials\r |
50a64e5b | 13 | are licensed and made available under the terms and conditions of the BSD License\r |
14 | which accompanies this distribution. The full text of the license may be found at\r | |
15 | http://opensource.org/licenses/bsd-license.php\r | |
fb3df220 | 16 | \r |
50a64e5b | 17 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
18 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 19 | \r |
fb3df220 | 20 | **/\r |
21 | \r | |
22 | #ifndef __HOB_LIB_H__\r | |
23 | #define __HOB_LIB_H__\r | |
24 | \r | |
25 | /**\r | |
26 | Returns the pointer to the HOB list.\r | |
27 | \r | |
28 | This function returns the pointer to first HOB in the list.\r | |
fbb393ab | 29 | For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer\r |
f9eb929d | 30 | to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through\r |
31 | the EFI System Table by looking up theHOB list GUID in the System Configuration Table.\r | |
fbb393ab LL |
32 | Since the System Configuration Table does not exist that the time the DXE Core is\r |
33 | launched, the DXE Core uses a global variable from the DXE Core Entry Point Library\r | |
f9eb929d | 34 | to manage the pointer to the HOB list.\r |
fbb393ab | 35 | \r |
f9eb929d | 36 | If the pointer to the HOB list is NULL, then ASSERT().\r |
fbb393ab | 37 | \r |
fb3df220 | 38 | @return The pointer to the HOB list.\r |
39 | \r | |
40 | **/\r | |
41 | VOID *\r | |
42 | EFIAPI\r | |
43 | GetHobList (\r | |
44 | VOID\r | |
ed66e1bc | 45 | );\r |
fb3df220 | 46 | \r |
47 | /**\r | |
48 | Returns the next instance of a HOB type from the starting HOB.\r | |
49 | \r | |
fbb393ab | 50 | This function searches the first instance of a HOB type from the starting HOB pointer.\r |
fb3df220 | 51 | If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r |
52 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
53 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
54 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
fbb393ab | 55 | \r |
fb3df220 | 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 | |
ed66e1bc | 69 | );\r |
fb3df220 | 70 | \r |
71 | /**\r | |
72 | Returns the first instance of a HOB type among the whole HOB list.\r | |
73 | \r | |
fbb393ab LL |
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 | |
f9eb929d | 77 | If the pointer to the HOB list is NULL, then ASSERT().\r |
fb3df220 | 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 | |
84 | VOID *\r | |
85 | EFIAPI\r | |
86 | GetFirstHob (\r | |
87 | IN UINT16 Type\r | |
ed66e1bc | 88 | );\r |
fb3df220 | 89 | \r |
90 | /**\r | |
f9eb929d | 91 | Returns the next instance of the matched GUID HOB from the starting HOB.\r |
fbb393ab LL |
92 | \r |
93 | This function searches the first instance of a HOB from the starting HOB pointer.\r | |
94 | Such HOB should satisfy two conditions:\r | |
95 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r | |
96 | If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r | |
fb3df220 | 97 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r |
98 | to extract the data section and its size info respectively.\r | |
99 | In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r | |
100 | unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r | |
101 | caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r | |
fbb393ab | 102 | \r |
fb3df220 | 103 | If Guid is NULL, then ASSERT().\r |
104 | If HobStart is NULL, then ASSERT().\r | |
105 | \r | |
106 | @param Guid The GUID to match with in the HOB list.\r | |
107 | @param HobStart A pointer to a Guid.\r | |
108 | \r | |
109 | @return The next instance of the matched GUID HOB from the starting HOB.\r | |
110 | \r | |
111 | **/\r | |
112 | VOID *\r | |
113 | EFIAPI\r | |
114 | GetNextGuidHob (\r | |
115 | IN CONST EFI_GUID *Guid,\r | |
116 | IN CONST VOID *HobStart\r | |
ed66e1bc | 117 | );\r |
fb3df220 | 118 | \r |
119 | /**\r | |
f9eb929d | 120 | Returns the first instance of the matched GUID HOB among the whole HOB list.\r |
fbb393ab LL |
121 | \r |
122 | This function searches the first instance of a HOB among the whole HOB list.\r | |
fb3df220 | 123 | Such HOB should satisfy two conditions:\r |
124 | its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r | |
125 | If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r | |
126 | Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r | |
127 | to extract the data section and its size info respectively.\r | |
fbb393ab | 128 | \r |
f9eb929d | 129 | If the pointer to the HOB list is NULL, then ASSERT().\r |
fb3df220 | 130 | If Guid is NULL, then ASSERT().\r |
131 | \r | |
132 | @param Guid The GUID to match with in the HOB list.\r | |
133 | \r | |
134 | @return The first instance of the matched GUID HOB among the whole HOB list.\r | |
135 | \r | |
136 | **/\r | |
137 | VOID *\r | |
138 | EFIAPI\r | |
139 | GetFirstGuidHob (\r | |
140 | IN CONST EFI_GUID *Guid\r | |
ed66e1bc | 141 | );\r |
fb3df220 | 142 | \r |
143 | /**\r | |
f9eb929d | 144 | Get the system boot mode from the HOB list.\r |
fb3df220 | 145 | \r |
fbb393ab | 146 | This function returns the system boot mode information from the\r |
fb3df220 | 147 | PHIT HOB in HOB list.\r |
148 | \r | |
f9eb929d | 149 | If the pointer to the HOB list is NULL, then ASSERT().\r |
fbb393ab | 150 | \r |
fb3df220 | 151 | @param VOID\r |
152 | \r | |
153 | @return The Boot Mode.\r | |
154 | \r | |
155 | **/\r | |
156 | EFI_BOOT_MODE\r | |
157 | EFIAPI\r | |
158 | GetBootModeHob (\r | |
159 | VOID\r | |
ed66e1bc | 160 | );\r |
fb3df220 | 161 | \r |
162 | /**\r | |
163 | Builds a HOB for a loaded PE32 module.\r | |
164 | \r | |
165 | This function builds a HOB for a loaded PE32 module.\r | |
166 | It can only be invoked during PEI phase;\r | |
167 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 168 | \r |
fb3df220 | 169 | If ModuleName is NULL, then ASSERT().\r |
170 | If there is no additional space for HOB creation, then ASSERT().\r | |
171 | \r | |
172 | @param ModuleName The GUID File Name of the module.\r | |
173 | @param MemoryAllocationModule The 64 bit physical address of the module.\r | |
174 | @param ModuleLength The length of the module in bytes.\r | |
175 | @param EntryPoint The 64 bit physical address of the module entry point.\r | |
176 | \r | |
177 | **/\r | |
178 | VOID\r | |
179 | EFIAPI\r | |
180 | BuildModuleHob (\r | |
181 | IN CONST EFI_GUID *ModuleName,\r | |
182 | IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,\r | |
183 | IN UINT64 ModuleLength,\r | |
184 | IN EFI_PHYSICAL_ADDRESS EntryPoint\r | |
ed66e1bc | 185 | );\r |
fb3df220 | 186 | \r |
e4b0415d | 187 | /**\r |
f1e2b728 | 188 | Builds a HOB that describes a chunk of system memory with Owner GUID.\r |
e4b0415d HT |
189 | \r |
190 | This function builds a HOB that describes a chunk of system memory.\r | |
191 | It can only be invoked during PEI phase;\r | |
192 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
193 | \r | |
194 | If there is no additional space for HOB creation, then ASSERT().\r | |
195 | \r | |
196 | @param ResourceType The type of resource described by this HOB.\r | |
197 | @param ResourceAttribute The resource attributes of the memory described by this HOB.\r | |
198 | @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r | |
199 | @param NumberOfBytes The length of the memory described by this HOB in bytes.\r | |
f1e2b728 | 200 | @param OwnerGUID GUID for the owner of this resource.\r |
e4b0415d HT |
201 | \r |
202 | **/\r | |
203 | VOID\r | |
204 | EFIAPI\r | |
205 | BuildResourceDescriptorWithOwnerHob (\r | |
206 | IN EFI_RESOURCE_TYPE ResourceType,\r | |
207 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r | |
208 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r | |
209 | IN UINT64 NumberOfBytes,\r | |
210 | IN EFI_GUID *OwnerGUID\r | |
f1e2b728 SZ |
211 | );\r |
212 | \r | |
fb3df220 | 213 | /**\r |
214 | Builds a HOB that describes a chunk of system memory.\r | |
215 | \r | |
216 | This function builds a HOB that describes a chunk of system memory.\r | |
217 | It can only be invoked during PEI phase;\r | |
218 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 219 | \r |
fb3df220 | 220 | If there is no additional space for HOB creation, then ASSERT().\r |
221 | \r | |
222 | @param ResourceType The type of resource described by this HOB.\r | |
223 | @param ResourceAttribute The resource attributes of the memory described by this HOB.\r | |
224 | @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r | |
225 | @param NumberOfBytes The length of the memory described by this HOB in bytes.\r | |
226 | \r | |
227 | **/\r | |
228 | VOID\r | |
229 | EFIAPI\r | |
230 | BuildResourceDescriptorHob (\r | |
231 | IN EFI_RESOURCE_TYPE ResourceType,\r | |
232 | IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r | |
233 | IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r | |
234 | IN UINT64 NumberOfBytes\r | |
ed66e1bc | 235 | );\r |
fb3df220 | 236 | \r |
237 | /**\r | |
fbb393ab | 238 | Builds a customized HOB tagged with a GUID for identification and returns\r |
f9eb929d | 239 | the start address of GUID HOB data.\r |
fb3df220 | 240 | \r |
fbb393ab LL |
241 | This function builds a customized HOB tagged with a GUID for identification\r |
242 | and returns the start address of GUID HOB data so that caller can fill the customized data.\r | |
fb3df220 | 243 | The HOB Header and Name field is already stripped.\r |
244 | It can only be invoked during PEI phase;\r | |
245 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 246 | \r |
fb3df220 | 247 | If Guid is NULL, then ASSERT().\r |
248 | If there is no additional space for HOB creation, then ASSERT().\r | |
192764db LG |
249 | If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r |
250 | HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r | |
fb3df220 | 251 | \r |
252 | @param Guid The GUID to tag the customized HOB.\r | |
253 | @param DataLength The size of the data payload for the GUID HOB.\r | |
254 | \r | |
ef2635c3 RN |
255 | @retval NULL The GUID HOB could not be allocated.\r |
256 | @retval others The start address of GUID HOB data.\r | |
fb3df220 | 257 | \r |
258 | **/\r | |
259 | VOID *\r | |
260 | EFIAPI\r | |
261 | BuildGuidHob (\r | |
262 | IN CONST EFI_GUID *Guid,\r | |
263 | IN UINTN DataLength\r | |
ed66e1bc | 264 | );\r |
fb3df220 | 265 | \r |
266 | /**\r | |
fbb393ab | 267 | Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB\r |
f9eb929d | 268 | data field, and returns the start address of the GUID HOB data.\r |
fb3df220 | 269 | \r |
f9eb929d | 270 | This function builds a customized HOB tagged with a GUID for identification and copies the input\r |
fbb393ab LL |
271 | data to the HOB data field and returns the start address of the GUID HOB data. It can only be\r |
272 | invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fb3df220 | 273 | The HOB Header and Name field is already stripped.\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 | |
fbb393ab | 276 | \r |
fb3df220 | 277 | If Guid is NULL, then ASSERT().\r |
278 | If Data is NULL and DataLength > 0, then ASSERT().\r | |
279 | If there is no additional space for HOB creation, then ASSERT().\r | |
192764db LG |
280 | If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r |
281 | HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r | |
fb3df220 | 282 | \r |
283 | @param Guid The GUID to tag the customized HOB.\r | |
284 | @param Data The data to be copied into the data field of the GUID HOB.\r | |
285 | @param DataLength The size of the data payload for the GUID HOB.\r | |
286 | \r | |
ef2635c3 RN |
287 | @retval NULL The GUID HOB could not be allocated.\r |
288 | @retval others The start address of GUID HOB data.\r | |
fb3df220 | 289 | \r |
290 | **/\r | |
291 | VOID *\r | |
292 | EFIAPI\r | |
293 | BuildGuidDataHob (\r | |
294 | IN CONST EFI_GUID *Guid,\r | |
295 | IN VOID *Data,\r | |
296 | IN UINTN DataLength\r | |
ed66e1bc | 297 | );\r |
fb3df220 | 298 | \r |
299 | /**\r | |
300 | Builds a Firmware Volume HOB.\r | |
301 | \r | |
302 | This function builds a Firmware Volume HOB.\r | |
303 | It can only be invoked during PEI phase;\r | |
304 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 305 | \r |
fb3df220 | 306 | If there is no additional space for HOB creation, then ASSERT().\r |
471d6210 | 307 | If the FvImage buffer is not at its required alignment, then ASSERT().\r |
fb3df220 | 308 | \r |
309 | @param BaseAddress The base address of the Firmware Volume.\r | |
310 | @param Length The size of the Firmware Volume in bytes.\r | |
311 | \r | |
312 | **/\r | |
313 | VOID\r | |
314 | EFIAPI\r | |
315 | BuildFvHob (\r | |
316 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
317 | IN UINT64 Length\r | |
ed66e1bc | 318 | );\r |
fb3df220 | 319 | \r |
b0d803fe | 320 | /**\r |
321 | Builds a EFI_HOB_TYPE_FV2 HOB.\r | |
322 | \r | |
323 | This function builds a EFI_HOB_TYPE_FV2 HOB.\r | |
324 | It can only be invoked during PEI phase;\r | |
325 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 326 | \r |
b0d803fe | 327 | If there is no additional space for HOB creation, then ASSERT().\r |
471d6210 | 328 | If the FvImage buffer is not at its required alignment, then ASSERT().\r |
b0d803fe | 329 | \r |
330 | @param BaseAddress The base address of the Firmware Volume.\r | |
331 | @param Length The size of the Firmware Volume in bytes.\r | |
f9eb929d | 332 | @param FvName The name of the Firmware Volume.\r |
b0d803fe | 333 | @param FileName The name of the file.\r |
fbb393ab | 334 | \r |
b0d803fe | 335 | **/\r |
336 | VOID\r | |
337 | EFIAPI\r | |
338 | BuildFv2Hob (\r | |
339 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
340 | IN UINT64 Length,\r | |
341 | IN CONST EFI_GUID *FvName,\r | |
342 | IN CONST EFI_GUID *FileName\r | |
ed66e1bc | 343 | );\r |
b0d803fe | 344 | \r |
fb3df220 | 345 | /**\r |
346 | Builds a Capsule Volume HOB.\r | |
347 | \r | |
348 | This function builds a Capsule Volume HOB.\r | |
349 | It can only be invoked during PEI phase;\r | |
350 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 351 | \r |
c85cea80 | 352 | If the platform does not support Capsule Volume HOBs, then ASSERT().\r |
fb3df220 | 353 | If there is no additional space for HOB creation, then ASSERT().\r |
354 | \r | |
355 | @param BaseAddress The base address of the Capsule Volume.\r | |
356 | @param Length The size of the Capsule Volume in bytes.\r | |
357 | \r | |
358 | **/\r | |
359 | VOID\r | |
360 | EFIAPI\r | |
361 | BuildCvHob (\r | |
362 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
363 | IN UINT64 Length\r | |
ed66e1bc | 364 | );\r |
fb3df220 | 365 | \r |
366 | /**\r | |
367 | Builds a HOB for the CPU.\r | |
368 | \r | |
369 | This function builds a HOB for the CPU.\r | |
370 | It can only be invoked during PEI phase;\r | |
371 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 372 | \r |
fb3df220 | 373 | If there is no additional space for HOB creation, then ASSERT().\r |
374 | \r | |
375 | @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r | |
376 | @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r | |
377 | \r | |
378 | **/\r | |
379 | VOID\r | |
380 | EFIAPI\r | |
381 | BuildCpuHob (\r | |
382 | IN UINT8 SizeOfMemorySpace,\r | |
383 | IN UINT8 SizeOfIoSpace\r | |
ed66e1bc | 384 | );\r |
fb3df220 | 385 | \r |
386 | /**\r | |
387 | Builds a HOB for the Stack.\r | |
388 | \r | |
389 | This function builds a HOB for the stack.\r | |
390 | It can only be invoked during PEI phase;\r | |
391 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 392 | \r |
fb3df220 | 393 | If there is no additional space for HOB creation, then ASSERT().\r |
394 | \r | |
395 | @param BaseAddress The 64 bit physical address of the Stack.\r | |
396 | @param Length The length of the stack in bytes.\r | |
397 | \r | |
398 | **/\r | |
399 | VOID\r | |
400 | EFIAPI\r | |
401 | BuildStackHob (\r | |
402 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
403 | IN UINT64 Length\r | |
ed66e1bc | 404 | );\r |
fb3df220 | 405 | \r |
406 | /**\r | |
407 | Builds a HOB for the BSP store.\r | |
408 | \r | |
409 | This function builds a HOB for BSP store.\r | |
410 | It can only be invoked during PEI phase;\r | |
411 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 412 | \r |
fb3df220 | 413 | If there is no additional space for HOB creation, then ASSERT().\r |
414 | \r | |
415 | @param BaseAddress The 64 bit physical address of the BSP.\r | |
416 | @param Length The length of the BSP store in bytes.\r | |
417 | @param MemoryType Type of memory allocated by this HOB.\r | |
418 | \r | |
419 | **/\r | |
420 | VOID\r | |
421 | EFIAPI\r | |
422 | BuildBspStoreHob (\r | |
423 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
424 | IN UINT64 Length,\r | |
425 | IN EFI_MEMORY_TYPE MemoryType\r | |
ed66e1bc | 426 | );\r |
fb3df220 | 427 | \r |
428 | /**\r | |
429 | Builds a HOB for the memory allocation.\r | |
430 | \r | |
431 | This function builds a HOB for the memory allocation.\r | |
432 | It can only be invoked during PEI phase;\r | |
433 | for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r | |
fbb393ab | 434 | \r |
fb3df220 | 435 | If there is no additional space for HOB creation, then ASSERT().\r |
436 | \r | |
437 | @param BaseAddress The 64 bit physical address of the memory.\r | |
438 | @param Length The length of the memory allocation in bytes.\r | |
439 | @param MemoryType Type of memory allocated by this HOB.\r | |
440 | \r | |
441 | **/\r | |
442 | VOID\r | |
443 | EFIAPI\r | |
444 | BuildMemoryAllocationHob (\r | |
445 | IN EFI_PHYSICAL_ADDRESS BaseAddress,\r | |
446 | IN UINT64 Length,\r | |
447 | IN EFI_MEMORY_TYPE MemoryType\r | |
ed66e1bc | 448 | );\r |
fb3df220 | 449 | \r |
f9eb929d | 450 | /**\r |
451 | Returns the type of a HOB.\r | |
452 | \r | |
fbb393ab | 453 | This macro returns the HobType field from the HOB header for the\r |
f754f721 | 454 | HOB specified by HobStart.\r |
f9eb929d | 455 | \r |
f754f721 | 456 | @param HobStart A pointer to a HOB.\r |
fbb393ab | 457 | \r |
2281e7a9 | 458 | @return HobType.\r |
fbb393ab | 459 | \r |
f9eb929d | 460 | **/\r |
cc4aa464 | 461 | #define GET_HOB_TYPE(HobStart) \\r |
462 | ((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType)\r | |
55f298c3 | 463 | \r |
f9eb929d | 464 | /**\r |
465 | Returns the length, in bytes, of a HOB.\r | |
466 | \r | |
fbb393ab | 467 | This macro returns the HobLength field from the HOB header for the\r |
f754f721 | 468 | HOB specified by HobStart.\r |
f9eb929d | 469 | \r |
f754f721 | 470 | @param HobStart A pointer to a HOB.\r |
f9eb929d | 471 | \r |
2281e7a9 | 472 | @return HobLength.\r |
f9eb929d | 473 | \r |
474 | **/\r | |
cc4aa464 | 475 | #define GET_HOB_LENGTH(HobStart) \\r |
476 | ((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength)\r | |
55f298c3 | 477 | \r |
f9eb929d | 478 | /**\r |
479 | Returns a pointer to the next HOB in the HOB list.\r | |
480 | \r | |
fbb393ab | 481 | This macro returns a pointer to HOB that follows the\r |
f754f721 | 482 | HOB specified by HobStart in the HOB List.\r |
f9eb929d | 483 | \r |
f754f721 | 484 | @param HobStart A pointer to a HOB.\r |
f9eb929d | 485 | \r |
486 | @return A pointer to the next HOB in the HOB list.\r | |
487 | \r | |
488 | **/\r | |
cc4aa464 | 489 | #define GET_NEXT_HOB(HobStart) \\r |
490 | (VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart))\r | |
55f298c3 | 491 | \r |
f9eb929d | 492 | /**\r |
493 | Determines if a HOB is the last HOB in the HOB list.\r | |
fbb393ab LL |
494 | \r |
495 | This macro determine if the HOB specified by HobStart is the\r | |
496 | last HOB in the HOB list. If HobStart is last HOB in the HOB list,\r | |
f9eb929d | 497 | then TRUE is returned. Otherwise, FALSE is returned.\r |
498 | \r | |
f754f721 | 499 | @param HobStart A pointer to a HOB.\r |
f9eb929d | 500 | \r |
f754f721 | 501 | @retval TRUE The HOB specified by HobStart is the last HOB in the HOB list.\r |
502 | @retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list.\r | |
f9eb929d | 503 | \r |
504 | **/\r | |
f754f721 | 505 | #define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)\r |
146332ae | 506 | \r |
f9eb929d | 507 | /**\r |
508 | Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r | |
509 | \r | |
f754f721 | 510 | This macro returns a pointer to the data buffer in a HOB specified by HobStart.\r |
fbb393ab | 511 | HobStart is assumed to be a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r |
f9eb929d | 512 | \r |
7ca066f9 | 513 | @param GuidHob A pointer to a HOB.\r |
f9eb929d | 514 | \r |
2281e7a9 | 515 | @return A pointer to the data buffer in a HOB.\r |
fbb393ab | 516 | \r |
f9eb929d | 517 | **/\r |
cc4aa464 | 518 | #define GET_GUID_HOB_DATA(HobStart) \\r |
519 | (VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE))\r | |
55f298c3 | 520 | \r |
f9eb929d | 521 | /**\r |
522 | Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r | |
523 | \r | |
f754f721 | 524 | This macro returns the size, in bytes, of the data buffer in a HOB specified by HobStart.\r |
525 | HobStart is assumed to be a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r | |
f9eb929d | 526 | \r |
7ca066f9 | 527 | @param GuidHob A pointer to a HOB.\r |
f9eb929d | 528 | \r |
2281e7a9 | 529 | @return The size of the data buffer.\r |
f9eb929d | 530 | **/\r |
cc4aa464 | 531 | #define GET_GUID_HOB_DATA_SIZE(HobStart) \\r |
532 | (UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE))\r | |
146332ae | 533 | \r |
fb3df220 | 534 | #endif\r |