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