]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/Include/Protocol/SmmCpuService.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / Include / Protocol / SmmCpuService.h
CommitLineData
9f1fc503
MK
1/** @file\r
2SMM CPU Service protocol definition.\r
3\r
4a68176c 4Copyright (c) 2013 - 2022, Intel Corporation. All rights reserved.<BR>\r
0acd8697 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
9f1fc503
MK
6\r
7**/\r
8\r
9#ifndef _SMM_CPU_SERVICE_PROTOCOL_H_\r
10#define _SMM_CPU_SERVICE_PROTOCOL_H_\r
11\r
12//\r
13// Share some definitions with MP Services and CPU Arch Protocol\r
14//\r
15#include <Protocol/MpService.h>\r
16#include <Protocol/Cpu.h>\r
17\r
18#define EFI_SMM_CPU_SERVICE_PROTOCOL_GUID \\r
19 { \\r
20 0x1d202cab, 0xc8ab, 0x4d5c, { 0x94, 0xf7, 0x3c, 0xfc, 0xc0, 0xd3, 0xd3, 0x35 } \\r
21 }\r
22\r
23typedef struct _EFI_SMM_CPU_SERVICE_PROTOCOL EFI_SMM_CPU_SERVICE_PROTOCOL;\r
24\r
25//\r
26// Protocol functions\r
27//\r
28\r
29/**\r
30 Gets processor information on the requested processor at the\r
31 instant this call is made. This service may only be called from the BSP.\r
32\r
33 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL\r
34 instance.\r
35 @param[in] ProcessorNumber The handle number of processor.\r
36 @param[out] ProcessorInfoBuffer A pointer to the buffer where information for\r
37 the requested processor is deposited.\r
38\r
39 @retval EFI_SUCCESS Processor information was returned.\r
40 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
41 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
42 @retval EFI_NOT_FOUND The processor with the handle specified by\r
43 ProcessorNumber does not exist in the platform.\r
44**/\r
45typedef\r
46EFI_STATUS\r
053e878b 47(EFIAPI *EFI_SMM_GET_PROCESSOR_INFO)(\r
9f1fc503
MK
48 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
49 IN UINTN ProcessorNumber,\r
50 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
51 );\r
52\r
53/**\r
54 This service switches the requested AP to be the BSP from that point onward.\r
55 This service changes the BSP for all purposes. This call can only be performed\r
56 by the current BSP.\r
57\r
58 This service switches the requested AP to be the BSP from that point onward.\r
59 This service changes the BSP for all purposes. The new BSP can take over the\r
60 execution of the old BSP and continue seamlessly from where the old one left\r
61 off.\r
62\r
63 If the BSP cannot be switched prior to the return from this service, then\r
64 EFI_UNSUPPORTED must be returned.\r
65\r
66 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
67 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
68 BSP. The range is from 0 to the total number of\r
69 logical processors minus 1.\r
70\r
71 @retval EFI_SUCCESS BSP successfully switched.\r
72 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to\r
73 this service returning.\r
74 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
75 @retval EFI_SUCCESS The calling processor is an AP.\r
76 @retval EFI_NOT_FOUND The processor with the handle specified by\r
77 ProcessorNumber does not exist.\r
78 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or\r
79 a disabled AP.\r
80 @retval EFI_NOT_READY The specified AP is busy.\r
81\r
82**/\r
83typedef\r
84EFI_STATUS\r
053e878b 85(EFIAPI *EFI_SMM_SWITCH_BSP)(\r
9f1fc503
MK
86 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
87 IN UINTN ProcessorNumber\r
88 );\r
89\r
90/**\r
91 Notify that a new processor has been added to the system.\r
92\r
93 The SMM CPU driver should add the processor to the SMM CPU list.\r
94\r
95 If the processor is disabled it won't participate any SMI handler during subsequent SMIs.\r
96\r
97 @param This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
98 @param ProcessorId The hardware ID of the processor.\r
99 @param ProcessorNumber The handle number of processor.\r
100 @param ProcessorResource A pointer to EFI_SMM_PROCESSOR_RESOURCE which holds the assigned resources.\r
101\r
102 @retval EFI_SUCCESS The function completed successfully.\r
103 @retval EFI_ALREADY_STARTED Processor already present.\r
104 @retval EFI_NOT_READY Space for a new handle could not be allocated.\r
105\r
106**/\r
107typedef\r
108EFI_STATUS\r
053e878b 109(EFIAPI *EFI_SMM_ADD_PROCESSOR)(\r
9f1fc503
MK
110 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
111 IN UINT64 ProcessorId,\r
112 OUT UINTN *ProcessorNumber\r
113 );\r
114\r
115/**\r
116 Notify that a processor is hot-removed.\r
117\r
118 Remove a processor from the CPU list of the SMM CPU driver. After this API is called, the removed processor\r
119 must not respond to SMIs in the coherence domain.\r
120\r
121 @param This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
122 @param ProcessorId The hardware ID of the processor.\r
123\r
124 @retval EFI_SUCCESS The function completed successfully.\r
125 @retval EFI_NOT_FOUND Processor with the hardware ID specified by ProcessorId does not exist.\r
126 @retval EFI_NOT_READY Specified AP is busy.\r
127\r
128**/\r
129typedef\r
130EFI_STATUS\r
053e878b 131(EFIAPI *EFI_SMM_REMOVE_PROCESSOR)(\r
9f1fc503
MK
132 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
133 IN UINTN ProcessorNumber\r
134 );\r
135\r
136/**\r
137 This return the handle number for the calling processor. This service may be\r
138 called from the BSP and APs.\r
139\r
140 This service returns the processor handle number for the calling processor.\r
141 The returned value is in the range from 0 to the total number of logical\r
142 processors minus 1. This service may be called from the BSP and APs.\r
143 If ProcessorNumber is NULL, then EFI_INVALID_PARAMETER\r
144 is returned. Otherwise, the current processors handle number is returned in\r
145 ProcessorNumber, and EFI_SUCCESS is returned.\r
146\r
147 @param[in] This A pointer to the EFI_SMM_CPU_SERVICE_PROTOCOL instance.\r
148 @param[in] ProcessorNumber The handle number of AP that is to become the new\r
149 BSP. The range is from 0 to the total number of\r
150 logical processors minus 1.\r
151\r
152 @retval EFI_SUCCESS The current processor handle number was returned\r
153 in ProcessorNumber.\r
154 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
155\r
156**/\r
157typedef\r
158EFI_STATUS\r
053e878b 159(EFIAPI *EFI_SMM_WHOAMI)(\r
9f1fc503
MK
160 IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
161 OUT UINTN *ProcessorNumber\r
162 );\r
163\r
164/**\r
165 Register exception handler.\r
166\r
167 @param This A pointer to the SMM_CPU_SERVICE_PROTOCOL instance.\r
168 @param ExceptionType Defines which interrupt or exception to hook. Type EFI_EXCEPTION_TYPE and\r
169 the valid values for this parameter are defined in EFI_DEBUG_SUPPORT_PROTOCOL\r
170 of the UEFI 2.0 specification.\r
171 @param InterruptHandler A pointer to a function of type EFI_CPU_INTERRUPT_HANDLER\r
172 that is called when a processor interrupt occurs.\r
173 If this parameter is NULL, then the handler will be uninstalled.\r
174\r
175 @retval EFI_SUCCESS The handler for the processor interrupt was successfully installed or uninstalled.\r
176 @retval EFI_ALREADY_STARTED InterruptHandler is not NULL, and a handler for InterruptType was previously installed.\r
177 @retval EFI_INVALID_PARAMETER InterruptHandler is NULL, and a handler for InterruptType was not previously installed.\r
178 @retval EFI_UNSUPPORTED The interrupt specified by InterruptType is not supported.\r
179\r
180**/\r
181typedef\r
182EFI_STATUS\r
053e878b 183(EFIAPI *EFI_SMM_REGISTER_EXCEPTION_HANDLER)(\r
9f1fc503
MK
184 IN EFI_SMM_CPU_SERVICE_PROTOCOL *This,\r
185 IN EFI_EXCEPTION_TYPE ExceptionType,\r
186 IN EFI_CPU_INTERRUPT_HANDLER InterruptHandler\r
187 );\r
188\r
189//\r
190// This protocol provides CPU services from SMM.\r
191//\r
192struct _EFI_SMM_CPU_SERVICE_PROTOCOL {\r
053e878b
MK
193 EFI_SMM_GET_PROCESSOR_INFO GetProcessorInfo;\r
194 EFI_SMM_SWITCH_BSP SwitchBsp;\r
195 EFI_SMM_ADD_PROCESSOR AddProcessor;\r
196 EFI_SMM_REMOVE_PROCESSOR RemoveProcessor;\r
197 EFI_SMM_WHOAMI WhoAmI;\r
198 EFI_SMM_REGISTER_EXCEPTION_HANDLER RegisterExceptionHandler;\r
9f1fc503
MK
199};\r
200\r
053e878b 201extern EFI_GUID gEfiSmmCpuServiceProtocolGuid;\r
9f1fc503 202\r
4a68176c
LZ
203//\r
204// EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL provide SMM CPU\r
205// rendezvous service support.\r
206//\r
207#define EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL_GUID \\r
208 { \\r
209 0xaa00d50b, 0x4911, 0x428f, { 0xb9, 0x1a, 0xa5, 0x9d, 0xdb, 0x13, 0xe2, 0x4c } \\r
210 }\r
211\r
212typedef struct _EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL;\r
213\r
214/**\r
215 Wait for all APs to arrive SMM mode in given timeout constraint.\r
216\r
217 @param[in] This A pointer to the EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL instance.\r
218 @param[in] BlockingMode Block or non-block mode.\r
219\r
220 @retval EFI_SUCCESS All APs have arrived SMM mode except SMI disabled APs.\r
221 @retval EFI_TIMEOUT There are APs not in SMM mode in given timeout constraint.\r
222\r
223**/\r
224typedef\r
225EFI_STATUS\r
226(EFIAPI *EDKII_WAIT_FOR_ALL_PROCESSOR)(\r
227 IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *This,\r
228 IN BOOLEAN BlockingMode\r
229 );\r
230\r
231struct _EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL {\r
232 EDKII_WAIT_FOR_ALL_PROCESSOR WaitForAllProcessor;\r
233};\r
234\r
235extern EFI_GUID gEdkiiSmmCpuRendezvousProtocolGuid;\r
236\r
9f1fc503 237#endif\r