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