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