]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CorebootModulePkg/SecCore/SecMain.h
Pkg-Module: CorebootModulePkg
[mirror_edk2.git] / CorebootModulePkg / SecCore / SecMain.h
diff --git a/CorebootModulePkg/SecCore/SecMain.h b/CorebootModulePkg/SecCore/SecMain.h
new file mode 100644 (file)
index 0000000..7bc991a
--- /dev/null
@@ -0,0 +1,134 @@
+/** @file\r
+  Master header file for SecCore.\r
+\r
+Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r
+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
+\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
+**/\r
+\r
+#ifndef _SEC_CORE_H_\r
+#define _SEC_CORE_H_\r
+\r
+\r
+#include <PiPei.h>\r
+\r
+#include <Ppi/SecPlatformInformation.h>\r
+#include <Ppi/TemporaryRamSupport.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/UefiCpuLib.h>\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/PeCoffExtraActionLib.h>\r
+#include <Library/DebugAgentLib.h>\r
+\r
+\r
+#define SEC_IDT_ENTRY_COUNT  34\r
+\r
+typedef struct _SEC_IDT_TABLE {\r
+  //\r
+  // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base\r
+  // address should be 8-byte alignment.\r
+  // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store\r
+  // EFI_PEI_SERVICES**\r
+  //\r
+  UINT64            PeiService;  \r
+  UINT64            IdtTable[SEC_IDT_ENTRY_COUNT];\r
+} SEC_IDT_TABLE;\r
+\r
+/**\r
+  Switch the stack in the temporary memory to the one in the permanent memory.\r
+\r
+  This function must be invoked after the memory migration immediately. The relative\r
+  position of the stack in the temporary and permanent memory is same.\r
+\r
+  @param TemporaryMemoryBase  Base address of the temporary memory.\r
+  @param PermenentMemoryBase  Base address of the permanent memory.\r
+**/\r
+VOID\r
+EFIAPI\r
+SecSwitchStack (\r
+  UINT32   TemporaryMemoryBase,\r
+  UINT32   PermenentMemoryBase\r
+  );\r
+\r
+/**\r
+  This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into\r
+  permanent memory.\r
+\r
+  @param PeiServices            Pointer to the PEI Services Table.\r
+  @param TemporaryMemoryBase    Source Address in temporary memory from which the SEC or PEIM will copy the\r
+                                Temporary RAM contents.\r
+  @param PermanentMemoryBase    Destination Address in permanent memory into which the SEC or PEIM will copy the\r
+                                Temporary RAM contents.\r
+  @param CopySize               Amount of memory to migrate from temporary to permanent memory.\r
+\r
+  @retval EFI_SUCCESS           The data was successfully returned.\r
+  @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when\r
+                                TemporaryMemoryBase > PermanentMemoryBase.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SecTemporaryRamSupport (\r
+  IN CONST EFI_PEI_SERVICES   **PeiServices,\r
+  IN EFI_PHYSICAL_ADDRESS     TemporaryMemoryBase,\r
+  IN EFI_PHYSICAL_ADDRESS     PermanentMemoryBase,\r
+  IN UINTN                    CopySize\r
+  );\r
+\r
+/**\r
+  Entry point to the C language phase of SEC. After the SEC assembly\r
+  code has initialized some temporary memory and set up the stack,\r
+  the control is transferred to this function.\r
+\r
+  @param SizeOfRam           Size of the temporary memory available for use.\r
+  @param TempRamBase         Base address of tempory ram\r
+  @param BootFirmwareVolume  Base address of the Boot Firmware Volume.\r
+**/\r
+VOID\r
+EFIAPI\r
+SecStartup (\r
+  IN UINT32                   SizeOfRam,\r
+  IN UINT32                   TempRamBase,\r
+  IN VOID                     *BootFirmwareVolume\r
+  );\r
+\r
+/**\r
+  Find and return Pei Core entry point.\r
+\r
+  It also find SEC and PEI Core file debug inforamtion. It will report them if\r
+  remote debug is enabled.\r
+\r
+  @param  BootFirmwareVolumePtr  Point to the boot firmware volume.\r
+  @param  PeiCoreEntryPoint      Point to the PEI core entry point.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+FindAndReportEntryPoints (\r
+  IN  EFI_FIRMWARE_VOLUME_HEADER       *BootFirmwareVolumePtr,\r
+  OUT EFI_PEI_CORE_ENTRY_POINT         *PeiCoreEntryPoint\r
+  );\r
+\r
+/**\r
+  Autogenerated function that calls the library constructors for all of the module's\r
+  dependent libraries.  This function must be called by the SEC Core once a stack has\r
+  been established.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+ProcessLibraryConstructorList (\r
+  VOID\r
+  );\r
+  \r
+#endif\r