SecMain.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /** @file
  2. Master header file for SecCore.
  3. Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _SEC_CORE_H_
  7. #define _SEC_CORE_H_
  8. #include <PiPei.h>
  9. #include <Ppi/SecPlatformInformation.h>
  10. #include <Ppi/TemporaryRamSupport.h>
  11. #include <Library/BaseLib.h>
  12. #include <Library/DebugLib.h>
  13. #include <Library/PcdLib.h>
  14. #include <Library/BaseMemoryLib.h>
  15. #include <Library/UefiCpuLib.h>
  16. #include <Library/PeCoffGetEntryPointLib.h>
  17. #include <Library/PeCoffExtraActionLib.h>
  18. #include <Library/DebugAgentLib.h>
  19. #define SEC_IDT_ENTRY_COUNT 34
  20. typedef struct _SEC_IDT_TABLE {
  21. //
  22. // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base
  23. // address should be 8-byte alignment.
  24. // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store
  25. // EFI_PEI_SERVICES**
  26. //
  27. UINT64 PeiService;
  28. UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];
  29. } SEC_IDT_TABLE;
  30. /**
  31. Switch the stack in the temporary memory to the one in the permanent memory.
  32. This function must be invoked after the memory migration immediately. The relative
  33. position of the stack in the temporary and permanent memory is same.
  34. @param TemporaryMemoryBase Base address of the temporary memory.
  35. @param PermenentMemoryBase Base address of the permanent memory.
  36. **/
  37. VOID
  38. EFIAPI
  39. SecSwitchStack (
  40. UINT32 TemporaryMemoryBase,
  41. UINT32 PermenentMemoryBase
  42. );
  43. /**
  44. This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
  45. permanent memory.
  46. @param PeiServices Pointer to the PEI Services Table.
  47. @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
  48. Temporary RAM contents.
  49. @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
  50. Temporary RAM contents.
  51. @param CopySize Amount of memory to migrate from temporary to permanent memory.
  52. @retval EFI_SUCCESS The data was successfully returned.
  53. @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
  54. TemporaryMemoryBase > PermanentMemoryBase.
  55. **/
  56. EFI_STATUS
  57. EFIAPI
  58. SecTemporaryRamSupport (
  59. IN CONST EFI_PEI_SERVICES **PeiServices,
  60. IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
  61. IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
  62. IN UINTN CopySize
  63. );
  64. /**
  65. Entry point to the C language phase of SEC. After the SEC assembly
  66. code has initialized some temporary memory and set up the stack,
  67. the control is transferred to this function.
  68. @param SizeOfRam Size of the temporary memory available for use.
  69. @param TempRamBase Base address of temporary ram
  70. @param BootFirmwareVolume Base address of the Boot Firmware Volume.
  71. **/
  72. VOID
  73. EFIAPI
  74. SecStartup (
  75. IN UINT32 SizeOfRam,
  76. IN UINT32 TempRamBase,
  77. IN VOID *BootFirmwareVolume
  78. );
  79. /**
  80. Find and return Pei Core entry point.
  81. It also find SEC and PEI Core file debug information. It will report them if
  82. remote debug is enabled.
  83. @param BootFirmwareVolumePtr Point to the boot firmware volume.
  84. @param PeiCoreEntryPoint Point to the PEI core entry point.
  85. **/
  86. VOID
  87. EFIAPI
  88. FindAndReportEntryPoints (
  89. IN EFI_FIRMWARE_VOLUME_HEADER *BootFirmwareVolumePtr,
  90. OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint
  91. );
  92. /**
  93. Autogenerated function that calls the library constructors for all of the module's
  94. dependent libraries. This function must be called by the SEC Core once a stack has
  95. been established.
  96. **/
  97. VOID
  98. EFIAPI
  99. ProcessLibraryConstructorList (
  100. VOID
  101. );
  102. #endif