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