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