VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/Firmware/MdePkg/Library/PeiHobLib/HobLib.c@ 48674

Last change on this file since 48674 was 48674, checked in by vboxsync, 12 years ago

EFI: Export newly imported tinaocore UEFI sources to OSE.

  • Property svn:eol-style set to native
File size: 20.0 KB
Line 
1/** @file
2 Provide Hob Library functions for Pei phase.
3
4Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
5This program and the accompanying materials
6are licensed and made available under the terms and conditions of the BSD License
7which accompanies this distribution. The full text of the license may be found at
8http://opensource.org/licenses/bsd-license.php.
9
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13**/
14
15#include <PiPei.h>
16
17#include <Guid/MemoryAllocationHob.h>
18
19#include <Library/HobLib.h>
20#include <Library/DebugLib.h>
21#include <Library/PeiServicesLib.h>
22#include <Library/BaseMemoryLib.h>
23
24/**
25 Returns the pointer to the HOB list.
26
27 This function returns the pointer to first HOB in the list.
28 For PEI phase, the PEI service GetHobList() can be used to retrieve the pointer
29 to the HOB list. For the DXE phase, the HOB list pointer can be retrieved through
30 the EFI System Table by looking up theHOB list GUID in the System Configuration Table.
31 Since the System Configuration Table does not exist that the time the DXE Core is
32 launched, the DXE Core uses a global variable from the DXE Core Entry Point Library
33 to manage the pointer to the HOB list.
34
35 If the pointer to the HOB list is NULL, then ASSERT().
36
37 @return The pointer to the HOB list.
38
39**/
40VOID *
41EFIAPI
42GetHobList (
43 VOID
44 )
45{
46 EFI_STATUS Status;
47 VOID *HobList;
48
49 Status = PeiServicesGetHobList (&HobList);
50 ASSERT_EFI_ERROR (Status);
51 ASSERT (HobList != NULL);
52
53 return HobList;
54}
55
56/**
57 Returns the next instance of a HOB type from the starting HOB.
58
59 This function searches the first instance of a HOB type from the starting HOB pointer.
60 If there does not exist such HOB type from the starting HOB pointer, it will return NULL.
61 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
62 unconditionally: it returns HobStart back if HobStart itself meets the requirement;
63 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
64
65 If HobStart is NULL, then ASSERT().
66
67 @param Type The HOB type to return.
68 @param HobStart The starting HOB pointer to search from.
69
70 @return The next instance of a HOB type from the starting HOB.
71
72**/
73VOID *
74EFIAPI
75GetNextHob (
76 IN UINT16 Type,
77 IN CONST VOID *HobStart
78 )
79{
80 EFI_PEI_HOB_POINTERS Hob;
81
82 ASSERT (HobStart != NULL);
83
84 Hob.Raw = (UINT8 *) HobStart;
85 //
86 // Parse the HOB list until end of list or matching type is found.
87 //
88 while (!END_OF_HOB_LIST (Hob)) {
89 if (Hob.Header->HobType == Type) {
90 return Hob.Raw;
91 }
92 Hob.Raw = GET_NEXT_HOB (Hob);
93 }
94 return NULL;
95}
96
97/**
98 Returns the first instance of a HOB type among the whole HOB list.
99
100 This function searches the first instance of a HOB type among the whole HOB list.
101 If there does not exist such HOB type in the HOB list, it will return NULL.
102
103 If the pointer to the HOB list is NULL, then ASSERT().
104
105 @param Type The HOB type to return.
106
107 @return The next instance of a HOB type from the starting HOB.
108
109**/
110VOID *
111EFIAPI
112GetFirstHob (
113 IN UINT16 Type
114 )
115{
116 VOID *HobList;
117
118 HobList = GetHobList ();
119 return GetNextHob (Type, HobList);
120}
121
122/**
123 Returns the next instance of the matched GUID HOB from the starting HOB.
124
125 This function searches the first instance of a HOB from the starting HOB pointer.
126 Such HOB should satisfy two conditions:
127 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
128 If there does not exist such HOB from the starting HOB pointer, it will return NULL.
129 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
130 to extract the data section and its size information, respectively.
131 In contrast with macro GET_NEXT_HOB(), this function does not skip the starting HOB pointer
132 unconditionally: it returns HobStart back if HobStart itself meets the requirement;
133 caller is required to use GET_NEXT_HOB() if it wishes to skip current HobStart.
134
135 If Guid is NULL, then ASSERT().
136 If HobStart is NULL, then ASSERT().
137
138 @param Guid The GUID to match with in the HOB list.
139 @param HobStart A pointer to a Guid.
140
141 @return The next instance of the matched GUID HOB from the starting HOB.
142
143**/
144VOID *
145EFIAPI
146GetNextGuidHob (
147 IN CONST EFI_GUID *Guid,
148 IN CONST VOID *HobStart
149 )
150{
151 EFI_PEI_HOB_POINTERS GuidHob;
152
153 GuidHob.Raw = (UINT8 *) HobStart;
154 while ((GuidHob.Raw = GetNextHob (EFI_HOB_TYPE_GUID_EXTENSION, GuidHob.Raw)) != NULL) {
155 if (CompareGuid (Guid, &GuidHob.Guid->Name)) {
156 break;
157 }
158 GuidHob.Raw = GET_NEXT_HOB (GuidHob);
159 }
160 return GuidHob.Raw;
161}
162
163/**
164 Returns the first instance of the matched GUID HOB among the whole HOB list.
165
166 This function searches the first instance of a HOB among the whole HOB list.
167 Such HOB should satisfy two conditions:
168 its HOB type is EFI_HOB_TYPE_GUID_EXTENSION and its GUID Name equals to the input Guid.
169 If there does not exist such HOB from the starting HOB pointer, it will return NULL.
170 Caller is required to apply GET_GUID_HOB_DATA () and GET_GUID_HOB_DATA_SIZE ()
171 to extract the data section and its size information, respectively.
172
173 If the pointer to the HOB list is NULL, then ASSERT().
174 If Guid is NULL, then ASSERT().
175
176 @param Guid The GUID to match with in the HOB list.
177
178 @return The first instance of the matched GUID HOB among the whole HOB list.
179
180**/
181VOID *
182EFIAPI
183GetFirstGuidHob (
184 IN CONST EFI_GUID *Guid
185 )
186{
187 VOID *HobList;
188
189 HobList = GetHobList ();
190 return GetNextGuidHob (Guid, HobList);
191}
192
193/**
194 Get the system boot mode from the HOB list.
195
196 This function returns the system boot mode information from the
197 PHIT HOB in HOB list.
198
199 If the pointer to the HOB list is NULL, then ASSERT().
200
201 @param VOID.
202
203 @return The Boot Mode.
204
205**/
206EFI_BOOT_MODE
207EFIAPI
208GetBootModeHob (
209 VOID
210 )
211{
212 EFI_STATUS Status;
213 EFI_BOOT_MODE BootMode;
214
215 Status = PeiServicesGetBootMode (&BootMode);
216 ASSERT_EFI_ERROR (Status);
217
218 return BootMode;
219}
220
221/**
222 Adds a new HOB to the HOB List.
223
224 This internal function enables PEIMs to create various types of HOBs.
225
226 @param Type Type of the new HOB.
227 @param Length Length of the new HOB to allocate.
228
229 @retval NULL The HOB could not be allocated.
230 @retval others The address of new HOB.
231
232**/
233VOID *
234EFIAPI
235InternalPeiCreateHob (
236 IN UINT16 Type,
237 IN UINT16 Length
238 )
239{
240 EFI_STATUS Status;
241 VOID *Hob;
242
243 Status = PeiServicesCreateHob (Type, Length, &Hob);
244 if (EFI_ERROR (Status)) {
245 Hob = NULL;
246 }
247 //
248 // Assume the process of HOB building is always successful.
249 //
250 ASSERT (Hob != NULL);
251 return Hob;
252}
253
254/**
255 Builds a HOB for a loaded PE32 module.
256
257 This function builds a HOB for a loaded PE32 module.
258 It can only be invoked during PEI phase;
259 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
260
261 If ModuleName is NULL, then ASSERT().
262 If there is no additional space for HOB creation, then ASSERT().
263
264 @param ModuleName The GUID File Name of the module.
265 @param MemoryAllocationModule The 64 bit physical address of the module.
266 @param ModuleLength The length of the module in bytes.
267 @param EntryPoint The 64 bit physical address of the module entry point.
268
269**/
270VOID
271EFIAPI
272BuildModuleHob (
273 IN CONST EFI_GUID *ModuleName,
274 IN EFI_PHYSICAL_ADDRESS MemoryAllocationModule,
275 IN UINT64 ModuleLength,
276 IN EFI_PHYSICAL_ADDRESS EntryPoint
277 )
278{
279 EFI_HOB_MEMORY_ALLOCATION_MODULE *Hob;
280
281 ASSERT (((MemoryAllocationModule & (EFI_PAGE_SIZE - 1)) == 0) &&
282 ((ModuleLength & (EFI_PAGE_SIZE - 1)) == 0));
283
284 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_MODULE));
285 if (Hob == NULL) {
286 return;
287 }
288
289 CopyGuid (&(Hob->MemoryAllocationHeader.Name), &gEfiHobMemoryAllocModuleGuid);
290 Hob->MemoryAllocationHeader.MemoryBaseAddress = MemoryAllocationModule;
291 Hob->MemoryAllocationHeader.MemoryLength = ModuleLength;
292 Hob->MemoryAllocationHeader.MemoryType = EfiBootServicesCode;
293
294 //
295 // Zero the reserved space to match HOB spec
296 //
297 ZeroMem (Hob->MemoryAllocationHeader.Reserved, sizeof (Hob->MemoryAllocationHeader.Reserved));
298
299 CopyGuid (&Hob->ModuleName, ModuleName);
300 Hob->EntryPoint = EntryPoint;
301}
302
303/**
304 Builds a HOB that describes a chunk of system memory.
305
306 This function builds a HOB that describes a chunk of system memory.
307 It can only be invoked during PEI phase;
308 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
309
310 If there is no additional space for HOB creation, then ASSERT().
311
312 @param ResourceType The type of resource described by this HOB.
313 @param ResourceAttribute The resource attributes of the memory described by this HOB.
314 @param PhysicalStart The 64 bit physical address of memory described by this HOB.
315 @param NumberOfBytes The length of the memory described by this HOB in bytes.
316
317**/
318VOID
319EFIAPI
320BuildResourceDescriptorHob (
321 IN EFI_RESOURCE_TYPE ResourceType,
322 IN EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute,
323 IN EFI_PHYSICAL_ADDRESS PhysicalStart,
324 IN UINT64 NumberOfBytes
325 )
326{
327 EFI_HOB_RESOURCE_DESCRIPTOR *Hob;
328
329 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, (UINT16) sizeof (EFI_HOB_RESOURCE_DESCRIPTOR));
330 if (Hob == NULL) {
331 return;
332 }
333
334 Hob->ResourceType = ResourceType;
335 Hob->ResourceAttribute = ResourceAttribute;
336 Hob->PhysicalStart = PhysicalStart;
337 Hob->ResourceLength = NumberOfBytes;
338}
339
340/**
341 Builds a customized HOB tagged with a GUID for identification and returns
342 the start address of GUID HOB data.
343
344 This function builds a customized HOB tagged with a GUID for identification
345 and returns the start address of GUID HOB data so that caller can fill the customized data.
346 The HOB Header and Name field is already stripped.
347 It can only be invoked during PEI phase;
348 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
349
350 If Guid is NULL, then ASSERT().
351 If there is no additional space for HOB creation, then ASSERT().
352 If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
353
354 @param Guid The GUID to tag the customized HOB.
355 @param DataLength The size of the data payload for the GUID HOB.
356
357 @retval NULL The GUID HOB could not be allocated.
358 @retval others The start address of GUID HOB data.
359
360**/
361VOID *
362EFIAPI
363BuildGuidHob (
364 IN CONST EFI_GUID *Guid,
365 IN UINTN DataLength
366 )
367{
368 EFI_HOB_GUID_TYPE *Hob;
369
370 //
371 // Make sure Guid is valid
372 //
373 ASSERT (Guid != NULL);
374
375 //
376 // Make sure that data length is not too long.
377 //
378 ASSERT (DataLength <= (0xffff - sizeof (EFI_HOB_GUID_TYPE)));
379
380 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_GUID_EXTENSION, (UINT16) (sizeof (EFI_HOB_GUID_TYPE) + DataLength));
381 if (Hob == NULL) {
382 return Hob;
383 }
384 CopyGuid (&Hob->Name, Guid);
385 return Hob + 1;
386}
387
388/**
389 Builds a customized HOB tagged with a GUID for identification, copies the input data to the HOB
390 data field, and returns the start address of the GUID HOB data.
391
392 This function builds a customized HOB tagged with a GUID for identification and copies the input
393 data to the HOB data field and returns the start address of the GUID HOB data. It can only be
394 invoked during PEI phase; for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
395 The HOB Header and Name field is already stripped.
396 It can only be invoked during PEI phase;
397 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
398
399 If Guid is NULL, then ASSERT().
400 If Data is NULL and DataLength > 0, then ASSERT().
401 If there is no additional space for HOB creation, then ASSERT().
402 If DataLength >= (0x10000 - sizeof (EFI_HOB_GUID_TYPE)), then ASSERT().
403
404 @param Guid The GUID to tag the customized HOB.
405 @param Data The data to be copied into the data field of the GUID HOB.
406 @param DataLength The size of the data payload for the GUID HOB.
407
408 @retval NULL The GUID HOB could not be allocated.
409 @retval others The start address of GUID HOB data.
410
411**/
412VOID *
413EFIAPI
414BuildGuidDataHob (
415 IN CONST EFI_GUID *Guid,
416 IN VOID *Data,
417 IN UINTN DataLength
418 )
419{
420 VOID *HobData;
421
422 ASSERT (Data != NULL || DataLength == 0);
423
424 HobData = BuildGuidHob (Guid, DataLength);
425 if (HobData == NULL) {
426 return HobData;
427 }
428
429 return CopyMem (HobData, Data, DataLength);
430}
431
432/**
433 Builds a Firmware Volume HOB.
434
435 This function builds a Firmware Volume HOB.
436 It can only be invoked during PEI phase;
437 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
438
439 If there is no additional space for HOB creation, then ASSERT().
440
441 @param BaseAddress The base address of the Firmware Volume.
442 @param Length The size of the Firmware Volume in bytes.
443
444**/
445VOID
446EFIAPI
447BuildFvHob (
448 IN EFI_PHYSICAL_ADDRESS BaseAddress,
449 IN UINT64 Length
450 )
451{
452 EFI_HOB_FIRMWARE_VOLUME *Hob;
453
454 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME));
455 if (Hob == NULL) {
456 return;
457 }
458
459 Hob->BaseAddress = BaseAddress;
460 Hob->Length = Length;
461}
462
463/**
464 Builds a EFI_HOB_TYPE_FV2 HOB.
465
466 This function builds a EFI_HOB_TYPE_FV2 HOB.
467 It can only be invoked during PEI phase;
468 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
469
470 If there is no additional space for HOB creation, then ASSERT().
471
472 @param BaseAddress The base address of the Firmware Volume.
473 @param Length The size of the Firmware Volume in bytes.
474 @param FvName The name of the Firmware Volume.
475 @param FileName The name of the file.
476
477**/
478VOID
479EFIAPI
480BuildFv2Hob (
481 IN EFI_PHYSICAL_ADDRESS BaseAddress,
482 IN UINT64 Length,
483 IN CONST EFI_GUID *FvName,
484 IN CONST EFI_GUID *FileName
485 )
486{
487 EFI_HOB_FIRMWARE_VOLUME2 *Hob;
488
489 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof (EFI_HOB_FIRMWARE_VOLUME2));
490 if (Hob == NULL) {
491 return;
492 }
493
494 Hob->BaseAddress = BaseAddress;
495 Hob->Length = Length;
496 CopyGuid (&Hob->FvName, FvName);
497 CopyGuid (&Hob->FileName, FileName);
498}
499
500/**
501 Builds a Capsule Volume HOB.
502
503 This function builds a Capsule Volume HOB.
504 It can only be invoked during PEI phase;
505 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
506
507 If the platform does not support Capsule Volume HOBs, then ASSERT().
508 If there is no additional space for HOB creation, then ASSERT().
509
510 @param BaseAddress The base address of the Capsule Volume.
511 @param Length The size of the Capsule Volume in bytes.
512
513**/
514VOID
515EFIAPI
516BuildCvHob (
517 IN EFI_PHYSICAL_ADDRESS BaseAddress,
518 IN UINT64 Length
519 )
520{
521 EFI_HOB_UEFI_CAPSULE *Hob;
522
523 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_UEFI_CAPSULE, (UINT16) sizeof (EFI_HOB_UEFI_CAPSULE));
524 if (Hob == NULL) {
525 return;
526 }
527
528 Hob->BaseAddress = BaseAddress;
529 Hob->Length = Length;
530}
531
532/**
533 Builds a HOB for the CPU.
534
535 This function builds a HOB for the CPU.
536 It can only be invoked during PEI phase;
537 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
538
539 If there is no additional space for HOB creation, then ASSERT().
540
541 @param SizeOfMemorySpace The maximum physical memory addressability of the processor.
542 @param SizeOfIoSpace The maximum physical I/O addressability of the processor.
543
544**/
545VOID
546EFIAPI
547BuildCpuHob (
548 IN UINT8 SizeOfMemorySpace,
549 IN UINT8 SizeOfIoSpace
550 )
551{
552 EFI_HOB_CPU *Hob;
553
554 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_CPU, (UINT16) sizeof (EFI_HOB_CPU));
555 if (Hob == NULL) {
556 return;
557 }
558
559 Hob->SizeOfMemorySpace = SizeOfMemorySpace;
560 Hob->SizeOfIoSpace = SizeOfIoSpace;
561
562 //
563 // Zero the reserved space to match HOB spec
564 //
565 ZeroMem (Hob->Reserved, sizeof (Hob->Reserved));
566}
567
568/**
569 Builds a HOB for the Stack.
570
571 This function builds a HOB for the stack.
572 It can only be invoked during PEI phase;
573 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
574
575 If there is no additional space for HOB creation, then ASSERT().
576
577 @param BaseAddress The 64 bit physical address of the Stack.
578 @param Length The length of the stack in bytes.
579
580**/
581VOID
582EFIAPI
583BuildStackHob (
584 IN EFI_PHYSICAL_ADDRESS BaseAddress,
585 IN UINT64 Length
586 )
587{
588 EFI_HOB_MEMORY_ALLOCATION_STACK *Hob;
589
590 ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
591 ((Length & (EFI_PAGE_SIZE - 1)) == 0));
592
593 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_STACK));
594 if (Hob == NULL) {
595 return;
596 }
597
598 CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocStackGuid);
599 Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
600 Hob->AllocDescriptor.MemoryLength = Length;
601 Hob->AllocDescriptor.MemoryType = EfiBootServicesData;
602
603 //
604 // Zero the reserved space to match HOB spec
605 //
606 ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));
607}
608
609/**
610 Builds a HOB for the BSP store.
611
612 This function builds a HOB for BSP store.
613 It can only be invoked during PEI phase;
614 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
615
616 If there is no additional space for HOB creation, then ASSERT().
617
618 @param BaseAddress The 64 bit physical address of the BSP.
619 @param Length The length of the BSP store in bytes.
620 @param MemoryType The type of memory allocated by this HOB.
621
622**/
623VOID
624EFIAPI
625BuildBspStoreHob (
626 IN EFI_PHYSICAL_ADDRESS BaseAddress,
627 IN UINT64 Length,
628 IN EFI_MEMORY_TYPE MemoryType
629 )
630{
631 EFI_HOB_MEMORY_ALLOCATION_BSP_STORE *Hob;
632
633 ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
634 ((Length & (EFI_PAGE_SIZE - 1)) == 0));
635
636 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION_BSP_STORE));
637 if (Hob == NULL) {
638 return;
639 }
640
641 CopyGuid (&(Hob->AllocDescriptor.Name), &gEfiHobMemoryAllocBspStoreGuid);
642 Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
643 Hob->AllocDescriptor.MemoryLength = Length;
644 Hob->AllocDescriptor.MemoryType = MemoryType;
645
646 //
647 // Zero the reserved space to match HOB spec
648 //
649 ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));
650}
651
652/**
653 Builds a HOB for the memory allocation.
654
655 This function builds a HOB for the memory allocation.
656 It can only be invoked during PEI phase;
657 for DXE phase, it will ASSERT() since PEI HOB is read-only for DXE phase.
658
659 If there is no additional space for HOB creation, then ASSERT().
660
661 @param BaseAddress The 64 bit physical address of the memory.
662 @param Length The length of the memory allocation in bytes.
663 @param MemoryType The type of memory allocated by this HOB.
664
665**/
666VOID
667EFIAPI
668BuildMemoryAllocationHob (
669 IN EFI_PHYSICAL_ADDRESS BaseAddress,
670 IN UINT64 Length,
671 IN EFI_MEMORY_TYPE MemoryType
672 )
673{
674 EFI_HOB_MEMORY_ALLOCATION *Hob;
675
676 ASSERT (((BaseAddress & (EFI_PAGE_SIZE - 1)) == 0) &&
677 ((Length & (EFI_PAGE_SIZE - 1)) == 0));
678
679 Hob = InternalPeiCreateHob (EFI_HOB_TYPE_MEMORY_ALLOCATION, (UINT16) sizeof (EFI_HOB_MEMORY_ALLOCATION));
680 if (Hob == NULL) {
681 return;
682 }
683
684 ZeroMem (&(Hob->AllocDescriptor.Name), sizeof (EFI_GUID));
685 Hob->AllocDescriptor.MemoryBaseAddress = BaseAddress;
686 Hob->AllocDescriptor.MemoryLength = Length;
687 Hob->AllocDescriptor.MemoryType = MemoryType;
688 //
689 // Zero the reserved space to match HOB spec
690 //
691 ZeroMem (Hob->AllocDescriptor.Reserved, sizeof (Hob->AllocDescriptor.Reserved));
692}
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette