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/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>
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)))
46 #define E820_RESERVED 2
49 #define E820_UNUSABLE 5
50 #define E820_DISABLED 6
52 #define E820_UNDEFINED 8
55 Auto-generated function that calls the library constructors for all of the module's
60 ProcessLibraryConstructorList (
65 Add a new HOB to the HOB List.
67 @param HobType Type of the new HOB.
68 @param HobLength Length of the new HOB to allocate.
70 @return NULL if there is no space to create a hob.
71 @return The address point to the new created hob.
82 Update the Stack Hob if the stack has been moved
84 @param BaseAddress The 64 bit physical address of the Stack.
85 @param Length The length of the stack in bytes.
91 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
96 Build a Handoff Information Table HOB
98 This function initialize a HOB region from EfiMemoryBegin to
99 EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should
100 be inside the HOB region.
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.
107 @return The pointer to the handoff HOB table.
110 EFI_HOB_HANDOFF_INFO_TABLE
*
113 IN VOID
*EfiMemoryBottom
,
114 IN VOID
*EfiMemoryTop
,
115 IN VOID
*EfiFreeMemoryBottom
,
116 IN VOID
*EfiFreeMemoryTop
120 Find DXE core from FV and build DXE core HOBs.
122 @param[out] DxeCoreEntryPoint DXE core entry point
124 @retval EFI_SUCCESS If it completed successfully.
125 @retval EFI_NOT_FOUND If it failed to load DXE FV.
129 OUT PHYSICAL_ADDRESS
*DxeCoreEntryPoint
133 Find DXE core from FV and build DXE core HOBs.
135 @param[in] DxeFv The FV where to find the DXE core.
136 @param[out] DxeCoreEntryPoint DXE core entry point
138 @retval EFI_SUCCESS If it completed successfully.
139 @retval EFI_NOT_FOUND If it failed to load DXE FV.
142 UniversalLoadDxeCore (
143 IN EFI_FIRMWARE_VOLUME_HEADER
*DxeFv
,
144 OUT PHYSICAL_ADDRESS
*DxeCoreEntryPoint
148 Transfers control to DxeCore.
150 This function performs a CPU architecture specific operations to execute
151 the entry point of DxeCore with the parameters of HobList.
153 @param DxeCoreEntryPoint The entry point of DxeCore.
154 @param HobList The start of HobList passed to DxeCore.
158 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint
,
159 IN EFI_PEI_HOB_POINTERS HobList
164 IN EFI_FIRMWARE_VOLUME_HEADER
*DxeFv
168 This function searchs a given section type within a valid FFS file.
170 @param FileHeader A pointer to the file header that contains the set of sections to
172 @param SearchType The value of the section type to search.
173 @param SectionData A pointer to the discovered section, if successful.
175 @retval EFI_SUCCESS The section was found.
176 @retval EFI_NOT_FOUND The section was not found.
181 IN EFI_FFS_FILE_HEADER
*FileHeader
,
182 IN EFI_SECTION_TYPE SectionType
,
183 OUT VOID
**SectionData
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
190 @param FvHeader A pointer to firmware volume header that contains the set of files
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.
196 @retval EFI_SUCCESS Successfully found FileType
197 @retval EFI_NOT_FOUND File type can't be found.
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
208 Build ACPI board info HOB using infomation from ACPI table
210 @param AcpiTableBase ACPI table start address in memory
212 @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.
216 IN UINT64 AcpiTableBase