SecMain.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /** @file
  2. Master header file for SecCore.
  3. Copyright (c) 2008 - 2019, 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/SecPlatformInformation2.h>
  10. #include <Ppi/TemporaryRamDone.h>
  11. #include <Ppi/SecPerformance.h>
  12. #include <Ppi/PeiCoreFvLocation.h>
  13. #include <Ppi/RepublishSecPpi.h>
  14. #include <Guid/FirmwarePerformance.h>
  15. #include <Library/DebugLib.h>
  16. #include <Library/PcdLib.h>
  17. #include <Library/BaseMemoryLib.h>
  18. #include <Library/PlatformSecLib.h>
  19. #include <Library/CpuLib.h>
  20. #include <Library/UefiCpuLib.h>
  21. #include <Library/PeCoffGetEntryPointLib.h>
  22. #include <Library/PeCoffExtraActionLib.h>
  23. #include <Library/DebugAgentLib.h>
  24. #include <Library/CpuExceptionHandlerLib.h>
  25. #include <Library/ReportStatusCodeLib.h>
  26. #include <Library/PeiServicesTablePointerLib.h>
  27. #include <Library/HobLib.h>
  28. #include <Library/PeiServicesLib.h>
  29. #define SEC_IDT_ENTRY_COUNT 34
  30. typedef struct _SEC_IDT_TABLE {
  31. //
  32. // Reserved 8 bytes preceding IDT to store EFI_PEI_SERVICES**, since IDT base
  33. // address should be 8-byte alignment.
  34. // Note: For IA32, only the 4 bytes immediately preceding IDT is used to store
  35. // EFI_PEI_SERVICES**
  36. //
  37. UINT64 PeiService;
  38. IA32_IDT_GATE_DESCRIPTOR IdtTable[SEC_IDT_ENTRY_COUNT];
  39. } SEC_IDT_TABLE;
  40. /**
  41. TemporaryRamDone() disables the use of Temporary RAM. If present, this service is invoked
  42. by the PEI Foundation after the EFI_PEI_PERMANANT_MEMORY_INSTALLED_PPI is installed.
  43. @retval EFI_SUCCESS Use of Temporary RAM was disabled.
  44. @retval EFI_INVALID_PARAMETER Temporary RAM could not be disabled.
  45. **/
  46. EFI_STATUS
  47. EFIAPI
  48. SecTemporaryRamDone (
  49. VOID
  50. );
  51. /**
  52. Entry point to the C language phase of SEC. After the SEC assembly
  53. code has initialized some temporary memory and set up the stack,
  54. the control is transferred to this function.
  55. @param SizeOfRam Size of the temporary memory available for use.
  56. @param TempRamBase Base address of temporary ram
  57. @param BootFirmwareVolume Base address of the Boot Firmware Volume.
  58. **/
  59. VOID
  60. NORETURN
  61. EFIAPI
  62. SecStartup (
  63. IN UINT32 SizeOfRam,
  64. IN UINT32 TempRamBase,
  65. IN VOID *BootFirmwareVolume
  66. );
  67. /**
  68. Find and return Pei Core entry point.
  69. It also find SEC and PEI Core file debug information. It will report them if
  70. remote debug is enabled.
  71. @param SecCoreFirmwareVolumePtr Point to the firmware volume for finding SecCore.
  72. @param PeiCoreFirmwareVolumePtr Point to the firmware volume for finding PeiCore.
  73. @param PeiCoreEntryPoint The entry point of the PEI core.
  74. **/
  75. VOID
  76. EFIAPI
  77. FindAndReportEntryPoints (
  78. IN EFI_FIRMWARE_VOLUME_HEADER *SecCoreFirmwareVolumePtr,
  79. IN EFI_FIRMWARE_VOLUME_HEADER *PeiCoreFirmwareVolumePtr,
  80. OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint
  81. );
  82. /**
  83. Auto-generated function that calls the library constructors for all of the module's
  84. dependent libraries. This function must be called by the SEC Core once a stack has
  85. been established.
  86. **/
  87. VOID
  88. EFIAPI
  89. ProcessLibraryConstructorList (
  90. VOID
  91. );
  92. /**
  93. Implementation of the PlatformInformation service in EFI_SEC_PLATFORM_INFORMATION_PPI.
  94. @param PeiServices Pointer to the PEI Services Table.
  95. @param StructureSize Pointer to the variable describing size of the input buffer.
  96. @param PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
  97. @retval EFI_SUCCESS The data was successfully returned.
  98. @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
  99. **/
  100. EFI_STATUS
  101. EFIAPI
  102. SecPlatformInformationBist (
  103. IN CONST EFI_PEI_SERVICES **PeiServices,
  104. IN OUT UINT64 *StructureSize,
  105. OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
  106. );
  107. /**
  108. Implementation of the PlatformInformation2 service in EFI_SEC_PLATFORM_INFORMATION2_PPI.
  109. @param PeiServices The pointer to the PEI Services Table.
  110. @param StructureSize The pointer to the variable describing size of the input buffer.
  111. @param PlatformInformationRecord2 The pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD2.
  112. @retval EFI_SUCCESS The data was successfully returned.
  113. @retval EFI_BUFFER_TOO_SMALL The buffer was too small. The current buffer size needed to
  114. hold the record is returned in StructureSize.
  115. **/
  116. EFI_STATUS
  117. EFIAPI
  118. SecPlatformInformation2Bist (
  119. IN CONST EFI_PEI_SERVICES **PeiServices,
  120. IN OUT UINT64 *StructureSize,
  121. OUT EFI_SEC_PLATFORM_INFORMATION_RECORD2 *PlatformInformationRecord2
  122. );
  123. /**
  124. Republish SecPlatformInformationPpi/SecPlatformInformation2Ppi.
  125. **/
  126. VOID
  127. RepublishSecPlatformInformationPpi (
  128. VOID
  129. );
  130. /**
  131. Entry point of the notification callback function itself within the PEIM.
  132. It is to get SEC performance data and build HOB to convey the SEC performance
  133. data to DXE phase.
  134. @param PeiServices Indirect reference to the PEI Services Table.
  135. @param NotifyDescriptor Address of the notification descriptor data structure.
  136. @param Ppi Address of the PPI that was installed.
  137. @return Status of the notification.
  138. The status code returned from this function is ignored.
  139. **/
  140. EFI_STATUS
  141. EFIAPI
  142. SecPerformancePpiCallBack (
  143. IN EFI_PEI_SERVICES **PeiServices,
  144. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
  145. IN VOID *Ppi
  146. );
  147. #endif