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 <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)))
47 #define E820_RESERVED 2
50 #define E820_UNUSABLE 5
51 #define E820_DISABLED 6
53 #define E820_UNDEFINED 8
56 Auto-generated function that calls the library constructors for all of the module's
61 ProcessLibraryConstructorList (
66 Add a new HOB to the HOB List.
68 @param HobType Type of the new HOB.
69 @param HobLength Length of the new HOB to allocate.
71 @return NULL if there is no space to create a hob.
72 @return The address point to the new created hob.
83 Update the Stack Hob if the stack has been moved
85 @param BaseAddress The 64 bit physical address of the Stack.
86 @param Length The length of the stack in bytes.
92 IN EFI_PHYSICAL_ADDRESS BaseAddress
,
97 Build a Handoff Information Table HOB
99 This function initialize a HOB region from EfiMemoryBegin to
100 EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should
101 be inside the HOB region.
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.
108 @return The pointer to the handoff HOB table.
111 EFI_HOB_HANDOFF_INFO_TABLE
*
114 IN VOID
*EfiMemoryBottom
,
115 IN VOID
*EfiMemoryTop
,
116 IN VOID
*EfiFreeMemoryBottom
,
117 IN VOID
*EfiFreeMemoryTop
121 Find DXE core from FV and build DXE core HOBs.
123 @param[out] DxeCoreEntryPoint DXE core entry point
125 @retval EFI_SUCCESS If it completed successfully.
126 @retval EFI_NOT_FOUND If it failed to load DXE FV.
130 OUT PHYSICAL_ADDRESS
*DxeCoreEntryPoint
134 Find DXE core from FV and build DXE core HOBs.
136 @param[in] DxeFv The FV where to find the DXE core.
137 @param[out] DxeCoreEntryPoint DXE core entry point
139 @retval EFI_SUCCESS If it completed successfully.
140 @retval EFI_NOT_FOUND If it failed to load DXE FV.
143 UniversalLoadDxeCore (
144 IN EFI_FIRMWARE_VOLUME_HEADER
*DxeFv
,
145 OUT PHYSICAL_ADDRESS
*DxeCoreEntryPoint
149 Transfers control to DxeCore.
151 This function performs a CPU architecture specific operations to execute
152 the entry point of DxeCore with the parameters of HobList.
154 @param DxeCoreEntryPoint The entry point of DxeCore.
155 @param HobList The start of HobList passed to DxeCore.
159 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint
,
160 IN EFI_PEI_HOB_POINTERS HobList
165 IN EFI_FIRMWARE_VOLUME_HEADER
*DxeFv
169 This function searchs a given section type within a valid FFS file.
171 @param FileHeader A pointer to the file header that contains the set of sections to
173 @param SearchType The value of the section type to search.
174 @param SectionData A pointer to the discovered section, if successful.
176 @retval EFI_SUCCESS The section was found.
177 @retval EFI_NOT_FOUND The section was not found.
182 IN EFI_FFS_FILE_HEADER
*FileHeader
,
183 IN EFI_SECTION_TYPE SectionType
,
184 OUT VOID
**SectionData
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
191 @param FvHeader A pointer to firmware volume header that contains the set of files
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.
197 @retval EFI_SUCCESS Successfully found FileType
198 @retval EFI_NOT_FOUND File type can't be found.
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