SecMain.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /** @file
  2. Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #ifndef _SEC_CORE_H_
  6. #define _SEC_CORE_H_
  7. #include <PiPei.h>
  8. #include <Ppi/TemporaryRamSupport.h>
  9. #include <Library/BaseLib.h>
  10. #include <Library/IoLib.h>
  11. #include <Library/DebugLib.h>
  12. #include <Library/PcdLib.h>
  13. #include <Library/BaseMemoryLib.h>
  14. #include <Library/PciCf8Lib.h>
  15. #include <Library/SerialPortLib.h>
  16. #include <Library/FspSwitchStackLib.h>
  17. #include <Library/FspCommonLib.h>
  18. #include <FspApi.h>
  19. #define SEC_IDT_ENTRY_COUNT 34
  20. typedef VOID (*PEI_CORE_ENTRY) ( \
  21. IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData, \
  22. IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList \
  23. );
  24. typedef struct _SEC_IDT_TABLE {
  25. EFI_PEI_SERVICES *PeiService;
  26. UINT64 IdtTable[SEC_IDT_ENTRY_COUNT];
  27. } SEC_IDT_TABLE;
  28. /**
  29. Switch the stack in the temporary memory to the one in the permanent memory.
  30. This function must be invoked after the memory migration immediately. The relative
  31. position of the stack in the temporary and permanent memory is same.
  32. @param[in] TemporaryMemoryBase Base address of the temporary memory.
  33. @param[in] PermenentMemoryBase Base address of the permanent memory.
  34. **/
  35. VOID
  36. EFIAPI
  37. SecSwitchStack (
  38. IN UINT32 TemporaryMemoryBase,
  39. IN UINT32 PermenentMemoryBase
  40. );
  41. /**
  42. This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
  43. permanent memory.
  44. @param[in] PeiServices Pointer to the PEI Services Table.
  45. @param[in] TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
  46. Temporary RAM contents.
  47. @param[in] PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
  48. Temporary RAM contents.
  49. @param[in] CopySize Amount of memory to migrate from temporary to permanent memory.
  50. @retval EFI_SUCCESS The data was successfully returned.
  51. @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
  52. TemporaryMemoryBase > PermanentMemoryBase.
  53. **/
  54. EFI_STATUS
  55. EFIAPI
  56. SecTemporaryRamSupport (
  57. IN CONST EFI_PEI_SERVICES **PeiServices,
  58. IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
  59. IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
  60. IN UINTN CopySize
  61. );
  62. /**
  63. Initializes floating point units for requirement of UEFI specification.
  64. This function initializes floating-point control word to 0x027F (all exceptions
  65. masked,double-precision, round-to-nearest) and multimedia-extensions control word
  66. (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to zero
  67. for masked underflow).
  68. **/
  69. VOID
  70. EFIAPI
  71. InitializeFloatingPointUnits (
  72. VOID
  73. );
  74. /**
  75. Entry point to the C language phase of SEC. After the SEC assembly
  76. code has initialized some temporary memory and set up the stack,
  77. the control is transferred to this function.
  78. @param[in] SizeOfRam Size of the temporary memory available for use.
  79. @param[in] TempRamBase Base address of temporary ram
  80. @param[in] BootFirmwareVolume Base address of the Boot Firmware Volume.
  81. @param[in] PeiCore PeiCore entry point.
  82. @param[in] BootLoaderStack BootLoader stack.
  83. @param[in] ApiIdx the index of API.
  84. @return This function never returns.
  85. **/
  86. VOID
  87. EFIAPI
  88. SecStartup (
  89. IN UINT32 SizeOfRam,
  90. IN UINT32 TempRamBase,
  91. IN VOID *BootFirmwareVolume,
  92. IN PEI_CORE_ENTRY PeiCore,
  93. IN UINT32 BootLoaderStack,
  94. IN UINT32 ApiIdx
  95. );
  96. /**
  97. Autogenerated function that calls the library constructors for all of the module's
  98. dependent libraries. This function must be called by the SEC Core once a stack has
  99. been established.
  100. **/
  101. VOID
  102. EFIAPI
  103. ProcessLibraryConstructorList (
  104. VOID
  105. );
  106. #endif