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