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