FspPlatformSecLibVlv2.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /** @file
  2. Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #include <PiPei.h>
  6. #include <Ppi/SecPlatformInformation.h>
  7. #include <Ppi/SecPerformance.h>
  8. #include <Ppi/TemporaryRamSupport.h>
  9. #include <Library/LocalApicLib.h>
  10. /**
  11. This interface conveys state information out of the Security (SEC) phase into PEI.
  12. @param PeiServices Pointer to the PEI Services Table.
  13. @param StructureSize Pointer to the variable describing size of the input buffer.
  14. @param PlatformInformationRecord Pointer to the EFI_SEC_PLATFORM_INFORMATION_RECORD.
  15. @retval EFI_SUCCESS The data was successfully returned.
  16. @retval EFI_BUFFER_TOO_SMALL The buffer was too small.
  17. **/
  18. EFI_STATUS
  19. EFIAPI
  20. SecPlatformInformation (
  21. IN CONST EFI_PEI_SERVICES **PeiServices,
  22. IN OUT UINT64 *StructureSize,
  23. OUT EFI_SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
  24. );
  25. /**
  26. This interface conveys performance information out of the Security (SEC) phase into PEI.
  27. This service is published by the SEC phase. The SEC phase handoff has an optional
  28. EFI_PEI_PPI_DESCRIPTOR list as its final argument when control is passed from SEC into the
  29. PEI Foundation. As such, if the platform supports collecting performance data in SEC,
  30. this information is encapsulated into the data structure abstracted by this service.
  31. This information is collected for the boot-strap processor (BSP) on IA-32.
  32. @param[in] PeiServices The pointer to the PEI Services Table.
  33. @param[in] This The pointer to this instance of the PEI_SEC_PERFORMANCE_PPI.
  34. @param[out] Performance The pointer to performance data collected in SEC phase.
  35. @retval EFI_SUCCESS The data was successfully returned.
  36. **/
  37. EFI_STATUS
  38. EFIAPI
  39. SecGetPerformance (
  40. IN CONST EFI_PEI_SERVICES **PeiServices,
  41. IN PEI_SEC_PERFORMANCE_PPI *This,
  42. OUT FIRMWARE_SEC_PERFORMANCE *Performance
  43. );
  44. /**
  45. This service of the TEMPORARY_RAM_SUPPORT_PPI that migrates temporary RAM into
  46. permanent memory.
  47. @param PeiServices Pointer to the PEI Services Table.
  48. @param TemporaryMemoryBase Source Address in temporary memory from which the SEC or PEIM will copy the
  49. Temporary RAM contents.
  50. @param PermanentMemoryBase Destination Address in permanent memory into which the SEC or PEIM will copy the
  51. Temporary RAM contents.
  52. @param CopySize Amount of memory to migrate from temporary to permanent memory.
  53. @retval EFI_SUCCESS The data was successfully returned.
  54. @retval EFI_INVALID_PARAMETER PermanentMemoryBase + CopySize > TemporaryMemoryBase when
  55. TemporaryMemoryBase > PermanentMemoryBase.
  56. **/
  57. EFI_STATUS
  58. EFIAPI
  59. SecTemporaryRamSupport (
  60. IN CONST EFI_PEI_SERVICES **PeiServices,
  61. IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
  62. IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
  63. IN UINTN CopySize
  64. );
  65. EFI_SEC_PLATFORM_INFORMATION_PPI mSecPlatformInformationPpi = {
  66. SecPlatformInformation
  67. };
  68. PEI_SEC_PERFORMANCE_PPI mSecPerformancePpi = {
  69. SecGetPerformance
  70. };
  71. EFI_PEI_TEMPORARY_RAM_SUPPORT_PPI gSecTemporaryRamSupportPpi = {
  72. SecTemporaryRamSupport
  73. };
  74. EFI_PEI_PPI_DESCRIPTOR mPeiSecPlatformPpi[] = {
  75. {
  76. EFI_PEI_PPI_DESCRIPTOR_PPI,
  77. &gEfiSecPlatformInformationPpiGuid,
  78. &mSecPlatformInformationPpi
  79. },
  80. {
  81. EFI_PEI_PPI_DESCRIPTOR_PPI,
  82. &gPeiSecPerformancePpiGuid,
  83. &mSecPerformancePpi
  84. },
  85. {
  86. EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,
  87. &gEfiTemporaryRamSupportPpiGuid,
  88. &gSecTemporaryRamSupportPpi
  89. },
  90. };
  91. /**
  92. A developer supplied function to perform platform specific operations.
  93. It's a developer supplied function to perform any operations appropriate to a
  94. given platform. It's invoked just before passing control to PEI core by SEC
  95. core. Platform developer may modify the SecCoreData passed to PEI Core.
  96. It returns a platform specific PPI list that platform wishes to pass to PEI core.
  97. The Generic SEC core module will merge this list to join the final list passed to
  98. PEI core.
  99. @param SecCoreData The same parameter as passing to PEI core. It
  100. could be overridden by this function.
  101. @return The platform specific PPI list to be passed to PEI core or
  102. NULL if there is no need of such platform specific PPI list.
  103. **/
  104. EFI_PEI_PPI_DESCRIPTOR *
  105. EFIAPI
  106. SecPlatformMain (
  107. IN OUT EFI_SEC_PEI_HAND_OFF *SecCoreData
  108. )
  109. {
  110. EFI_PEI_PPI_DESCRIPTOR *PpiList;
  111. InitializeApicTimer (0, (UINT32) -1, TRUE, 5);
  112. PpiList = &mPeiSecPlatformPpi[0];
  113. return PpiList;
  114. }