]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Library/HobLib.h
MdePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdePkg / Include / Library / HobLib.h
CommitLineData
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
5450086c 9 independent and can be relocated easily to different memory locations.\r
f9eb929d 10\r
9095d37b 11Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9344f092 12SPDX-License-Identifier: BSD-2-Clause-Patent\r
fb3df220 13\r
fb3df220 14**/\r
15\r
16#ifndef __HOB_LIB_H__\r
17#define __HOB_LIB_H__\r
18\r
19/**\r
20 Returns the pointer to the HOB list.\r
21\r
22 This function returns the pointer to first HOB in the list.\r
fbb393ab 23 For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer\r
f9eb929d 24 to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through\r
25 the EFI System Table by looking up theHOB list GUID in the System Configuration Table.\r
fbb393ab
LL
26 Since the System Configuration Table does not exist that the time the DXE Core is\r
27 launched, the DXE Core uses a global variable from the DXE Core Entry Point Library\r
f9eb929d 28 to manage the pointer to the HOB list.\r
fbb393ab 29\r
f9eb929d 30 If the pointer to the HOB list is NULL, then ASSERT().\r
fbb393ab 31\r
fb3df220 32 @return The pointer to the HOB list.\r
33\r
34**/\r
35VOID *\r
36EFIAPI\r
37GetHobList (\r
38 VOID\r
ed66e1bc 39 );\r
fb3df220 40\r
41/**\r
42 Returns the next instance of a HOB type from the starting HOB.\r
43\r
fbb393ab 44 This function searches the first instance of a HOB type from the starting HOB pointer.\r
fb3df220 45 If there does not exist such HOB type from the starting HOB pointer, it will return NULL.\r
46 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
47 unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
48 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
fbb393ab 49\r
fb3df220 50 If HobStart is NULL, then ASSERT().\r
51\r
52 @param Type The HOB type to return.\r
53 @param HobStart The starting HOB pointer to search from.\r
54\r
55 @return The next instance of a HOB type from the starting HOB.\r
56\r
57**/\r
58VOID *\r
59EFIAPI\r
60GetNextHob (\r
61 IN UINT16 Type,\r
62 IN CONST VOID *HobStart\r
ed66e1bc 63 );\r
fb3df220 64\r
65/**\r
66 Returns the first instance of a HOB type among the whole HOB list.\r
67\r
fbb393ab
LL
68 This function searches the first instance of a HOB type among the whole HOB list.\r
69 If there does not exist such HOB type in the HOB list, it will return NULL.\r
70\r
f9eb929d 71 If the pointer to the HOB list is NULL, then ASSERT().\r
fb3df220 72\r
73 @param Type The HOB type to return.\r
74\r
75 @return The next instance of a HOB type from the starting HOB.\r
76\r
77**/\r
78VOID *\r
79EFIAPI\r
80GetFirstHob (\r
81 IN UINT16 Type\r
ed66e1bc 82 );\r
fb3df220 83\r
84/**\r
f9eb929d 85 Returns the next instance of the matched GUID HOB from the starting HOB.\r
fbb393ab
LL
86\r
87 This function searches the first instance of a HOB from the starting HOB pointer.\r
88 Such HOB should satisfy two conditions:\r
89 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
90 If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
fb3df220 91 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
92 to extract the data section and its size info respectively.\r
93 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer\r
94 unconditionally: it returns HobStart back if HobStart itself meets the requirement;\r
95 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.\r
fbb393ab 96\r
fb3df220 97 If Guid is NULL, then ASSERT().\r
98 If HobStart is NULL, then ASSERT().\r
99\r
100 @param Guid The GUID to match with in the HOB list.\r
101 @param HobStart A pointer to a Guid.\r
102\r
103 @return The next instance of the matched GUID HOB from the starting HOB.\r
104\r
105**/\r
106VOID *\r
107EFIAPI\r
108GetNextGuidHob (\r
109 IN CONST EFI_GUID *Guid,\r
110 IN CONST VOID *HobStart\r
ed66e1bc 111 );\r
fb3df220 112\r
113/**\r
f9eb929d 114 Returns the first instance of the matched GUID HOB among the whole HOB list.\r
fbb393ab
LL
115\r
116 This function searches the first instance of a HOB among the whole HOB list.\r
fb3df220 117 Such HOB should satisfy two conditions:\r
118 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.\r
119 If there does not exist such HOB from the starting HOB pointer, it will return NULL.\r
120 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()\r
121 to extract the data section and its size info respectively.\r
fbb393ab 122\r
f9eb929d 123 If the pointer to the HOB list is NULL, then ASSERT().\r
fb3df220 124 If Guid is NULL, then ASSERT().\r
125\r
126 @param Guid The GUID to match with in the HOB list.\r
127\r
128 @return The first instance of the matched GUID HOB among the whole HOB list.\r
129\r
130**/\r
131VOID *\r
132EFIAPI\r
133GetFirstGuidHob (\r
134 IN CONST EFI_GUID *Guid\r
ed66e1bc 135 );\r
fb3df220 136\r
137/**\r
f9eb929d 138 Get the system boot mode from the HOB list.\r
fb3df220 139\r
fbb393ab 140 This function returns the system boot mode information from the\r
fb3df220 141 PHIT HOB in HOB list.\r
142\r
f9eb929d 143 If the pointer to the HOB list is NULL, then ASSERT().\r
fbb393ab 144\r
fb3df220 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
ed66e1bc 154 );\r
fb3df220 155\r
156/**\r
157 Builds a HOB for a loaded PE32 module.\r
158\r
159 This function builds a HOB for a loaded PE32 module.\r
160 It can only be invoked during PEI phase;\r
161 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 162\r
fb3df220 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
174BuildModuleHob (\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
ed66e1bc 179 );\r
fb3df220 180\r
e4b0415d 181/**\r
f1e2b728 182 Builds a HOB that describes a chunk of system memory with Owner GUID.\r
e4b0415d
HT
183\r
184 This function builds a HOB that describes a chunk of system memory.\r
185 It can only be invoked during PEI phase;\r
186 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
9095d37b 187\r
e4b0415d
HT
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
f1e2b728 194 @param OwnerGUID GUID for the owner of this resource.\r
e4b0415d
HT
195\r
196**/\r
197VOID\r
198EFIAPI\r
199BuildResourceDescriptorWithOwnerHob (\r
200 IN EFI_RESOURCE_TYPE ResourceType,\r
201 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r
202 IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r
203 IN UINT64 NumberOfBytes,\r
204 IN EFI_GUID *OwnerGUID\r
f1e2b728
SZ
205 );\r
206\r
fb3df220 207/**\r
208 Builds a HOB that describes a chunk of system memory.\r
209\r
210 This function builds a HOB that describes a chunk of system memory.\r
211 It can only be invoked during PEI phase;\r
212 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 213\r
fb3df220 214 If there is no additional space for HOB creation, then ASSERT().\r
215\r
216 @param ResourceType The type of resource described by this HOB.\r
217 @param ResourceAttribute The resource attributes of the memory described by this HOB.\r
218 @param PhysicalStart The 64 bit physical address of memory described by this HOB.\r
219 @param NumberOfBytes The length of the memory described by this HOB in bytes.\r
220\r
221**/\r
222VOID\r
223EFIAPI\r
224BuildResourceDescriptorHob (\r
225 IN EFI_RESOURCE_TYPE ResourceType,\r
226 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,\r
227 IN EFI_PHYSICAL_ADDRESS PhysicalStart,\r
228 IN UINT64 NumberOfBytes\r
ed66e1bc 229 );\r
fb3df220 230\r
231/**\r
fbb393ab 232 Builds a customized HOB tagged with a GUID for identification and returns\r
f9eb929d 233 the start address of GUID HOB data.\r
fb3df220 234\r
fbb393ab
LL
235 This function builds a customized HOB tagged with a GUID for identification\r
236 and returns the start address of GUID HOB data so that caller can fill the customized data.\r
fb3df220 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
fbb393ab 240\r
fb3df220 241 If Guid is NULL, then ASSERT().\r
242 If there is no additional space for HOB creation, then ASSERT().\r
192764db
LG
243 If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
244 HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
fb3df220 245\r
246 @param Guid The GUID to tag the customized HOB.\r
247 @param DataLength The size of the data payload for the GUID HOB.\r
248\r
ef2635c3
RN
249 @retval NULL The GUID HOB could not be allocated.\r
250 @retval others The start address of GUID HOB data.\r
fb3df220 251\r
252**/\r
253VOID *\r
254EFIAPI\r
255BuildGuidHob (\r
256 IN CONST EFI_GUID *Guid,\r
257 IN UINTN DataLength\r
ed66e1bc 258 );\r
fb3df220 259\r
260/**\r
fbb393ab 261 Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB\r
f9eb929d 262 data field, and returns the start address of the GUID HOB data.\r
fb3df220 263\r
f9eb929d 264 This function builds a customized HOB tagged with a GUID for identification and copies the input\r
fbb393ab
LL
265 data to the HOB data field and returns the start address of the GUID HOB data. It can only be\r
266 invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fb3df220 267 The HOB Header and Name field is already stripped.\r
268 It can only be invoked during PEI phase;\r
269 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 270\r
fb3df220 271 If Guid is NULL, then ASSERT().\r
272 If Data is NULL and DataLength > 0, then ASSERT().\r
273 If there is no additional space for HOB creation, then ASSERT().\r
192764db
LG
274 If DataLength > (0xFFF8 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().\r
275 HobLength is UINT16 and multiples of 8 bytes, so the max HobLength is 0xFFF8.\r
fb3df220 276\r
277 @param Guid The GUID to tag the customized HOB.\r
278 @param Data The data to be copied into the data field of the GUID HOB.\r
279 @param DataLength The size of the data payload for the GUID HOB.\r
280\r
ef2635c3
RN
281 @retval NULL The GUID HOB could not be allocated.\r
282 @retval others The start address of GUID HOB data.\r
fb3df220 283\r
284**/\r
285VOID *\r
286EFIAPI\r
287BuildGuidDataHob (\r
288 IN CONST EFI_GUID *Guid,\r
289 IN VOID *Data,\r
290 IN UINTN DataLength\r
ed66e1bc 291 );\r
fb3df220 292\r
293/**\r
294 Builds a Firmware Volume HOB.\r
295\r
296 This function builds a Firmware Volume HOB.\r
297 It can only be invoked during PEI phase;\r
298 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 299\r
fb3df220 300 If there is no additional space for HOB creation, then ASSERT().\r
471d6210 301 If the FvImage buffer is not at its required alignment, then ASSERT().\r
fb3df220 302\r
303 @param BaseAddress The base address of the Firmware Volume.\r
304 @param Length The size of the Firmware Volume in bytes.\r
305\r
306**/\r
307VOID\r
308EFIAPI\r
309BuildFvHob (\r
310 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
311 IN UINT64 Length\r
ed66e1bc 312 );\r
fb3df220 313\r
b0d803fe 314/**\r
315 Builds a EFI_HOB_TYPE_FV2 HOB.\r
316\r
317 This function builds a EFI_HOB_TYPE_FV2 HOB.\r
318 It can only be invoked during PEI phase;\r
319 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 320\r
b0d803fe 321 If there is no additional space for HOB creation, then ASSERT().\r
471d6210 322 If the FvImage buffer is not at its required alignment, then ASSERT().\r
b0d803fe 323\r
324 @param BaseAddress The base address of the Firmware Volume.\r
325 @param Length The size of the Firmware Volume in bytes.\r
f9eb929d 326 @param FvName The name of the Firmware Volume.\r
b0d803fe 327 @param FileName The name of the file.\r
fbb393ab 328\r
b0d803fe 329**/\r
330VOID\r
331EFIAPI\r
332BuildFv2Hob (\r
333 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
334 IN UINT64 Length,\r
335 IN CONST EFI_GUID *FvName,\r
336 IN CONST EFI_GUID *FileName\r
ed66e1bc 337 );\r
b0d803fe 338\r
5450086c
SZ
339/**\r
340 Builds a EFI_HOB_TYPE_FV3 HOB.\r
341\r
342 This function builds a EFI_HOB_TYPE_FV3 HOB.\r
343 It can only be invoked during PEI phase;\r
344 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
345\r
346 If there is no additional space for HOB creation, then ASSERT().\r
347 If the FvImage buffer is not at its required alignment, then ASSERT().\r
348\r
349 @param BaseAddress The base address of the Firmware Volume.\r
350 @param Length The size of the Firmware Volume in bytes.\r
351 @param AuthenticationStatus The authentication status.\r
352 @param ExtractedFv TRUE if the FV was extracted as a file within\r
353 another firmware volume. FALSE otherwise.\r
354 @param FvName The name of the Firmware Volume.\r
355 Valid only if IsExtractedFv is TRUE.\r
356 @param FileName The name of the file.\r
357 Valid only if IsExtractedFv is TRUE.\r
358\r
359**/\r
360VOID\r
361EFIAPI\r
362BuildFv3Hob (\r
363 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
364 IN UINT64 Length,\r
365 IN UINT32 AuthenticationStatus,\r
366 IN BOOLEAN ExtractedFv,\r
367 IN CONST EFI_GUID *FvName, OPTIONAL\r
368 IN CONST EFI_GUID *FileName OPTIONAL\r
369 );\r
370\r
fb3df220 371/**\r
372 Builds a Capsule Volume HOB.\r
373\r
374 This function builds a Capsule Volume HOB.\r
375 It can only be invoked during PEI phase;\r
376 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 377\r
c85cea80 378 If the platform does not support Capsule Volume HOBs, then ASSERT().\r
fb3df220 379 If there is no additional space for HOB creation, then ASSERT().\r
380\r
381 @param BaseAddress The base address of the Capsule Volume.\r
382 @param Length The size of the Capsule Volume in bytes.\r
383\r
384**/\r
385VOID\r
386EFIAPI\r
387BuildCvHob (\r
388 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
389 IN UINT64 Length\r
ed66e1bc 390 );\r
fb3df220 391\r
392/**\r
393 Builds a HOB for the CPU.\r
394\r
395 This function builds a HOB for the CPU.\r
396 It can only be invoked during PEI phase;\r
397 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 398\r
fb3df220 399 If there is no additional space for HOB creation, then ASSERT().\r
400\r
401 @param SizeOfMemorySpace The maximum physical memory addressability of the processor.\r
402 @param SizeOfIoSpace The maximum physical I/O addressability of the processor.\r
403\r
404**/\r
405VOID\r
406EFIAPI\r
407BuildCpuHob (\r
408 IN UINT8 SizeOfMemorySpace,\r
409 IN UINT8 SizeOfIoSpace\r
ed66e1bc 410 );\r
fb3df220 411\r
412/**\r
413 Builds a HOB for the Stack.\r
414\r
415 This function builds a HOB for the stack.\r
416 It can only be invoked during PEI phase;\r
417 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 418\r
fb3df220 419 If there is no additional space for HOB creation, then ASSERT().\r
420\r
421 @param BaseAddress The 64 bit physical address of the Stack.\r
422 @param Length The length of the stack in bytes.\r
423\r
424**/\r
425VOID\r
426EFIAPI\r
427BuildStackHob (\r
428 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
429 IN UINT64 Length\r
ed66e1bc 430 );\r
fb3df220 431\r
432/**\r
433 Builds a HOB for the BSP store.\r
434\r
435 This function builds a HOB for BSP store.\r
436 It can only be invoked during PEI phase;\r
437 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 438\r
fb3df220 439 If there is no additional space for HOB creation, then ASSERT().\r
440\r
441 @param BaseAddress The 64 bit physical address of the BSP.\r
442 @param Length The length of the BSP store in bytes.\r
443 @param MemoryType Type of memory allocated by this HOB.\r
444\r
445**/\r
446VOID\r
447EFIAPI\r
448BuildBspStoreHob (\r
449 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
450 IN UINT64 Length,\r
451 IN EFI_MEMORY_TYPE MemoryType\r
ed66e1bc 452 );\r
fb3df220 453\r
454/**\r
455 Builds a HOB for the memory allocation.\r
456\r
457 This function builds a HOB for the memory allocation.\r
458 It can only be invoked during PEI phase;\r
459 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.\r
fbb393ab 460\r
fb3df220 461 If there is no additional space for HOB creation, then ASSERT().\r
462\r
463 @param BaseAddress The 64 bit physical address of the memory.\r
464 @param Length The length of the memory allocation in bytes.\r
465 @param MemoryType Type of memory allocated by this HOB.\r
466\r
467**/\r
468VOID\r
469EFIAPI\r
470BuildMemoryAllocationHob (\r
471 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
472 IN UINT64 Length,\r
473 IN EFI_MEMORY_TYPE MemoryType\r
ed66e1bc 474 );\r
fb3df220 475\r
f9eb929d 476/**\r
477 Returns the type of a HOB.\r
478\r
fbb393ab 479 This macro returns the HobType field from the HOB header for the\r
f754f721 480 HOB specified by HobStart.\r
f9eb929d 481\r
f754f721 482 @param HobStart A pointer to a HOB.\r
fbb393ab 483\r
2281e7a9 484 @return HobType.\r
fbb393ab 485\r
f9eb929d 486**/\r
cc4aa464 487#define GET_HOB_TYPE(HobStart) \\r
488 ((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobType)\r
55f298c3 489\r
f9eb929d 490/**\r
491 Returns the length, in bytes, of a HOB.\r
492\r
fbb393ab 493 This macro returns the HobLength field from the HOB header for the\r
f754f721 494 HOB specified by HobStart.\r
f9eb929d 495\r
f754f721 496 @param HobStart A pointer to a HOB.\r
f9eb929d 497\r
2281e7a9 498 @return HobLength.\r
f9eb929d 499\r
500**/\r
cc4aa464 501#define GET_HOB_LENGTH(HobStart) \\r
502 ((*(EFI_HOB_GENERIC_HEADER **)&(HobStart))->HobLength)\r
55f298c3 503\r
f9eb929d 504/**\r
505 Returns a pointer to the next HOB in the HOB list.\r
506\r
fbb393ab 507 This macro returns a pointer to HOB that follows the\r
f754f721 508 HOB specified by HobStart in the HOB List.\r
f9eb929d 509\r
f754f721 510 @param HobStart A pointer to a HOB.\r
f9eb929d 511\r
512 @return A pointer to the next HOB in the HOB list.\r
513\r
514**/\r
cc4aa464 515#define GET_NEXT_HOB(HobStart) \\r
516 (VOID *)(*(UINT8 **)&(HobStart) + GET_HOB_LENGTH (HobStart))\r
55f298c3 517\r
f9eb929d 518/**\r
519 Determines if a HOB is the last HOB in the HOB list.\r
fbb393ab
LL
520\r
521 This macro determine if the HOB specified by HobStart is the\r
522 last HOB in the HOB list. If HobStart is last HOB in the HOB list,\r
f9eb929d 523 then TRUE is returned. Otherwise, FALSE is returned.\r
524\r
f754f721 525 @param HobStart A pointer to a HOB.\r
f9eb929d 526\r
f754f721 527 @retval TRUE The HOB specified by HobStart is the last HOB in the HOB list.\r
528 @retval FALSE The HOB specified by HobStart is not the last HOB in the HOB list.\r
f9eb929d 529\r
530**/\r
f754f721 531#define END_OF_HOB_LIST(HobStart) (GET_HOB_TYPE (HobStart) == (UINT16)EFI_HOB_TYPE_END_OF_HOB_LIST)\r
146332ae 532\r
f9eb929d 533/**\r
534 Returns a pointer to data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r
535\r
f754f721 536 This macro returns a pointer to the data buffer in a HOB specified by HobStart.\r
fbb393ab 537 HobStart is assumed to be a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r
f9eb929d 538\r
7ca066f9 539 @param GuidHob A pointer to a HOB.\r
f9eb929d 540\r
2281e7a9 541 @return A pointer to the data buffer in a HOB.\r
fbb393ab 542\r
f9eb929d 543**/\r
cc4aa464 544#define GET_GUID_HOB_DATA(HobStart) \\r
545 (VOID *)(*(UINT8 **)&(HobStart) + sizeof (EFI_HOB_GUID_TYPE))\r
55f298c3 546\r
f9eb929d 547/**\r
548 Returns the size of the data buffer from a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r
549\r
f754f721 550 This macro returns the size, in bytes, of the data buffer in a HOB specified by HobStart.\r
551 HobStart is assumed to be a HOB of type EFI_HOB_TYPE_GUID_EXTENSION.\r
f9eb929d 552\r
7ca066f9 553 @param GuidHob A pointer to a HOB.\r
f9eb929d 554\r
2281e7a9 555 @return The size of the data buffer.\r
f9eb929d 556**/\r
cc4aa464 557#define GET_GUID_HOB_DATA_SIZE(HobStart) \\r
558 (UINT16)(GET_HOB_LENGTH (HobStart) - sizeof (EFI_HOB_GUID_TYPE))\r
146332ae 559\r
fb3df220 560#endif\r