]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Core/DxeIplPeim/DxeIpl.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / MdeModulePkg / Core / DxeIplPeim / DxeIpl.h
index 1907077ef2188f867639ab127390186f4f6b1690..2f015befceca66375f9393928714c55beb626afb 100644 (file)
-/*++\r
+/** @file\r
+  Master header file for DxeIpl PEIM. All source files in this module should\r
+  include this file for common definitions.\r
 \r
-Copyright (c) 2006, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-Module Name:\r
-\r
-  DxeIpl.h\r
-\r
-Abstract:\r
-\r
---*/\r
+**/\r
 \r
 #ifndef __PEI_DXEIPL_H__\r
 #define __PEI_DXEIPL_H__\r
 \r
 #include <PiPei.h>\r
 #include <Ppi/DxeIpl.h>\r
-#include <Ppi/S3Resume.h>\r
-#include <Protocol/EdkDecompress.h>\r
 #include <Ppi/EndOfPeiPhase.h>\r
-#include <Protocol/CustomizedDecompress.h>\r
-#include <Protocol/Decompress.h>\r
-#include <Ppi/Security.h>\r
-#include <Ppi/SectionExtraction.h>\r
-#include <Ppi/FvLoadFile.h>\r
-#include <Ppi/RecoveryModule.h>\r
 #include <Ppi/MemoryDiscovered.h>\r
+#include <Ppi/ReadOnlyVariable2.h>\r
+#include <Ppi/Decompress.h>\r
+#include <Ppi/FirmwareVolumeInfo.h>\r
+#include <Ppi/GuidedSectionExtraction.h>\r
+#include <Ppi/LoadFile.h>\r
+#include <Ppi/S3Resume2.h>\r
+#include <Ppi/RecoveryModule.h>\r
+#include <Ppi/CapsuleOnDisk.h>\r
+#include <Ppi/VectorHandoffInfo.h>\r
+\r
+#include <Guid/MemoryTypeInformation.h>\r
+#include <Guid/MemoryAllocationHob.h>\r
+#include <Guid/FirmwareFileSystem2.h>\r
+\r
 #include <Library/DebugLib.h>\r
 #include <Library/PeimEntryPoint.h>\r
 #include <Library/BaseLib.h>\r
 #include <Library/HobLib.h>\r
 #include <Library/PeiServicesLib.h>\r
 #include <Library/ReportStatusCodeLib.h>\r
-#include <Library/CacheMaintenanceLib.h>\r
-#include <Library/PeCoffLoaderLib.h>\r
 #include <Library/UefiDecompressLib.h>\r
-#include <Library/CustomDecompressLib.h>\r
-#include <Library/PeiServicesTablePointerLib.h>\r
+#include <Library/ExtractGuidedSectionLib.h>\r
 #include <Library/BaseMemoryLib.h>\r
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/PcdLib.h>\r
-#include <Library/PeCoffLib.h>\r
-\r
+#include <Library/DebugAgentLib.h>\r
+#include <Library/PeiServicesTablePointerLib.h>\r
+#include <Library/PerformanceLib.h>\r
 \r
 #define STACK_SIZE      0x20000\r
 #define BSP_STORE_SIZE  0x4000\r
 \r
-#define GET_OCCUPIED_SIZE(ActualSize, Alignment) ((ActualSize + (Alignment - 1)) & ~(Alignment - 1))\r
+//\r
+// This PPI is installed to indicate the end of the PEI usage of memory\r
+//\r
+extern CONST EFI_PEI_PPI_DESCRIPTOR  gEndOfPeiSignalPpi;\r
 \r
-extern BOOLEAN gInMemory;\r
+/**\r
+   This function installs the PPIs that require permanent memory.\r
 \r
-EFI_STATUS\r
-PeiFindFile (\r
-  IN  UINT8                  Type,\r
-  IN  EFI_SECTION_TYPE       SectionType,\r
-  OUT EFI_GUID               *FileName,\r
-  OUT VOID                   **Pe32Data\r
-  )\r
-;\r
-\r
-EFI_STATUS\r
-PeiLoadFile (\r
-  IN  EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader,\r
-  IN  VOID                                      *Pe32Data,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *ImageAddress,\r
-  OUT UINT64                                    *ImageSize,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *EntryPoint\r
-  )\r
-;\r
-\r
-\r
-EFI_STATUS\r
-GetImageReadFunction (\r
-  IN      PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
-  )\r
-;\r
+   @param  PeiServices      Indirect reference to the PEI Services Table.\r
+   @param  NotifyDescriptor Address of the notification descriptor data structure.\r
+   @param  Ppi              Address of the PPI that was installed.\r
 \r
-EFI_STATUS\r
-PeiImageRead (\r
-  IN     VOID    *FileHandle,\r
-  IN     UINTN   FileOffset,\r
-  IN OUT UINTN   *ReadSize,\r
-  OUT    VOID    *Buffer\r
-  )\r
-;\r
+   @return EFI_SUCCESS      The PPIs were installed successfully.\r
+   @return Others           Some error occurs during the execution of this function.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-DxeIplLoadFile (\r
-  IN EFI_PEI_FV_FILE_LOADER_PPI                 *This,\r
-  IN  EFI_FFS_FILE_HEADER                       *FfsHeader,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *ImageAddress,\r
-  OUT UINT64                                    *ImageSize,\r
-  OUT EFI_PHYSICAL_ADDRESS                      *EntryPoint\r
+InstallIplPermanentMemoryPpis (\r
+  IN EFI_PEI_SERVICES           **PeiServices,\r
+  IN EFI_PEI_NOTIFY_DESCRIPTOR  *NotifyDescriptor,\r
+  IN VOID                       *Ppi\r
   );\r
 \r
-EFI_STATUS\r
-ShadowDxeIpl (\r
-  IN EFI_FFS_FILE_HEADER                       *DxeIpl,\r
-  IN EFI_PEI_PE_COFF_LOADER_PROTOCOL           *PeiEfiPeiPeCoffLoader\r
+/**\r
+   Searches DxeCore in all firmware Volumes and loads the first\r
+   instance that contains DxeCore.\r
+\r
+   @return FileHandle of DxeCore to load DxeCore.\r
+\r
+**/\r
+EFI_PEI_FILE_HANDLE\r
+DxeIplFindDxeCore (\r
+  VOID\r
   );\r
 \r
+/**\r
+   Main entry point to last PEIM\r
+\r
+   @param This          Entry point for DXE IPL PPI\r
+   @param PeiServices   General purpose services available to every PEIM.\r
+   @param HobList       Address to the Pei HOB list\r
+\r
+   @return EFI_SUCCESS              DXE core was successfully loaded.\r
+   @return EFI_OUT_OF_RESOURCES     There are not enough resources to load DXE core.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 DxeLoadCore (\r
-  IN EFI_DXE_IPL_PPI       *This,\r
-  IN EFI_PEI_SERVICES      **PeiServices,\r
-  IN EFI_PEI_HOB_POINTERS  HobList\r
+  IN CONST EFI_DXE_IPL_PPI  *This,\r
+  IN EFI_PEI_SERVICES       **PeiServices,\r
+  IN EFI_PEI_HOB_POINTERS   HobList\r
   );\r
 \r
+/**\r
+   Transfers control to DxeCore.\r
+\r
+   This function performs a CPU architecture specific operations to execute\r
+   the entry point of DxeCore with the parameters of HobList.\r
+   It also installs EFI_END_OF_PEI_PPI to signal the end of PEI phase.\r
+\r
+   @param DxeCoreEntryPoint         The entry point of DxeCore.\r
+   @param HobList                   The start of HobList passed to DxeCore.\r
+\r
+**/\r
 VOID\r
 HandOffToDxeCore (\r
-  IN EFI_PHYSICAL_ADDRESS   DxeCoreEntryPoint,\r
-  IN EFI_PEI_HOB_POINTERS   HobList,\r
-  IN EFI_PEI_PPI_DESCRIPTOR *EndOfPeiSignal\r
+  IN EFI_PHYSICAL_ADDRESS  DxeCoreEntryPoint,\r
+  IN EFI_PEI_HOB_POINTERS  HobList\r
   );\r
 \r
-EFI_STATUS\r
-PeiProcessFile (\r
-  IN      EFI_SECTION_TYPE       SectionType,\r
-  IN      EFI_FFS_FILE_HEADER    *FfsFileHeader,\r
-  OUT     VOID                   **Pe32Data,\r
-  IN      EFI_PEI_HOB_POINTERS   *OrigHob\r
+/**\r
+   Updates the Stack HOB passed to DXE phase.\r
+\r
+   This function traverses the whole HOB list and update the stack HOB to\r
+   reflect the real stack that is used by DXE core.\r
+\r
+   @param BaseAddress           The lower address of stack used by DxeCore.\r
+   @param Length                The length of stack used by DxeCore.\r
+\r
+**/\r
+VOID\r
+UpdateStackHob (\r
+  IN EFI_PHYSICAL_ADDRESS  BaseAddress,\r
+  IN UINT64                Length\r
   );\r
 \r
+/**\r
+  The ExtractSection() function processes the input section and\r
+  returns a pointer to the section contents. If the section being\r
+  extracted does not require processing (if the section\r
+  GuidedSectionHeader.Attributes has the\r
+  EFI_GUIDED_SECTION_PROCESSING_REQUIRED field cleared), then\r
+  OutputBuffer is just updated to point to the start of the\r
+  section's contents. Otherwise, *Buffer must be allocated\r
+  from PEI permanent memory.\r
+\r
+  @param This                   Indicates the\r
+                                EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI instance.\r
+                                Buffer containing the input GUIDed section to be\r
+                                processed. OutputBuffer OutputBuffer is\r
+                                allocated from PEI permanent memory and contains\r
+                                the new section stream.\r
+  @param InputSection           A pointer to the input buffer, which contains\r
+                                the input section to be processed.\r
+  @param OutputBuffer           A pointer to a caller-allocated buffer, whose\r
+                                size is specified by the contents of OutputSize.\r
+  @param OutputSize             A pointer to a caller-allocated\r
+                                UINTN in which the size of *OutputBuffer\r
+                                allocation is stored. If the function\r
+                                returns anything other than EFI_SUCCESS,\r
+                                the value of OutputSize is undefined.\r
+  @param AuthenticationStatus   A pointer to a caller-allocated\r
+                                UINT32 that indicates the\r
+                                authentication status of the\r
+                                output buffer. If the input\r
+                                section's GuidedSectionHeader.\r
+                                Attributes field has the\r
+                                EFI_GUIDED_SECTION_AUTH_STATUS_VALID\r
+                                bit as clear,\r
+                                AuthenticationStatus must return\r
+                                zero. These bits reflect the\r
+                                status of the extraction\r
+                                operation. If the function\r
+                                returns anything other than\r
+                                EFI_SUCCESS, the value of\r
+                                AuthenticationStatus is\r
+                                undefined.\r
+\r
+  @retval EFI_SUCCESS           The InputSection was\r
+                                successfully processed and the\r
+                                section contents were returned.\r
+\r
+  @retval EFI_OUT_OF_RESOURCES  The system has insufficient\r
+                                resources to process the request.\r
+\r
+  @retval EFI_INVALID_PARAMETER The GUID in InputSection does\r
+                                not match this instance of the\r
+                                GUIDed Section Extraction PPI.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
-PeimInitializeDxeIpl (\r
-  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r
-  IN EFI_PEI_SERVICES          **PeiServices\r
+CustomGuidedSectionExtract (\r
+  IN CONST  EFI_PEI_GUIDED_SECTION_EXTRACTION_PPI  *This,\r
+  IN CONST  VOID                                   *InputSection,\r
+  OUT       VOID                                   **OutputBuffer,\r
+  OUT       UINTN                                  *OutputSize,\r
+  OUT       UINT32                                 *AuthenticationStatus\r
   );\r
 \r
+/**\r
+   Decompresses a section to the output buffer.\r
+\r
+   This function looks up the compression type field in the input section and\r
+   applies the appropriate compression algorithm to compress the section to a\r
+   callee allocated buffer.\r
+\r
+   @param  This                  Points to this instance of the\r
+                                 EFI_PEI_DECOMPRESS_PEI PPI.\r
+   @param  CompressionSection    Points to the compressed section.\r
+   @param  OutputBuffer          Holds the returned pointer to the decompressed\r
+                                 sections.\r
+   @param  OutputSize            Holds the returned size of the decompress\r
+                                 section streams.\r
+\r
+   @retval EFI_SUCCESS           The section was decompressed successfully.\r
+                                 OutputBuffer contains the resulting data and\r
+                                 OutputSize contains the resulting size.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Decompress (\r
+  IN CONST  EFI_PEI_DECOMPRESS_PPI   *This,\r
+  IN CONST  EFI_COMPRESSION_SECTION  *CompressionSection,\r
+  OUT       VOID                     **OutputBuffer,\r
+  OUT       UINTN                    *OutputSize\r
+  );\r
 \r
 #endif\r