]> git.proxmox.com Git - mirror_edk2.git/blame - UefiCpuPkg/PiSmmCpuDxeSmm/SmmMp.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / SmmMp.h
CommitLineData
51dd408a
ED
1/** @file\r
2Include file for SMM MP protocol implementation.\r
3\r
4Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
5\r
6SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9\r
10#ifndef _SMM_MP_PROTOCOL_H_\r
11#define _SMM_MP_PROTOCOL_H_\r
12\r
13//\r
14// SMM MP Protocol function prototypes.\r
15//\r
16\r
17/**\r
18 Service to retrieves the number of logical processor in the platform.\r
19\r
20 @param[in] This The EFI_MM_MP_PROTOCOL instance.\r
21 @param[out] NumberOfProcessors Pointer to the total number of logical processors in the system,\r
22 including the BSP and all APs.\r
23\r
24 @retval EFI_SUCCESS The number of processors was retrieved successfully\r
25 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL\r
26**/\r
51dd408a
ED
27EFI_STATUS\r
28EFIAPI\r
29SmmMpGetNumberOfProcessors (\r
053e878b
MK
30 IN CONST EFI_MM_MP_PROTOCOL *This,\r
31 OUT UINTN *NumberOfProcessors\r
51dd408a
ED
32 );\r
33\r
51dd408a
ED
34/**\r
35 This service allows the caller to invoke a procedure one of the application processors (AP). This\r
36 function uses an optional token parameter to support blocking and non-blocking modes. If the token\r
37 is passed into the call, the function will operate in a non-blocking fashion and the caller can\r
38 check for completion with CheckOnProcedure or WaitForProcedure.\r
39\r
40 @param[in] This The EFI_MM_MP_PROTOCOL instance.\r
41 @param[in] Procedure A pointer to the procedure to be run on the designated target\r
42 AP of the system. Type EFI_AP_PROCEDURE2 is defined below in\r
43 related definitions.\r
44 @param[in] CpuNumber The zero-based index of the processor number of the target\r
45 AP, on which the code stream is supposed to run. If the number\r
46 points to the calling processor then it will not run the\r
47 supplied code.\r
48 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for this AP to\r
49 finish execution of Procedure, either for blocking or\r
50 non-blocking mode. Zero means infinity. If the timeout\r
51 expires before this AP returns from Procedure, then Procedure\r
52 on the AP is terminated. If the timeout expires in blocking\r
53 mode, the call returns EFI_TIMEOUT. If the timeout expires\r
54 in non-blocking mode, the timeout determined can be through\r
55 CheckOnProcedure or WaitForProcedure.\r
56 Note that timeout support is optional. Whether an\r
57 implementation supports this feature, can be determined via\r
58 the Attributes data member.\r
59 @param[in,out] ProcedureArguments Allows the caller to pass a list of parameters to the code\r
60 that is run by the AP. It is an optional common mailbox\r
61 between APs and the caller to share information.\r
62 @param[in,out] Token This is parameter is broken into two components:\r
63 1.Token->Completion is an optional parameter that allows the\r
64 caller to execute the procedure in a blocking or non-blocking\r
65 fashion. If it is NULL the call is blocking, and the call will\r
66 not return until the AP has completed the procedure. If the\r
67 token is not NULL, the call will return immediately. The caller\r
68 can check whether the procedure has completed with\r
69 CheckOnProcedure or WaitForProcedure.\r
70 2.Token->Status The implementation updates the address pointed\r
71 at by this variable with the status code returned by Procedure\r
72 when it completes execution on the target AP, or with EFI_TIMEOUT\r
73 if the Procedure fails to complete within the optional timeout.\r
74 The implementation will update this variable with EFI_NOT_READY\r
75 prior to starting Procedure on the target AP\r
76 @param[in,out] CPUStatus This optional pointer may be used to get the status code returned\r
77 by Procedure when it completes execution on the target AP, or with\r
78 EFI_TIMEOUT if the Procedure fails to complete within the optional\r
79 timeout. The implementation will update this variable with\r
80 EFI_NOT_READY prior to starting Procedure on the target AP.\r
81\r
82 @retval EFI_SUCCESS In the blocking case, this indicates that Procedure has completed\r
83 execution on the target AP.\r
84 In the non-blocking case this indicates that the procedure has\r
85 been successfully scheduled for execution on the target AP.\r
86 @retval EFI_INVALID_PARAMETER The input arguments are out of range. Either the target AP is the\r
87 caller of the function, or the Procedure or Token is NULL\r
88 @retval EFI_NOT_READY If the target AP is busy executing another procedure\r
89 @retval EFI_ALREADY_STARTED Token is already in use for another procedure\r
90 @retval EFI_TIMEOUT In blocking mode, the timeout expired before the specified AP\r
91 has finished\r
92 @retval EFI_OUT_OF_RESOURCES Could not allocate a required resource.\r
93\r
94**/\r
95EFI_STATUS\r
96EFIAPI\r
97SmmMpDispatchProcedure (\r
053e878b
MK
98 IN CONST EFI_MM_MP_PROTOCOL *This,\r
99 IN EFI_AP_PROCEDURE2 Procedure,\r
100 IN UINTN CpuNumber,\r
101 IN UINTN TimeoutInMicroseconds,\r
102 IN OUT VOID *ProcedureArguments OPTIONAL,\r
103 IN OUT MM_COMPLETION *Token,\r
104 IN OUT EFI_STATUS *CPUStatus\r
51dd408a
ED
105 );\r
106\r
107/**\r
108 This service allows the caller to invoke a procedure on all running application processors (AP)\r
109 except the caller. This function uses an optional token parameter to support blocking and\r
110 nonblocking modes. If the token is passed into the call, the function will operate in a non-blocking\r
111 fashion and the caller can check for completion with CheckOnProcedure or WaitForProcedure.\r
112\r
113 It is not necessary for the implementation to run the procedure on every processor on the platform.\r
114 Processors that are powered down in such a way that they cannot respond to interrupts, may be\r
115 excluded from the broadcast.\r
116\r
117\r
118 @param[in] This The EFI_MM_MP_PROTOCOL instance.\r
119 @param[in] Procedure A pointer to the code stream to be run on the APs that have\r
120 entered MM. Type EFI_AP_PROCEDURE is defined below in related\r
121 definitions.\r
122 @param[in] TimeoutInMicroseconds Indicates the time limit in microseconds for the APs to finish\r
123 execution of Procedure, either for blocking or non-blocking mode.\r
124 Zero means infinity. If the timeout expires before all APs return\r
125 from Procedure, then Procedure on the failed APs is terminated. If\r
126 the timeout expires in blocking mode, the call returns EFI_TIMEOUT.\r
127 If the timeout expires in non-blocking mode, the timeout determined\r
128 can be through CheckOnProcedure or WaitForProcedure.\r
129 Note that timeout support is optional. Whether an implementation\r
130 supports this feature can be determined via the Attributes data\r
131 member.\r
132 @param[in,out] ProcedureArguments Allows the caller to pass a list of parameters to the code\r
133 that is run by the AP. It is an optional common mailbox\r
134 between APs and the caller to share information.\r
135 @param[in,out] Token This is parameter is broken into two components:\r
136 1.Token->Completion is an optional parameter that allows the\r
137 caller to execute the procedure in a blocking or non-blocking\r
138 fashion. If it is NULL the call is blocking, and the call will\r
139 not return until the AP has completed the procedure. If the\r
140 token is not NULL, the call will return immediately. The caller\r
141 can check whether the procedure has completed with\r
142 CheckOnProcedure or WaitForProcedure.\r
143 2.Token->Status The implementation updates the address pointed\r
144 at by this variable with the status code returned by Procedure\r
145 when it completes execution on the target AP, or with EFI_TIMEOUT\r
146 if the Procedure fails to complete within the optional timeout.\r
147 The implementation will update this variable with EFI_NOT_READY\r
148 prior to starting Procedure on the target AP\r
149 @param[in,out] CPUStatus This optional pointer may be used to get the individual status\r
150 returned by every AP that participated in the broadcast. This\r
151 parameter if used provides the base address of an array to hold\r
152 the EFI_STATUS value of each AP in the system. The size of the\r
153 array can be ascertained by the GetNumberOfProcessors function.\r
154 As mentioned above, the broadcast may not include every processor\r
155 in the system. Some implementations may exclude processors that\r
156 have been powered down in such a way that they are not responsive\r
157 to interrupts. Additionally the broadcast excludes the processor\r
158 which is making the BroadcastProcedure call. For every excluded\r
159 processor, the array entry must contain a value of EFI_NOT_STARTED\r
160\r
161 @retval EFI_SUCCESS In the blocking case, this indicates that Procedure has completed\r
162 execution on the APs.\r
163 In the non-blocking case this indicates that the procedure has\r
164 been successfully scheduled for execution on the APs.\r
165 @retval EFI_INVALID_PARAMETER The Procedure or Token is NULL\r
166 @retval EFI_NOT_READY If the target AP is busy executing another procedure\r
167 @retval EFI_ALREADY_STARTED Token is already in use for another procedure\r
168 @retval EFI_TIMEOUT In blocking mode, the timeout expired before the specified AP\r
169 has finished\r
170 @retval EFI_OUT_OF_RESOURCES Could not allocate a required resource.\r
171\r
172**/\r
173EFI_STATUS\r
174EFIAPI\r
175SmmMpBroadcastProcedure (\r
053e878b
MK
176 IN CONST EFI_MM_MP_PROTOCOL *This,\r
177 IN EFI_AP_PROCEDURE2 Procedure,\r
178 IN UINTN TimeoutInMicroseconds,\r
179 IN OUT VOID *ProcedureArguments OPTIONAL,\r
180 IN OUT MM_COMPLETION *Token,\r
181 IN OUT EFI_STATUS *CPUStatus\r
51dd408a
ED
182 );\r
183\r
51dd408a
ED
184/**\r
185 This service allows the caller to set a startup procedure that will be executed when an AP powers\r
186 up from a state where core configuration and context is lost. The procedure is execution has the\r
187 following properties:\r
188 1. The procedure executes before the processor is handed over to the operating system.\r
189 2. All processors execute the same startup procedure.\r
190 3. The procedure may run in parallel with other procedures invoked through the functions in this\r
191 protocol, or with processors that are executing an MM handler or running in the operating system.\r
192\r
193\r
194 @param[in] This The EFI_MM_MP_PROTOCOL instance.\r
195 @param[in] Procedure A pointer to the code stream to be run on the designated target AP\r
196 of the system. Type EFI_AP_PROCEDURE is defined below in Volume 2\r
197 with the related definitions of\r
198 EFI_MP_SERVICES_PROTOCOL.StartupAllAPs.\r
199 If caller may pass a value of NULL to deregister any existing\r
200 startup procedure.\r
201 @param[in,out] ProcedureArguments Allows the caller to pass a list of parameters to the code that is\r
202 run by the AP. It is an optional common mailbox between APs and\r
203 the caller to share information\r
204\r
205 @retval EFI_SUCCESS The Procedure has been set successfully.\r
206 @retval EFI_INVALID_PARAMETER The Procedure is NULL but ProcedureArguments not NULL.\r
207**/\r
208EFI_STATUS\r
209EFIAPI\r
210SmmMpSetStartupProcedure (\r
211 IN CONST EFI_MM_MP_PROTOCOL *This,\r
212 IN EFI_AP_PROCEDURE Procedure,\r
213 IN OUT VOID *ProcedureArguments OPTIONAL\r
214 );\r
215\r
216/**\r
217 When non-blocking execution of a procedure on an AP is invoked with DispatchProcedure,\r
218 via the use of a token, this function can be used to check for completion of the procedure on the AP.\r
219 The function takes the token that was passed into the DispatchProcedure call. If the procedure\r
220 is complete, and therefore it is now possible to run another procedure on the same AP, this function\r
221 returns EFI_SUCESS. In this case the status returned by the procedure that executed on the AP is\r
222 returned in the token's Status field. If the procedure has not yet completed, then this function\r
223 returns EFI_NOT_READY.\r
224\r
225 When a non-blocking execution of a procedure is invoked with BroadcastProcedure, via the\r
226 use of a token, this function can be used to check for completion of the procedure on all the\r
227 broadcast APs. The function takes the token that was passed into the BroadcastProcedure\r
228 call. If the procedure is complete on all broadcast APs this function returns EFI_SUCESS. In this\r
229 case the Status field in the token passed into the function reflects the overall result of the\r
230 invocation, which may be EFI_SUCCESS, if all executions succeeded, or the first observed failure.\r
231 If the procedure has not yet completed on the broadcast APs, the function returns\r
232 EFI_NOT_READY.\r
233\r
234 @param[in] This The EFI_MM_MP_PROTOCOL instance.\r
235 @param[in] Token This parameter describes the token that was passed into\r
236 DispatchProcedure or BroadcastProcedure.\r
237\r
238 @retval EFI_SUCCESS Procedure has completed.\r
239 @retval EFI_NOT_READY The Procedure has not completed.\r
240 @retval EFI_INVALID_PARAMETER Token or Token->Completion is NULL\r
241 @retval EFI_NOT_FOUND Token is not currently in use for a non-blocking call\r
242\r
243**/\r
244EFI_STATUS\r
245EFIAPI\r
246SmmMpCheckForProcedure (\r
053e878b
MK
247 IN CONST EFI_MM_MP_PROTOCOL *This,\r
248 IN MM_COMPLETION Token\r
51dd408a
ED
249 );\r
250\r
251/**\r
252 When a non-blocking execution of a procedure on an AP is invoked via DispatchProcedure,\r
253 this function will block the caller until the remote procedure has completed on the designated AP.\r
254 The non-blocking procedure invocation is identified by the Token parameter, which must match the\r
255 token that used when DispatchProcedure was called. Upon completion the status returned by\r
256 the procedure that executed on the AP is used to update the token's Status field.\r
257\r
258 When a non-blocking execution of a procedure on an AP is invoked via BroadcastProcedure\r
259 this function will block the caller until the remote procedure has completed on all of the APs that\r
260 entered MM. The non-blocking procedure invocation is identified by the Token parameter, which\r
261 must match the token that used when BroadcastProcedure was called. Upon completion the\r
262 overall status returned by the procedures that executed on the broadcast AP is used to update the\r
263 token's Status field. The overall status may be EFI_SUCCESS, if all executions succeeded, or the\r
264 first observed failure.\r
265\r
266\r
267 @param[in] This The EFI_MM_MP_PROTOCOL instance.\r
268 @param[in] Token This parameter describes the token that was passed into\r
269 DispatchProcedure or BroadcastProcedure.\r
270\r
271 @retval EFI_SUCCESS Procedure has completed.\r
272 @retval EFI_INVALID_PARAMETER Token or Token->Completion is NULL\r
273 @retval EFI_NOT_FOUND Token is not currently in use for a non-blocking call\r
274\r
275**/\r
276EFI_STATUS\r
277EFIAPI\r
278SmmMpWaitForProcedure (\r
053e878b
MK
279 IN CONST EFI_MM_MP_PROTOCOL *This,\r
280 IN MM_COMPLETION Token\r
51dd408a
ED
281 );\r
282\r
283#endif\r