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