VirtualBox

source: vbox/trunk/src/VBox/Devices/EFI/FirmwareNew/UefiPayloadPkg/UefiPayloadEntry/UefiPayloadEntry.h@ 108794

Last change on this file since 108794 was 108794, checked in by vboxsync, 2 weeks ago

Devices/EFI/FirmwareNew: Merge edk2-stable202502 from the vendor branch and make it build for the important platforms, bugref:4643

  • Property svn:eol-style set to native
File size: 7.5 KB
Line 
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 <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 <UniversalPayload/DeviceTree.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 Add a new HOB to the HOB List.
57
58 @param HobType Type of the new HOB.
59 @param HobLength Length of the new HOB to allocate.
60
61 @return NULL if there is no space to create a hob.
62 @return The address point to the new created hob.
63
64**/
65VOID *
66EFIAPI
67CreateHob (
68 IN UINT16 HobType,
69 IN UINT16 HobLength
70 );
71
72/**
73 Update the Stack Hob if the stack has been moved
74
75 @param BaseAddress The 64 bit physical address of the Stack.
76 @param Length The length of the stack in bytes.
77
78**/
79VOID
80EFIAPI
81UpdateStackHob (
82 IN EFI_PHYSICAL_ADDRESS BaseAddress,
83 IN UINT64 Length
84 );
85
86/**
87 Build a Handoff Information Table HOB
88
89 This function initialize a HOB region from EfiMemoryBegin to
90 EfiMemoryTop. And EfiFreeMemoryBottom and EfiFreeMemoryTop should
91 be inside the HOB region.
92
93 @param[in] EfiMemoryBottom Total memory start address
94 @param[in] EfiMemoryTop Total memory end address.
95 @param[in] EfiFreeMemoryBottom Free memory start address
96 @param[in] EfiFreeMemoryTop Free memory end address.
97
98 @return The pointer to the handoff HOB table.
99
100**/
101EFI_HOB_HANDOFF_INFO_TABLE *
102EFIAPI
103HobConstructor (
104 IN VOID *EfiMemoryBottom,
105 IN VOID *EfiMemoryTop,
106 IN VOID *EfiFreeMemoryBottom,
107 IN VOID *EfiFreeMemoryTop
108 );
109
110/**
111 Find DXE core from FV and build DXE core HOBs.
112
113 @param[out] DxeCoreEntryPoint DXE core entry point
114
115 @retval EFI_SUCCESS If it completed successfully.
116 @retval EFI_NOT_FOUND If it failed to load DXE FV.
117**/
118EFI_STATUS
119LoadDxeCore (
120 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint
121 );
122
123/**
124 Find DXE core from FV and build DXE core HOBs.
125
126 @param[in] DxeFv The FV where to find the DXE core.
127 @param[out] DxeCoreEntryPoint DXE core entry point
128
129 @retval EFI_SUCCESS If it completed successfully.
130 @retval EFI_NOT_FOUND If it failed to load DXE FV.
131**/
132EFI_STATUS
133UniversalLoadDxeCore (
134 IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv,
135 OUT PHYSICAL_ADDRESS *DxeCoreEntryPoint
136 );
137
138/**
139 It will Parse FDT -node based on information.
140 @param[in] FdtBase The starting memory address of FdtBase
141 @retval HobList The base address of Hoblist.
142
143**/
144UINT64
145EFIAPI
146FdtNodeParser (
147 IN VOID *FdtBase
148 );
149
150/**
151 It will Parse FDT -custom node based on information.
152 @param[in] FdtBase The starting memory address of FdtBase
153 @param[in] HostList The starting memory address of New Hob list.
154
155**/
156UINTN
157EFIAPI
158CustomFdtNodeParser (
159 IN VOID *FdtBase,
160 IN VOID *HostList
161 );
162
163/**
164 Transfers control to DxeCore.
165
166 This function performs a CPU architecture specific operations to execute
167 the entry point of DxeCore with the parameters of HobList.
168
169 @param DxeCoreEntryPoint The entry point of DxeCore.
170 @param HobList The start of HobList passed to DxeCore.
171**/
172VOID
173HandOffToDxeCore (
174 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,
175 IN EFI_PEI_HOB_POINTERS HobList
176 );
177
178EFI_STATUS
179FixUpPcdDatabase (
180 IN EFI_FIRMWARE_VOLUME_HEADER *DxeFv
181 );
182
183/**
184 This function searchs a given section type within a valid FFS file.
185
186 @param FileHeader A pointer to the file header that contains the set of sections to
187 be searched.
188 @param SearchType The value of the section type to search.
189 @param SectionData A pointer to the discovered section, if successful.
190
191 @retval EFI_SUCCESS The section was found.
192 @retval EFI_NOT_FOUND The section was not found.
193
194**/
195EFI_STATUS
196FileFindSection (
197 IN EFI_FFS_FILE_HEADER *FileHeader,
198 IN EFI_SECTION_TYPE SectionType,
199 OUT VOID **SectionData
200 );
201
202/**
203 This function searchs a given file type with a given Guid within a valid FV.
204 If input Guid is NULL, will locate the first section having the given file type
205
206 @param FvHeader A pointer to firmware volume header that contains the set of files
207 to be searched.
208 @param FileType File type to be searched.
209 @param Guid Will ignore if it is NULL.
210 @param FileHeader A pointer to the discovered file, if successful.
211
212 @retval EFI_SUCCESS Successfully found FileType
213 @retval EFI_NOT_FOUND File type can't be found.
214**/
215EFI_STATUS
216FvFindFileByTypeGuid (
217 IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader,
218 IN EFI_FV_FILETYPE FileType,
219 IN EFI_GUID *Guid OPTIONAL,
220 OUT EFI_FFS_FILE_HEADER **FileHeader
221 );
222
223/**
224 Build ACPI board info HOB using infomation from ACPI table
225
226 @param AcpiTableBase ACPI table start address in memory
227
228 @retval A pointer to ACPI board HOB ACPI_BOARD_INFO. Null if build HOB failure.
229**/
230ACPI_BOARD_INFO *
231BuildHobFromAcpi (
232 IN UINT64 AcpiTableBase
233 );
234
235/**
236 Allocates one or more pages .
237
238 Allocates the number of pages of MemoryType and returns a pointer to the
239 allocated buffer. The buffer returned is aligned on a 4KB boundary.
240 If Pages is 0, then NULL is returned.
241 If there is not enough memory availble to satisfy the request, then NULL
242 is returned.
243
244 @param Pages The number of 4 KB pages to allocate.
245 @param MemoryType The Memorytype
246 @return A pointer to the allocated buffer or NULL if allocation fails.
247**/
248VOID *
249EFIAPI
250PayloadAllocatePages (
251 IN UINTN Pages,
252 IN EFI_MEMORY_TYPE MemoryType
253 );
254
255/**
256 Entry point to the C language phase of UEFI payload.
257 @param[in] FdtPrt The starting address of FDT .
258 @retval It will not return if SUCCESS, and return error when passing bootloader parameter.
259**/
260EFI_STATUS
261EFIAPI
262FitUplEntryPoint (
263 IN UINTN BootloaderParameter
264 );
265
266/**
267 Entry point to the C language phase of UEFI payload.
268 @param[in] BootloaderParameter The starting address of bootloader parameter block.
269 @retval It will not return if SUCCESS, and return error when passing bootloader parameter.
270**/
271EFI_STATUS
272EFIAPI
273UplEntryPoint (
274 IN UINTN BootloaderParameter
275 );
276
277#endif
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette