2 HOB Library implementation for Standalone MM Core.
4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
13 #include <Library/HobLib.h>
14 #include <Library/DebugLib.h>
15 #include <Library/BaseMemoryLib.h>
17 #include <Guid/MemoryAllocationHob.h>
20 // Cache copy of HobList pointer.
22 extern VOID
*gHobList
;
24 EFI_HOB_HANDOFF_INFO_TABLE
*
26 IN VOID
*EfiMemoryBegin
,
27 IN UINTN EfiMemoryLength
,
28 IN VOID
*EfiFreeMemoryBottom
,
29 IN VOID
*EfiFreeMemoryTop
32 EFI_HOB_HANDOFF_INFO_TABLE
*Hob
;
33 EFI_HOB_GENERIC_HEADER
*HobEnd
;
35 Hob
= EfiFreeMemoryBottom
;
36 HobEnd
= (EFI_HOB_GENERIC_HEADER
*)(Hob
+1);
38 Hob
->Header
.HobType
= EFI_HOB_TYPE_HANDOFF
;
39 Hob
->Header
.HobLength
= sizeof (EFI_HOB_HANDOFF_INFO_TABLE
);
40 Hob
->Header
.Reserved
= 0;
42 HobEnd
->HobType
= EFI_HOB_TYPE_END_OF_HOB_LIST
;
43 HobEnd
->HobLength
= sizeof (EFI_HOB_GENERIC_HEADER
);
46 Hob
->Version
= EFI_HOB_HANDOFF_TABLE_VERSION
;
47 Hob
->BootMode
= BOOT_WITH_FULL_CONFIGURATION
;
49 Hob
->EfiMemoryTop
= (UINTN
)EfiMemoryBegin
+ EfiMemoryLength
;
50 Hob
->EfiMemoryBottom
= (UINTN
)EfiMemoryBegin
;
51 Hob
->EfiFreeMemoryTop
= (UINTN
)EfiFreeMemoryTop
;
52 Hob
->EfiFreeMemoryBottom
= (EFI_PHYSICAL_ADDRESS
)(UINTN
)(HobEnd
+1);
53 Hob
->EfiEndOfHobList
= (EFI_PHYSICAL_ADDRESS
)(UINTN
)HobEnd
;