]> git.proxmox.com Git - mirror_edk2.git/blob - StandaloneMmPkg/Library/StandaloneMmCoreHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
StandaloneMmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / StandaloneMmPkg / Library / StandaloneMmCoreHobLib / AArch64 / StandaloneMmCoreHobLibInternal.c
1 /** @file
2 HOB Library implementation for Standalone MM Core.
3
4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
5 Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #include <PiMm.h>
12
13 #include <Library/HobLib.h>
14 #include <Library/DebugLib.h>
15 #include <Library/BaseMemoryLib.h>
16
17 #include <Guid/MemoryAllocationHob.h>
18
19 //
20 // Cache copy of HobList pointer.
21 //
22 extern VOID *gHobList;
23
24 EFI_HOB_HANDOFF_INFO_TABLE*
25 HobConstructor (
26 IN VOID *EfiMemoryBegin,
27 IN UINTN EfiMemoryLength,
28 IN VOID *EfiFreeMemoryBottom,
29 IN VOID *EfiFreeMemoryTop
30 )
31 {
32 EFI_HOB_HANDOFF_INFO_TABLE *Hob;
33 EFI_HOB_GENERIC_HEADER *HobEnd;
34
35 Hob = EfiFreeMemoryBottom;
36 HobEnd = (EFI_HOB_GENERIC_HEADER *)(Hob+1);
37
38 Hob->Header.HobType = EFI_HOB_TYPE_HANDOFF;
39 Hob->Header.HobLength = sizeof (EFI_HOB_HANDOFF_INFO_TABLE);
40 Hob->Header.Reserved = 0;
41
42 HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST;
43 HobEnd->HobLength = sizeof (EFI_HOB_GENERIC_HEADER);
44 HobEnd->Reserved = 0;
45
46 Hob->Version = EFI_HOB_HANDOFF_TABLE_VERSION;
47 Hob->BootMode = BOOT_WITH_FULL_CONFIGURATION;
48
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;
54
55 gHobList = Hob;
56
57 return Hob;
58 }