3 * Copyright (c) 2021, Intel Corporation. All rights reserved.<BR>
5 * SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef __UEFI_PAYLOAD_ENTRY_H__
10 #define __UEFI_PAYLOAD_ENTRY_H__
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>
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)))
48 #define E820_RESERVED 2
51 #define E820_UNUSABLE 5
52 #define E820_DISABLED 6
54 #define E820_UNDEFINED 8
57 Auto-generated function that calls the library constructors for all of the module's
62 ProcessLibraryConstructorList (
67 Add a new HOB to the HOB List.
69 @param HobType Type of the new HOB.
70 @param HobLength Length of the new HOB to allocate.
72 @return NULL if there is no space to create a hob.
73 @return The address point to the new created hob.
84 Update the Stack Hob if the stack has been moved
86 @param BaseAddress The 64 bit physical address of the Stack.
87 @param Length The length of the stack in bytes.
93 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
98 Build a Handoff Information Table HOB
100 This function initialize a HOB region from EfiMemoryBegin to
101 EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should
102 be inside the HOB region.
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.
109 @return The pointer to the handoff HOB table.
112 EFI_HOB_HANDOFF_INFO_TABLE
*
115 IN VOID
*EfiMemoryBottom
,
116 IN VOID
*EfiMemoryTop
,
117 IN VOID
*EfiFreeMemoryBottom
,
118 IN VOID
*EfiFreeMemoryTop
122 Find DXE core from FV and build DXE core HOBs.
124 @param[out] DxeCoreEntryPoint DXE core entry point
126 @retval EFI_SUCCESS If it completed successfully.
127 @retval EFI_NOT_FOUND If it failed to load DXE FV.
131 OUT PHYSICAL_ADDRESS
*DxeCoreEntryPoint
135 Find DXE core from FV and build DXE core HOBs.
137 @param[in] DxeFv The FV where to find the DXE core.
138 @param[out] DxeCoreEntryPoint DXE core entry point
140 @retval EFI_SUCCESS If it completed successfully.
141 @retval EFI_NOT_FOUND If it failed to load DXE FV.
144 UniversalLoadDxeCore (
145 IN EFI_FIRMWARE_VOLUME_HEADER
*DxeFv
,
146 OUT PHYSICAL_ADDRESS
*DxeCoreEntryPoint
150 Transfers control to DxeCore.
152 This function performs a CPU architecture specific operations to execute
153 the entry point of DxeCore with the parameters of HobList.
155 @param DxeCoreEntryPoint The entry point of DxeCore.
156 @param HobList The start of HobList passed to DxeCore.
160 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint
,
161 IN EFI_PEI_HOB_POINTERS HobList
166 IN EFI_FIRMWARE_VOLUME_HEADER
*DxeFv
170 This function searchs a given section type within a valid FFS file.
172 @param FileHeader A pointer to the file header that contains the set of sections to
174 @param SearchType The value of the section type to search.
175 @param SectionData A pointer to the discovered section, if successful.
177 @retval EFI_SUCCESS The section was found.
178 @retval EFI_NOT_FOUND The section was not found.
183 IN EFI_FFS_FILE_HEADER
*FileHeader
,
184 IN EFI_SECTION_TYPE SectionType
,
185 OUT VOID
**SectionData
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
192 @param FvHeader A pointer to firmware volume header that contains the set of files
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.
198 @retval EFI_SUCCESS Successfully found FileType
199 @retval EFI_NOT_FOUND File type can't be found.
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
210 Build ACPI board info HOB using infomation from ACPI table
212 @param AcpiTableBase ACPI table start address in memory
214 @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.
218 IN UINT64 AcpiTableBase