CpuService.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /** @file
  2. Include file for SMM CPU Services protocol implementation.
  3. Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _CPU_SERVICE_H_
  7. #define _CPU_SERVICE_H_
  8. typedef enum {
  9. SmmCpuNone,
  10. SmmCpuAdd,
  11. SmmCpuRemove,
  12. SmmCpuSwitchBsp
  13. } SMM_CPU_OPERATION;
  14. //
  15. // SMM CPU Service Protocol function prototypes.
  16. //
  17. /**
  18. Gets processor information on the requested processor at the instant this call is made.
  19. @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
  20. @param[in] ProcessorNumber The handle number of processor.
  21. @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
  22. the requested processor is deposited.
  23. @retval EFI_SUCCESS Processor information was returned.
  24. @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
  25. @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.
  26. @retval EFI_NOT_FOUND The processor with the handle specified by
  27. ProcessorNumber does not exist in the platform.
  28. **/
  29. EFI_STATUS
  30. EFIAPI
  31. SmmGetProcessorInfo (
  32. IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,
  33. IN UINTN ProcessorNumber,
  34. OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer
  35. );
  36. /**
  37. This service switches the requested AP to be the BSP since the next SMI.
  38. @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
  39. @param[in] ProcessorNumber The handle number of AP that is to become the new BSP.
  40. @retval EFI_SUCCESS BSP will be switched in next SMI.
  41. @retval EFI_UNSUPPORTED Switching the BSP or a processor to be hot-removed is not supported.
  42. @retval EFI_NOT_FOUND The processor with the handle specified by ProcessorNumber does not exist.
  43. @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.
  44. **/
  45. EFI_STATUS
  46. EFIAPI
  47. SmmSwitchBsp (
  48. IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,
  49. IN UINTN ProcessorNumber
  50. );
  51. /**
  52. Notify that a processor was hot-added.
  53. @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
  54. @param[in] ProcessorId Local APIC ID of the hot-added processor.
  55. @param[out] ProcessorNumber The handle number of the hot-added processor.
  56. @retval EFI_SUCCESS The hot-addition of the specified processors was successfully notified.
  57. @retval EFI_UNSUPPORTED Hot addition of processor is not supported.
  58. @retval EFI_NOT_FOUND The processor with the handle specified by ProcessorNumber does not exist.
  59. @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.
  60. @retval EFI_ALREADY_STARTED The processor is already online in the system.
  61. **/
  62. EFI_STATUS
  63. EFIAPI
  64. SmmAddProcessor (
  65. IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,
  66. IN UINT64 ProcessorId,
  67. OUT UINTN *ProcessorNumber
  68. );
  69. /**
  70. Notify that a processor was hot-removed.
  71. @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
  72. @param[in] ProcessorNumber The handle number of the hot-added processor.
  73. @retval EFI_SUCCESS The hot-removal of the specified processors was successfully notified.
  74. @retval EFI_UNSUPPORTED Hot removal of processor is not supported.
  75. @retval EFI_UNSUPPORTED Hot removal of BSP is not supported.
  76. @retval EFI_UNSUPPORTED Hot removal of a processor with pending hot-plug operation is not supported.
  77. @retval EFI_INVALID_PARAMETER ProcessorNumber is invalid.
  78. **/
  79. EFI_STATUS
  80. EFIAPI
  81. SmmRemoveProcessor (
  82. IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,
  83. IN UINTN ProcessorNumber
  84. );
  85. /**
  86. This return the handle number for the calling processor.
  87. @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
  88. @param[out] ProcessorNumber The handle number of currently executing processor.
  89. @retval EFI_SUCCESS The current processor handle number was returned
  90. in ProcessorNumber.
  91. @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
  92. **/
  93. EFI_STATUS
  94. EFIAPI
  95. SmmWhoAmI (
  96. IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,
  97. OUT UINTN *ProcessorNumber
  98. );
  99. /**
  100. Register exception handler.
  101. @param This A pointer to the SMM_CPU_SERVICE_PROTOCOL instance.
  102. @param ExceptionType Defines which interrupt or exception to hook. Type EFI_EXCEPTION_TYPE and
  103. the valid values for this parameter are defined in EFI_DEBUG_SUPPORT_PROTOCOL
  104. of the UEFI 2.0 specification.
  105. @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER
  106. that is called when a processor interrupt occurs.
  107. If this parameter is NULL, then the handler will be uninstalled.
  108. @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
  109. @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was previously installed.
  110. @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not previously installed.
  111. @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
  112. **/
  113. EFI_STATUS
  114. EFIAPI
  115. SmmRegisterExceptionHandler (
  116. IN EFI_SMM_CPU_SERVICE_PROTOCOL *This,
  117. IN EFI_EXCEPTION_TYPE ExceptionType,
  118. IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
  119. );
  120. //
  121. // Internal function prototypes
  122. //
  123. /**
  124. Update the SMM CPU list per the pending operation.
  125. This function is called after return from SMI handlers.
  126. **/
  127. VOID
  128. SmmCpuUpdate (
  129. VOID
  130. );
  131. /**
  132. Initialize SMM CPU Services.
  133. It installs EFI SMM CPU Services Protocol.
  134. @param ImageHandle The firmware allocated handle for the EFI image.
  135. @retval EFI_SUCCESS EFI SMM CPU Services Protocol was installed successfully.
  136. **/
  137. EFI_STATUS
  138. InitializeSmmCpuServices (
  139. IN EFI_HANDLE Handle
  140. );
  141. #endif