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 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php.
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <Library/HobLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseMemoryLib.h>
23 #include <Guid/MemoryAllocationHob.h>
26 // Cache copy of HobList pointer.
28 extern VOID
*gHobList
;
30 EFI_HOB_HANDOFF_INFO_TABLE
*
32 IN VOID
*EfiMemoryBegin
,
33 IN UINTN EfiMemoryLength
,
34 IN VOID
*EfiFreeMemoryBottom
,
35 IN VOID
*EfiFreeMemoryTop
38 EFI_HOB_HANDOFF_INFO_TABLE
*Hob
;
39 EFI_HOB_GENERIC_HEADER
*HobEnd
;
41 Hob
= EfiFreeMemoryBottom
;
42 HobEnd
= (EFI_HOB_GENERIC_HEADER
*)(Hob
+1);
44 Hob
->Header
.HobType
= EFI_HOB_TYPE_HANDOFF
;
45 Hob
->Header
.HobLength
= sizeof (EFI_HOB_HANDOFF_INFO_TABLE
);
46 Hob
->Header
.Reserved
= 0;
48 HobEnd
->HobType
= EFI_HOB_TYPE_END_OF_HOB_LIST
;
49 HobEnd
->HobLength
= sizeof (EFI_HOB_GENERIC_HEADER
);
52 Hob
->Version
= EFI_HOB_HANDOFF_TABLE_VERSION
;
53 Hob
->BootMode
= BOOT_WITH_FULL_CONFIGURATION
;
55 Hob
->EfiMemoryTop
= (UINTN
)EfiMemoryBegin
+ EfiMemoryLength
;
56 Hob
->EfiMemoryBottom
= (UINTN
)EfiMemoryBegin
;
57 Hob
->EfiFreeMemoryTop
= (UINTN
)EfiFreeMemoryTop
;
58 Hob
->EfiFreeMemoryBottom
= (EFI_PHYSICAL_ADDRESS
)(UINTN
)(HobEnd
+1);
59 Hob
->EfiEndOfHobList
= (EFI_PHYSICAL_ADDRESS
)(UINTN
)HobEnd
;