]> git.proxmox.com Git - mirror_edk2.git/blame - UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
UefiPayloadPkg: Get and enter DxeCore for Universal Payload
[mirror_edk2.git] / UefiPayloadPkg / UefiPayloadEntry / UefiPayloadEntry.h
CommitLineData
7c4ab1c2
GD
1/** @file\r
2*\r
302a8f35 3* Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>\r
7c4ab1c2
GD
4*\r
5* SPDX-License-Identifier: BSD-2-Clause-Patent\r
6*\r
7**/\r
8\r
9#ifndef __UEFI_PAYLOAD_ENTRY_H__\r
10#define __UEFI_PAYLOAD_ENTRY_H__\r
11\r
12#include <PiPei.h>\r
13\r
14#include <Library/BaseLib.h>\r
15#include <Library/BaseMemoryLib.h>\r
16#include <Library/MemoryAllocationLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/PeCoffLib.h>\r
19#include <Library/HobLib.h>\r
20#include <Library/PcdLib.h>\r
21#include <Guid/MemoryAllocationHob.h>\r
22#include <Library/IoLib.h>\r
23#include <Library/PeCoffLib.h>\r
24#include <Library/BlParseLib.h>\r
25#include <Library/PlatformSupportLib.h>\r
26#include <Library/UefiCpuLib.h>\r
27#include <IndustryStandard/Acpi.h>\r
28#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>\r
29#include <Guid/SerialPortInfoGuid.h>\r
30#include <Guid/SystemTableInfoGuid.h>\r
31#include <Guid/MemoryMapInfoGuid.h>\r
32#include <Guid/AcpiBoardInfoGuid.h>\r
33#include <Guid/GraphicsInfoHob.h>\r
302a8f35 34#include <UniversalPayload/SmbiosTable.h>\r
8c0d6780 35#include <UniversalPayload/AcpiTable.h>\r
b208d37c
ZL
36#include <UniversalPayload/UniversalPayload.h>\r
37#include <UniversalPayload/ExtraData.h>\r
7c4ab1c2
GD
38\r
39#define LEGACY_8259_MASK_REGISTER_MASTER 0x21\r
40#define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1\r
41#define GET_OCCUPIED_SIZE(ActualSize, Alignment) \\r
42 ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))\r
43\r
1e5e58d3
PR
44\r
45#define E820_RAM 1\r
46#define E820_RESERVED 2\r
47#define E820_ACPI 3\r
48#define E820_NVS 4\r
49#define E820_UNUSABLE 5\r
50#define E820_DISABLED 6\r
51#define E820_PMEM 7\r
52#define E820_UNDEFINED 8\r
53\r
7c4ab1c2
GD
54/**\r
55 Auto-generated function that calls the library constructors for all of the module's\r
56 dependent libraries.\r
57**/\r
58VOID\r
59EFIAPI\r
60ProcessLibraryConstructorList (\r
61 VOID\r
62 );\r
63\r
64/**\r
65 Add a new HOB to the HOB List.\r
66\r
67 @param HobType Type of the new HOB.\r
68 @param HobLength Length of the new HOB to allocate.\r
69\r
70 @return NULL if there is no space to create a hob.\r
71 @return The address point to the new created hob.\r
72\r
73**/\r
74VOID *\r
75EFIAPI\r
76CreateHob (\r
77 IN UINT16 HobType,\r
78 IN UINT16 HobLength\r
79 );\r
80\r
81/**\r
82 Update the Stack Hob if the stack has been moved\r
83\r
84 @param BaseAddress The 64 bit physical address of the Stack.\r
85 @param Length The length of the stack in bytes.\r
86\r
87**/\r
88VOID\r
89EFIAPI\r
90UpdateStackHob (\r
91 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
92 IN UINT64 Length\r
93 );\r
94\r
95/**\r
96 Build a Handoff Information Table HOB\r
97\r
d63595c3
ZL
98 This function initialize a HOB region from EfiMemoryBegin to\r
99 EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should\r
7c4ab1c2
GD
100 be inside the HOB region.\r
101\r
d63595c3
ZL
102 @param[in] EfiMemoryBottom Total memory start address\r
103 @param[in] EfiMemoryTop Total memory end address.\r
104 @param[in] EfiFreeMemoryBottom Free memory start address\r
105 @param[in] EfiFreeMemoryTop Free memory end address.\r
7c4ab1c2
GD
106\r
107 @return The pointer to the handoff HOB table.\r
108\r
109**/\r
110EFI_HOB_HANDOFF_INFO_TABLE*\r
111EFIAPI\r
112HobConstructor (\r
d63595c3
ZL
113 IN VOID *EfiMemoryBottom,\r
114 IN VOID *EfiMemoryTop,\r
7c4ab1c2
GD
115 IN VOID *EfiFreeMemoryBottom,\r
116 IN VOID *EfiFreeMemoryTop\r
117 );\r
118\r
119/**\r
120 Find DXE core from FV and build DXE core HOBs.\r
121\r
122 @param[out] DxeCoreEntryPoint DXE core entry point\r
123\r
124 @retval EFI_SUCCESS If it completed successfully.\r
125 @retval EFI_NOT_FOUND If it failed to load DXE FV.\r
126**/\r
127EFI_STATUS\r
128LoadDxeCore (\r
129 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint\r
130 );\r
131\r
b208d37c
ZL
132/**\r
133 Find DXE core from FV and build DXE core HOBs.\r
134\r
135 @param[in] DxeFv The FV where to find the DXE core.\r
136 @param[out] DxeCoreEntryPoint DXE core entry point\r
137\r
138 @retval EFI_SUCCESS If it completed successfully.\r
139 @retval EFI_NOT_FOUND If it failed to load DXE FV.\r
140**/\r
141EFI_STATUS\r
142UniversalLoadDxeCore (\r
143 IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv,\r
144 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint\r
145 );\r
146\r
7c4ab1c2
GD
147/**\r
148 Transfers control to DxeCore.\r
149\r
150 This function performs a CPU architecture specific operations to execute\r
151 the entry point of DxeCore with the parameters of HobList.\r
152\r
153 @param DxeCoreEntryPoint The entry point of DxeCore.\r
154 @param HobList The start of HobList passed to DxeCore.\r
155**/\r
156VOID\r
157HandOffToDxeCore (\r
158 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,\r
159 IN EFI_PEI_HOB_POINTERS HobList\r
160 );\r
161\r
162#endif\r