2 SMM CPU Service protocol definition.
4 Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #ifndef _SMM_CPU_SERVICE_PROTOCOL_H_
10 #define _SMM_CPU_SERVICE_PROTOCOL_H_
13 // Share some definitions with MP Services and CPU Arch Protocol
15 #include <Protocol/MpService.h>
16 #include <Protocol/Cpu.h>
18 #define EFI_SMM_CPU_SERVICE_PROTOCOL_GUID \
20 0x1d202cab, 0xc8ab, 0x4d5c, { 0x94, 0xf7, 0x3c, 0xfc, 0xc0, 0xd3, 0xd3, 0x35 } \
23 typedef struct _EFI_SMM_CPU_SERVICE_PROTOCOL EFI_SMM_CPU_SERVICE_PROTOCOL
;
30 Gets processor information on the requested processor at the
31 instant this call is made. This service may only be called from the BSP.
33 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL
35 @param[in] ProcessorNumber The handle number of processor.
36 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for
37 the requested processor is deposited.
39 @retval EFI_SUCCESS Processor information was returned.
40 @retval EFI_DEVICE_ERROR The calling processor is an AP.
41 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.
42 @retval EFI_NOT_FOUND The processor with the handle specified by
43 ProcessorNumber does not exist in the platform.
47 (EFIAPI
* EFI_SMM_GET_PROCESSOR_INFO
) (
48 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL
*This
,
49 IN UINTN ProcessorNumber
,
50 OUT EFI_PROCESSOR_INFORMATION
*ProcessorInfoBuffer
54 This service switches the requested AP to be the BSP from that point onward.
55 This service changes the BSP for all purposes. This call can only be performed
58 This service switches the requested AP to be the BSP from that point onward.
59 This service changes the BSP for all purposes. The new BSP can take over the
60 execution of the old BSP and continue seamlessly from where the old one left
63 If the BSP cannot be switched prior to the return from this service, then
64 EFI_UNSUPPORTED must be returned.
66 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
67 @param[in] ProcessorNumber The handle number of AP that is to become the new
68 BSP. The range is from 0 to the total number of
69 logical processors minus 1.
71 @retval EFI_SUCCESS BSP successfully switched.
72 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to
73 this service returning.
74 @retval EFI_UNSUPPORTED Switching the BSP is not supported.
75 @retval EFI_SUCCESS The calling processor is an AP.
76 @retval EFI_NOT_FOUND The processor with the handle specified by
77 ProcessorNumber does not exist.
78 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or
80 @retval EFI_NOT_READY The specified AP is busy.
85 (EFIAPI
* EFI_SMM_SWITCH_BSP
) (
86 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL
*This
,
87 IN UINTN ProcessorNumber
91 Notify that a new processor has been added to the system.
93 The SMM CPU driver should add the processor to the SMM CPU list.
95 If the processor is disabled it won't participate any SMI handler during subsequent SMIs.
97 @param This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
98 @param ProcessorId The hardware ID of the processor.
99 @param ProcessorNumber The handle number of processor.
100 @param ProcessorResource A pointer to EFI_SMM_PROCESSOR_RESOURCE which holds the assigned resources.
102 @retval EFI_SUCCESS The function completed successfully.
103 @retval EFI_ALREADY_STARTED Processor already present.
104 @retval EFI_NOT_READY Space for a new handle could not be allocated.
109 (EFIAPI
*EFI_SMM_ADD_PROCESSOR
) (
110 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL
*This
,
111 IN UINT64 ProcessorId
,
112 OUT UINTN
*ProcessorNumber
116 Notify that a processor is hot-removed.
118 Remove a processor from the CPU list of the SMM CPU driver. After this API is called, the removed processor
119 must not respond to SMIs in the coherence domain.
121 @param This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
122 @param ProcessorId The hardware ID of the processor.
124 @retval EFI_SUCCESS The function completed successfully.
125 @retval EFI_NOT_FOUND Processor with the hardware ID specified by ProcessorId does not exist.
126 @retval EFI_NOT_READY Specified AP is busy.
131 (EFIAPI
*EFI_SMM_REMOVE_PROCESSOR
) (
132 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL
*This
,
133 IN UINTN ProcessorNumber
137 This return the handle number for the calling processor. This service may be
138 called from the BSP and APs.
140 This service returns the processor handle number for the calling processor.
141 The returned value is in the range from 0 to the total number of logical
142 processors minus 1. This service may be called from the BSP and APs.
143 If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER
144 is returned. Otherwise, the current processors handle number is returned in
145 ProcessorNumber, and EFI_SUCCESS is returned.
147 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.
148 @param[in] ProcessorNumber The handle number of AP that is to become the new
149 BSP. The range is from 0 to the total number of
150 logical processors minus 1.
152 @retval EFI_SUCCESS The current processor handle number was returned
154 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.
159 (EFIAPI
* EFI_SMM_WHOAMI
) (
160 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL
*This
,
161 OUT UINTN
*ProcessorNumber
165 Register exception handler.
167 @param This A pointer to the SMM_CPU_SERVICE_PROTOCOL instance.
168 @param ExceptionType Defines which interrupt or exception to hook. Type EFI_EXCEPTION_TYPE and
169 the valid values for this parameter are defined in EFI_DEBUG_SUPPORT_PROTOCOL
170 of the UEFI 2.0 specification.
171 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER
172 that is called when a processor interrupt occurs.
173 If this parameter is NULL, then the handler will be uninstalled.
175 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.
176 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was previously installed.
177 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not previously installed.
178 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.
183 (EFIAPI
*EFI_SMM_REGISTER_EXCEPTION_HANDLER
) (
184 IN EFI_SMM_CPU_SERVICE_PROTOCOL
*This
,
185 IN EFI_EXCEPTION_TYPE ExceptionType
,
186 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler
190 // This protocol provides CPU services from SMM.
192 struct _EFI_SMM_CPU_SERVICE_PROTOCOL
{
193 EFI_SMM_GET_PROCESSOR_INFO GetProcessorInfo
;
194 EFI_SMM_SWITCH_BSP SwitchBsp
;
195 EFI_SMM_ADD_PROCESSOR AddProcessor
;
196 EFI_SMM_REMOVE_PROCESSOR RemoveProcessor
;
197 EFI_SMM_WHOAMI WhoAmI
;
198 EFI_SMM_REGISTER_EXCEPTION_HANDLER RegisterExceptionHandler
;
201 extern EFI_GUID gEfiSmmCpuServiceProtocolGuid
;