Platform.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /*++
  2. Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. **/
  5. #ifndef __PEI_PLATFORM_H__
  6. #define __PEI_PLATFORM_H__
  7. #define PEI_STALL_RESOLUTION 1
  8. #define STALL_PEIM_SIGNATURE SIGNATURE_32('p','p','u','s')
  9. typedef struct {
  10. UINT32 Signature;
  11. EFI_FFS_FILE_HEADER *FfsHeader;
  12. EFI_PEI_NOTIFY_DESCRIPTOR StallNotify;
  13. } STALL_CALLBACK_STATE_INFORMATION;
  14. #define STALL_PEIM_FROM_THIS(a) CR (a, STALL_CALLBACK_STATE_INFORMATION, StallNotify, STALL_PEIM_SIGNATURE)
  15. /**
  16. Peform the boot mode determination logic
  17. If the box is closed, then
  18. 1. If it's first time to boot, it's boot with full config .
  19. 2. If the ChassisIntrution is selected, force to be a boot with full config
  20. 3. Otherwise it's boot with no change.
  21. @param PeiServices General purpose services available to every PEIM.
  22. @param BootMode The detected boot mode.
  23. @retval EFI_SUCCESS if the boot mode could be set
  24. **/
  25. EFI_STATUS
  26. UpdateBootMode (
  27. IN CONST EFI_PEI_SERVICES **PeiServices
  28. );
  29. /**
  30. This function reset the entire platform, including all processor and devices, and
  31. reboots the system.
  32. Declaration of this function goes to MdeModulePkg/Include/Library/ResetSystemLib.h
  33. @param PeiServices General purpose services available to every PEIM.
  34. @retval EFI_SUCCESS if it completed successfully.
  35. **/
  36. // EFI_STATUS
  37. // EFIAPI
  38. // ResetSystem (
  39. // IN CONST EFI_PEI_SERVICES **PeiServices
  40. // );
  41. /**
  42. This function will be called when MRC is done.
  43. @param PeiServices General purpose services available to every PEIM.
  44. @param NotifyDescriptor Information about the notify event..
  45. @param Ppi The notify context.
  46. @retval EFI_SUCCESS If the function completed successfully.
  47. **/
  48. EFI_STATUS
  49. EFIAPI
  50. MemoryDiscoveredPpiNotifyCallback (
  51. IN EFI_PEI_SERVICES **PeiServices,
  52. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
  53. IN VOID *Ppi
  54. );
  55. /**
  56. This is the callback function notified by FvFileLoader PPI, it depends on FvFileLoader PPI to load
  57. the PEIM into memory.
  58. @param PeiServices General purpose services available to every PEIM.
  59. @param NotifyDescriptor The context of notification.
  60. @param Ppi The notify PPI.
  61. @retval EFI_SUCCESS if it completed successfully.
  62. **/
  63. EFI_STATUS
  64. EFIAPI
  65. FvFileLoaderPpiNotifyCallback (
  66. IN EFI_PEI_SERVICES **PeiServices,
  67. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
  68. IN VOID *Ppi
  69. );
  70. /**
  71. This function provides a blocking stall for reset at least the given number of microseconds
  72. stipulated in the final argument.
  73. @param PeiServices General purpose services available to every PEIM.
  74. @param this Pointer to the local data for the interface.
  75. @param Microseconds number of microseconds for which to stall.
  76. @retval EFI_SUCCESS the function provided at least the required stall.
  77. **/
  78. EFI_STATUS
  79. EFIAPI
  80. Stall (
  81. IN CONST EFI_PEI_SERVICES **PeiServices,
  82. IN CONST EFI_PEI_STALL_PPI *This,
  83. IN UINTN Microseconds
  84. );
  85. /**
  86. This function initialize recovery functionality by installing the recovery PPI.
  87. @param PeiServices General purpose services available to every PEIM.
  88. @retval EFI_SUCCESS If the interface could be successfully installed.
  89. **/
  90. EFI_STATUS
  91. EFIAPI
  92. InitializeRecovery (
  93. IN EFI_PEI_SERVICES **PeiServices
  94. );
  95. /**
  96. This function
  97. 1. Calling MRC to initialize memory.
  98. 2. Install EFI Memory.
  99. 3. Capsule coalesce if capsule boot mode.
  100. 4. Create HOB of system memory.
  101. @param PeiServices Pointer to the PEI Service Table
  102. @retval EFI_SUCCESS If it completes successfully.
  103. **/
  104. EFI_STATUS
  105. MemoryInit (
  106. IN EFI_PEI_SERVICES **PeiServices
  107. );
  108. /**
  109. This function provides the implementation of AtaController PPI Enable Channel function.
  110. @param PeiServices General purpose services available to every PEIM.
  111. @param this Pointer to the local data for the interface.
  112. @param ChannelMask This parameter is used to specify primary or slavery IDE channel.
  113. @retval EFI_SUCCESS Procedure returned successfully.
  114. **/
  115. EFI_STATUS
  116. EnableAtaChannel (
  117. IN EFI_PEI_SERVICES **PeiServices,
  118. IN PEI_ATA_CONTROLLER_PPI *This,
  119. IN UINT8 ChannelMask
  120. );
  121. /**
  122. This function provides the implementation of AtaController PPI Get IDE channel Register Base Address
  123. @param PeiServices General purpose services available to every PEIM.
  124. @param this Pointer to the local data for the interface.
  125. @param IdeRegsBaseAddr Pointer to IDE_REGS_BASE_ADDR struct, which is used to record
  126. IDE Command and Control regeisters Base Address.
  127. @retval EFI_SUCCESS Procedure returned successfully.
  128. **/
  129. EFI_STATUS
  130. GetIdeRegsBaseAddr (
  131. IN EFI_PEI_SERVICES **PeiServices,
  132. IN PEI_ATA_CONTROLLER_PPI *This,
  133. IN IDE_REGS_BASE_ADDR *IdeRegsBaseAddr
  134. );
  135. /**
  136. This function provides the implementation to properly setup both LM & PDM functionality.
  137. @param PeiServices General purpose services available to every PEIM.
  138. @retval EFI_SUCCESS Procedure returned successfully.
  139. **/
  140. EFI_STATUS
  141. ConfigureLM(
  142. IN EFI_PEI_SERVICES **PeiServices
  143. );
  144. #include <Ppi/VlvMmioPolicy.h>
  145. BOOLEAN
  146. EFIAPI
  147. IsFastBootEnabled (
  148. IN CONST EFI_PEI_SERVICES **PeiServices
  149. );
  150. EFI_STATUS
  151. PrioritizeBootMode (
  152. IN OUT EFI_BOOT_MODE *CurrentBootMode,
  153. IN EFI_BOOT_MODE NewBootMode
  154. );
  155. EFI_STATUS
  156. EFIAPI
  157. CapsulePpiNotifyCallback (
  158. IN EFI_PEI_SERVICES **PeiServices,
  159. IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
  160. IN VOID *Ppi
  161. );
  162. #endif