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