]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
Roll back changes to apply GetBestLanguage() in HiiDataBase. Exact language match...
[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
6d3ea23f 5Copyright (c) 2006 - 2009, 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
6d3ea23f 108EFIAPI\r
48557c65 109PeiImageRead (\r
110 IN VOID *FileHandle,\r
111 IN UINTN FileOffset,\r
112 IN OUT UINTN *ReadSize,\r
113 OUT VOID *Buffer\r
f45af90b 114 );\r
95276127 115\r
91d92e25 116\r
91d92e25 117/**\r
118 Main entry point to last PEIM \r
119 \r
120 @param This Entry point for DXE IPL PPI\r
121 @param PeiServices General purpose services available to every PEIM.\r
122 @param HobList Address to the Pei HOB list\r
123 \r
124 @return EFI_SUCCESS DXE core was successfully loaded. \r
125 @return EFI_OUT_OF_RESOURCES There are not enough resources to load DXE core.\r
126\r
127**/\r
95276127 128EFI_STATUS\r
129EFIAPI\r
130DxeLoadCore (\r
1f3a753e 131 IN CONST EFI_DXE_IPL_PPI *This,\r
95276127 132 IN EFI_PEI_SERVICES **PeiServices,\r
133 IN EFI_PEI_HOB_POINTERS HobList\r
134 );\r
135\r
91d92e25 136\r
137\r
138/**\r
139 Transfers control to DxeCore.\r
140\r
141 This function performs a CPU architecture specific operations to execute\r
142 the entry point of DxeCore with the parameters of HobList.\r
48557c65 143 It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase.\r
91d92e25 144\r
48557c65 145 @param DxeCoreEntryPoint The entry point of DxeCore.\r
91d92e25 146 @param HobList The start of HobList passed to DxeCore.\r
91d92e25 147\r
148**/\r
95276127 149VOID\r
150HandOffToDxeCore (\r
151 IN EFI_PHYSICAL_ADDRESS DxeCoreEntryPoint,\r
9b937a73 152 IN EFI_PEI_HOB_POINTERS HobList\r
95276127 153 );\r
154\r
91d92e25 155\r
156\r
157/**\r
158 Updates the Stack HOB passed to DXE phase.\r
159\r
160 This function traverses the whole HOB list and update the stack HOB to\r
161 reflect the real stack that is used by DXE core.\r
162\r
163 @param BaseAddress The lower address of stack used by DxeCore.\r
164 @param Length The length of stack used by DxeCore.\r
165\r
166**/\r
30c8f861 167VOID\r
168UpdateStackHob (\r
169 IN EFI_PHYSICAL_ADDRESS BaseAddress,\r
170 IN UINT64 Length\r
171 );\r
172\r
b98da1b1 173/**\r
174 The ExtractSection() function processes the input section and\r
175 returns a pointer to the section contents. If the section being\r
176 extracted does not require processing (if the section\r
177 GuidedSectionHeader.Attributes has the\r
178 EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then\r
179 OutputBuffer is just updated to point to the start of the\r
180 section's contents. Otherwise, *Buffer must be allocated\r
181 from PEI permanent memory.\r
182\r
183 @param This Indicates the\r
184 EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI instance.\r
185 Buffer containing the input GUIDed section to be\r
186 processed. OutputBuffer OutputBuffer is\r
187 allocated from PEI permanent memory and contains\r
188 the new section stream.\r
189 @param InputSection A pointer to the input buffer, which contains\r
190 the input section to be processed.\r
191 @param OutputBuffer A pointer to a caller-allocated buffer, whose\r
192 size is specified by the contents of OutputSize.\r
193 @param OutputSize A pointer to a caller-allocated\r
194 UINTN in which the size of *OutputBuffer\r
195 allocation is stored. If the function\r
196 returns anything other than EFI_SUCCESS,\r
197 the value of OutputSize is undefined.\r
198 @param AuthenticationStatus A pointer to a caller-allocated\r
199 UINT32 that indicates the\r
200 authentication status of the\r
201 output buffer. If the input\r
202 section's GuidedSectionHeader.\r
203 Attributes field has the\r
204 EFI_GUIDED_SECTION_AUTH_STATUS_VALID \r
205 bit as clear,\r
206 AuthenticationStatus must return\r
207 zero. These bits reflect the\r
208 status of the extraction\r
209 operation. If the function\r
210 returns anything other than\r
211 EFI_SUCCESS, the value of\r
212 AuthenticationStatus is\r
213 undefined.\r
214 \r
215 @retval EFI_SUCCESS The InputSection was\r
216 successfully processed and the\r
217 section contents were returned.\r
218 \r
219 @retval EFI_OUT_OF_RESOURCES The system has insufficient\r
220 resources to process the request.\r
221 \r
222 @retval EFI_INVALID_PARAMETER The GUID in InputSection does\r
223 not match this instance of the\r
224 GUIDed Section Extraction PPI.\r
91d92e25 225\r
b98da1b1 226**/\r
227EFI_STATUS\r
6d3ea23f 228EFIAPI\r
b98da1b1 229CustomGuidedSectionExtract (\r
230 IN CONST EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI *This,\r
231 IN CONST VOID *InputSection,\r
232 OUT VOID **OutputBuffer,\r
233 OUT UINTN *OutputSize,\r
234 OUT UINT32 *AuthenticationStatus\r
235 );\r
236\r
237\r
238/**\r
239 Decompresses a section to the output buffer.\r
240\r
48557c65 241 This function looks up the compression type field in the input section and\r
b98da1b1 242 applies the appropriate compression algorithm to compress the section to a\r
243 callee allocated buffer.\r
244 \r
245 @param This Points to this instance of the\r
246 EFI_PEI_DECOMPRESS_PEI PPI.\r
247 @param CompressionSection Points to the compressed section.\r
248 @param OutputBuffer Holds the returned pointer to the decompressed\r
249 sections.\r
250 @param OutputSize Holds the returned size of the decompress\r
251 section streams.\r
252 \r
253 @retval EFI_SUCCESS The section was decompressed successfully.\r
254 OutputBuffer contains the resulting data and\r
255 OutputSize contains the resulting size.\r
256\r
257**/\r
258EFI_STATUS\r
259EFIAPI \r
260Decompress (\r
261 IN CONST EFI_PEI_DECOMPRESS_PPI *This,\r
262 IN CONST EFI_COMPRESSION_SECTION *CompressionSection,\r
263 OUT VOID **OutputBuffer,\r
264 OUT UINTN *OutputSize\r
265 );\r
91d92e25 266\r
95276127 267#endif\r