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