]> git.proxmox.com Git - mirror_edk2.git/blob - UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h
UefiPayloadPkg: Remove asm code and sharing libraries
[mirror_edk2.git] / UefiPayloadPkg / UefiPayloadEntry / UefiPayloadEntry.h
1 /** @file
2 *
3 * Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
4 *
5 * SPDX-License-Identifier: BSD-2-Clause-Patent
6 *
7 **/
8
9 #ifndef __UEFI_PAYLOAD_ENTRY_H__
10 #define __UEFI_PAYLOAD_ENTRY_H__
11
12 #include <PiPei.h>
13
14 #include <Library/BaseLib.h>
15 #include <Library/BaseMemoryLib.h>
16 #include <Library/MemoryAllocationLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/PeCoffLib.h>
19 #include <Library/HobLib.h>
20 #include <Library/PcdLib.h>
21 #include <Guid/MemoryAllocationHob.h>
22 #include <Library/IoLib.h>
23 #include <Library/PeCoffLib.h>
24 #include <Library/BlParseLib.h>
25 #include <Library/PlatformSupportLib.h>
26 #include <Library/UefiCpuLib.h>
27 #include <IndustryStandard/Acpi.h>
28 #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
29 #include <Guid/SerialPortInfoGuid.h>
30 #include <Guid/SystemTableInfoGuid.h>
31 #include <Guid/MemoryMapInfoGuid.h>
32 #include <Guid/AcpiBoardInfoGuid.h>
33 #include <Guid/GraphicsInfoHob.h>
34 #include <UniversalPayload/SmbiosTable.h>
35 #include <UniversalPayload/AcpiTable.h>
36 #include <UniversalPayload/UniversalPayload.h>
37 #include <UniversalPayload/ExtraData.h>
38 #include <UniversalPayload/SerialPortInfo.h>
39 #include <Guid/PcdDataBaseSignatureGuid.h>
40
41 #define LEGACY_8259_MASK_REGISTER_MASTER 0x21
42 #define LEGACY_8259_MASK_REGISTER_SLAVE 0xA1
43 #define GET_OCCUPIED_SIZE(ActualSize, Alignment) \
44 ((ActualSize) + (((Alignment) - ((ActualSize) & ((Alignment) - 1))) & ((Alignment) - 1)))
45
46
47 #define E820_RAM 1
48 #define E820_RESERVED 2
49 #define E820_ACPI 3
50 #define E820_NVS 4
51 #define E820_UNUSABLE 5
52 #define E820_DISABLED 6
53 #define E820_PMEM 7
54 #define E820_UNDEFINED 8
55
56 /**
57 Auto-generated function that calls the library constructors for all of the module's
58 dependent libraries.
59 **/
60 VOID
61 EFIAPI
62 ProcessLibraryConstructorList (
63 VOID
64 );
65
66 /**
67 Add a new HOB to the HOB List.
68
69 @param HobType Type of the new HOB.
70 @param HobLength Length of the new HOB to allocate.
71
72 @return NULL if there is no space to create a hob.
73 @return The address point to the new created hob.
74
75 **/
76 VOID *
77 EFIAPI
78 CreateHob (
79 IN UINT16 HobType,
80 IN UINT16 HobLength
81 );
82
83 /**
84 Update the Stack Hob if the stack has been moved
85
86 @param BaseAddress The 64 bit physical address of the Stack.
87 @param Length The length of the stack in bytes.
88
89 **/
90 VOID
91 EFIAPI
92 UpdateStackHob (
93 IN EFI_PHYSICAL_ADDRESS BaseAddress,
94 IN UINT64 Length
95 );
96
97 /**
98 Build a Handoff Information Table HOB
99
100 This function initialize a HOB region from EfiMemoryBegin to
101 EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should
102 be inside the HOB region.
103
104 @param[in] EfiMemoryBottom Total memory start address
105 @param[in] EfiMemoryTop Total memory end address.
106 @param[in] EfiFreeMemoryBottom Free memory start address
107 @param[in] EfiFreeMemoryTop Free memory end address.
108
109 @return The pointer to the handoff HOB table.
110
111 **/
112 EFI_HOB_HANDOFF_INFO_TABLE*
113 EFIAPI
114 HobConstructor (
115 IN VOID *EfiMemoryBottom,
116 IN VOID *EfiMemoryTop,
117 IN VOID *EfiFreeMemoryBottom,
118 IN VOID *EfiFreeMemoryTop
119 );
120
121 /**
122 Find DXE core from FV and build DXE core HOBs.
123
124 @param[out] DxeCoreEntryPoint DXE core entry point
125
126 @retval EFI_SUCCESS If it completed successfully.
127 @retval EFI_NOT_FOUND If it failed to load DXE FV.
128 **/
129 EFI_STATUS
130 LoadDxeCore (
131 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint
132 );
133
134 /**
135 Find DXE core from FV and build DXE core HOBs.
136
137 @param[in] DxeFv The FV where to find the DXE core.
138 @param[out] DxeCoreEntryPoint DXE core entry point
139
140 @retval EFI_SUCCESS If it completed successfully.
141 @retval EFI_NOT_FOUND If it failed to load DXE FV.
142 **/
143 EFI_STATUS
144 UniversalLoadDxeCore (
145 IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv,
146 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint
147 );
148
149 /**
150 Transfers control to DxeCore.
151
152 This function performs a CPU architecture specific operations to execute
153 the entry point of DxeCore with the parameters of HobList.
154
155 @param DxeCoreEntryPoint The entry point of DxeCore.
156 @param HobList The start of HobList passed to DxeCore.
157 **/
158 VOID
159 HandOffToDxeCore (
160 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
161 IN EFI_PEI_HOB_POINTERS HobList
162 );
163
164 EFI_STATUS
165 FixUpPcdDatabase (
166 IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv
167 );
168
169 /**
170 This function searchs a given section type within a valid FFS file.
171
172 @param FileHeader A pointer to the file header that contains the set of sections to
173 be searched.
174 @param SearchType The value of the section type to search.
175 @param SectionData A pointer to the discovered section, if successful.
176
177 @retval EFI_SUCCESS The section was found.
178 @retval EFI_NOT_FOUND The section was not found.
179
180 **/
181 EFI_STATUS
182 FileFindSection (
183 IN EFI_FFS_FILE_HEADER *FileHeader,
184 IN EFI_SECTION_TYPE SectionType,
185 OUT VOID **SectionData
186 );
187
188 /**
189 This function searchs a given file type with a given Guid within a valid FV.
190 If input Guid is NULL, will locate the first section having the given file type
191
192 @param FvHeader A pointer to firmware volume header that contains the set of files
193 to be searched.
194 @param FileType File type to be searched.
195 @param Guid Will ignore if it is NULL.
196 @param FileHeader A pointer to the discovered file, if successful.
197
198 @retval EFI_SUCCESS Successfully found FileType
199 @retval EFI_NOT_FOUND File type can't be found.
200 **/
201 EFI_STATUS
202 FvFindFileByTypeGuid (
203 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader,
204 IN EFI_FV_FILETYPE FileType,
205 IN EFI_GUID *Guid OPTIONAL,
206 OUT EFI_FFS_FILE_HEADER **FileHeader
207 );
208
209 /**
210 Build ACPI board info HOB using infomation from ACPI table
211
212 @param AcpiTableBase ACPI table start address in memory
213
214 @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.
215 **/
216 ACPI_BOARD_INFO *
217 BuildHobFromAcpi (
218 IN UINT64 AcpiTableBase
219 );
220
221 #endif