]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / DxeIplPeim / DxeIpl.h
... / ...
CommitLineData
1/** @file\r
2 Master header file for DxeIpl PEIM. All source files in this module should\r
3 include this file for common definitions.\r
4\r
5Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
6SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9\r
10#ifndef __PEI_DXEIPL_H__\r
11#define __PEI_DXEIPL_H__\r
12\r
13#include <PiPei.h>\r
14#include <Ppi/DxeIpl.h>\r
15#include <Ppi/EndOfPeiPhase.h>\r
16#include <Ppi/MemoryDiscovered.h>\r
17#include <Ppi/ReadOnlyVariable2.h>\r
18#include <Ppi/Decompress.h>\r
19#include <Ppi/FirmwareVolumeInfo.h>\r
20#include <Ppi/GuidedSectionExtraction.h>\r
21#include <Ppi/LoadFile.h>\r
22#include <Ppi/S3Resume2.h>\r
23#include <Ppi/RecoveryModule.h>\r
24#include <Ppi/VectorHandoffInfo.h>\r
25\r
26#include <Guid/MemoryTypeInformation.h>\r
27#include <Guid/MemoryAllocationHob.h>\r
28#include <Guid/FirmwareFileSystem2.h>\r
29\r
30#include <Library/DebugLib.h>\r
31#include <Library/PeimEntryPoint.h>\r
32#include <Library/BaseLib.h>\r
33#include <Library/HobLib.h>\r
34#include <Library/PeiServicesLib.h>\r
35#include <Library/ReportStatusCodeLib.h>\r
36#include <Library/UefiDecompressLib.h>\r
37#include <Library/ExtractGuidedSectionLib.h>\r
38#include <Library/BaseMemoryLib.h>\r
39#include <Library/MemoryAllocationLib.h>\r
40#include <Library/PcdLib.h>\r
41#include <Library/S3Lib.h>\r
42#include <Library/RecoveryLib.h>\r
43#include <Library/DebugAgentLib.h>\r
44#include <Library/PeiServicesTablePointerLib.h>\r
45#include <Library/PerformanceLib.h>\r
46\r
47#define STACK_SIZE 0x20000\r
48#define BSP_STORE_SIZE 0x4000\r
49\r
50\r
51//\r
52// This PPI is installed to indicate the end of the PEI usage of memory\r
53//\r
54extern CONST EFI_PEI_PPI_DESCRIPTOR gEndOfPeiSignalPpi;\r
55\r
56/**\r
57 This function installs the PPIs that require permanent memory.\r
58\r
59 @param PeiServices Indirect reference to the PEI Services Table.\r
60 @param NotifyDescriptor Address of the notification descriptor data structure.\r
61 @param Ppi Address of the PPI that was installed.\r
62\r
63 @return EFI_SUCCESS The PPIs were installed successfully.\r
64 @return Others Some error occurs during the execution of this function.\r
65\r
66**/\r
67EFI_STATUS\r
68EFIAPI\r
69InstallIplPermanentMemoryPpis (\r
70 IN EFI_PEI_SERVICES **PeiServices,\r
71 IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,\r
72 IN VOID *Ppi\r
73 );\r
74\r
75/**\r
76 Searches DxeCore in all firmware Volumes and loads the first\r
77 instance that contains DxeCore.\r
78\r
79 @return FileHandle of DxeCore to load DxeCore.\r
80\r
81**/\r
82EFI_PEI_FILE_HANDLE\r
83DxeIplFindDxeCore (\r
84 VOID\r
85 );\r
86\r
87\r
88/**\r
89 Main entry point to last PEIM\r
90\r
91 @param This Entry point for DXE IPL PPI\r
92 @param PeiServices General purpose services available to every PEIM.\r
93 @param HobList Address to the Pei HOB list\r
94\r
95 @return EFI_SUCCESS DXE core was successfully loaded.\r
96 @return EFI_OUT_OF_RESOURCES There are not enough resources to load DXE core.\r
97\r
98**/\r
99EFI_STATUS\r
100EFIAPI\r
101DxeLoadCore (\r
102 IN CONST EFI_DXE_IPL_PPI *This,\r
103 IN EFI_PEI_SERVICES **PeiServices,\r
104 IN EFI_PEI_HOB_POINTERS HobList\r
105 );\r
106\r
107\r
108\r
109/**\r
110 Transfers control to DxeCore.\r
111\r
112 This function performs a CPU architecture specific operations to execute\r
113 the entry point of DxeCore with the parameters of HobList.\r
114 It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase.\r
115\r
116 @param DxeCoreEntryPoint The entry point of DxeCore.\r
117 @param HobList The start of HobList passed to DxeCore.\r
118\r
119**/\r
120VOID\r
121HandOffToDxeCore (\r
122 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,\r
123 IN EFI_PEI_HOB_POINTERS HobList\r
124 );\r
125\r
126\r
127\r
128/**\r
129 Updates the Stack HOB passed to DXE phase.\r
130\r
131 This function traverses the whole HOB list and update the stack HOB to\r
132 reflect the real stack that is used by DXE core.\r
133\r
134 @param BaseAddress The lower address of stack used by DxeCore.\r
135 @param Length The length of stack used by DxeCore.\r
136\r
137**/\r
138VOID\r
139UpdateStackHob (\r
140 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
141 IN UINT64 Length\r
142 );\r
143\r
144/**\r
145 The ExtractSection() function processes the input section and\r
146 returns a pointer to the section contents. If the section being\r
147 extracted does not require processing (if the section\r
148 GuidedSectionHeader.Attributes has the\r
149 EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then\r
150 OutputBuffer is just updated to point to the start of the\r
151 section's contents. Otherwise, *Buffer must be allocated\r
152 from PEI permanent memory.\r
153\r
154 @param This Indicates the\r
155 EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI instance.\r
156 Buffer containing the input GUIDed section to be\r
157 processed. OutputBuffer OutputBuffer is\r
158 allocated from PEI permanent memory and contains\r
159 the new section stream.\r
160 @param InputSection A pointer to the input buffer, which contains\r
161 the input section to be processed.\r
162 @param OutputBuffer A pointer to a caller-allocated buffer, whose\r
163 size is specified by the contents of OutputSize.\r
164 @param OutputSize A pointer to a caller-allocated\r
165 UINTN in which the size of *OutputBuffer\r
166 allocation is stored. If the function\r
167 returns anything other than EFI_SUCCESS,\r
168 the value of OutputSize is undefined.\r
169 @param AuthenticationStatus A pointer to a caller-allocated\r
170 UINT32 that indicates the\r
171 authentication status of the\r
172 output buffer. If the input\r
173 section's GuidedSectionHeader.\r
174 Attributes field has the\r
175 EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
176 bit as clear,\r
177 AuthenticationStatus must return\r
178 zero. These bits reflect the\r
179 status of the extraction\r
180 operation. If the function\r
181 returns anything other than\r
182 EFI_SUCCESS, the value of\r
183 AuthenticationStatus is\r
184 undefined.\r
185\r
186 @retval EFI_SUCCESS The InputSection was\r
187 successfully processed and the\r
188 section contents were returned.\r
189\r
190 @retval EFI_OUT_OF_RESOURCES The system has insufficient\r
191 resources to process the request.\r
192\r
193 @retval EFI_INVALID_PARAMETER The GUID in InputSection does\r
194 not match this instance of the\r
195 GUIDed Section Extraction PPI.\r
196\r
197**/\r
198EFI_STATUS\r
199EFIAPI\r
200CustomGuidedSectionExtract (\r
201 IN CONST EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *This,\r
202 IN CONST VOID *InputSection,\r
203 OUT VOID **OutputBuffer,\r
204 OUT UINTN *OutputSize,\r
205 OUT UINT32 *AuthenticationStatus\r
206 );\r
207\r
208\r
209/**\r
210 Decompresses a section to the output buffer.\r
211\r
212 This function looks up the compression type field in the input section and\r
213 applies the appropriate compression algorithm to compress the section to a\r
214 callee allocated buffer.\r
215\r
216 @param This Points to this instance of the\r
217 EFI_PEI_DECOMPRESS_PEI PPI.\r
218 @param CompressionSection Points to the compressed section.\r
219 @param OutputBuffer Holds the returned pointer to the decompressed\r
220 sections.\r
221 @param OutputSize Holds the returned size of the decompress\r
222 section streams.\r
223\r
224 @retval EFI_SUCCESS The section was decompressed successfully.\r
225 OutputBuffer contains the resulting data and\r
226 OutputSize contains the resulting size.\r
227\r
228**/\r
229EFI_STATUS\r
230EFIAPI\r
231Decompress (\r
232 IN CONST EFI_PEI_DECOMPRESS_PPI *This,\r
233 IN CONST EFI_COMPRESSION_SECTION *CompressionSection,\r
234 OUT VOID **OutputBuffer,\r
235 OUT UINTN *OutputSize\r
236 );\r
237\r
238#endif\r