MdePkg MpServices: Update return status to follow spec.
[mirror_edk2.git] / MdePkg / Include / Ppi / MpServices.h
CommitLineData
d4225560
HW
1/** @file\r
2 This file declares UEFI PI Multi-processor PPI.\r
3 This PPI is installed by some platform or chipset-specific PEIM that abstracts\r
4 handling multiprocessor support.\r
5\r
da71a637 6 Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.<BR>\r
d4225560
HW
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions of the BSD License\r
9 which accompanies this distribution. The full text of the license may be found at\r
10 http://opensource.org/licenses/bsd-license.php\r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15 @par Revision Reference:\r
16 This PPI is introduced in PI Version 1.4.\r
17\r
18**/\r
19\r
20#ifndef __PEI_MP_SERVICES_PPI_H__\r
21#define __PEI_MP_SERVICES_PPI_H__\r
22\r
23#include <Protocol/MpService.h>\r
24\r
25#define EFI_PEI_MP_SERVICES_PPI_GUID \\r
26 { \\r
27 0xee16160a, 0xe8be, 0x47a6, { 0x82, 0xa, 0xc6, 0x90, 0xd, 0xb0, 0x25, 0xa } \\r
28 }\r
29\r
30typedef struct _EFI_PEI_MP_SERVICES_PPI EFI_PEI_MP_SERVICES_PPI ;\r
31\r
32/**\r
33 Get the number of CPU's.\r
34\r
35 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
36 published by the PEI Foundation.\r
37 @param[in] This Pointer to this instance of the PPI.\r
38 @param[out] NumberOfProcessors Pointer to the total number of logical processors in\r
39 the system, including the BSP and disabled APs.\r
40 @param[out] NumberOfEnabledProcessors\r
41 Number of processors in the system that are enabled.\r
42\r
43 @retval EFI_SUCCESS The number of logical processors and enabled\r
44 logical processors was retrieved.\r
45 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
46 @retval EFI_INVALID_PARAMETER NumberOfProcessors is NULL.\r
47 NumberOfEnabledProcessors is NULL.\r
48**/\r
49typedef\r
50EFI_STATUS\r
51(EFIAPI *EFI_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS) (\r
52 IN CONST EFI_PEI_SERVICES **PeiServices,\r
53 IN EFI_PEI_MP_SERVICES_PPI *This,\r
54 OUT UINTN *NumberOfProcessors,\r
55 OUT UINTN *NumberOfEnabledProcessors\r
56 );\r
57\r
58/**\r
59 Get information on a specific CPU.\r
60\r
61 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
62 published by the PEI Foundation.\r
63 @param[in] This Pointer to this instance of the PPI.\r
64 @param[in] ProcessorNumber Pointer to the total number of logical processors in\r
65 the system, including the BSP and disabled APs.\r
66 @param[out] ProcessorInfoBuffer Number of processors in the system that are enabled.\r
67\r
68 @retval EFI_SUCCESS Processor information was returned.\r
69 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
70 @retval EFI_INVALID_PARAMETER ProcessorInfoBuffer is NULL.\r
71 @retval EFI_NOT_FOUND The processor with the handle specified by\r
72 ProcessorNumber does not exist in the platform.\r
73**/\r
74typedef\r
75EFI_STATUS\r
76(EFIAPI *EFI_PEI_MP_SERVICES_GET_PROCESSOR_INFO) (\r
77 IN CONST EFI_PEI_SERVICES **PeiServices,\r
78 IN EFI_PEI_MP_SERVICES_PPI *This,\r
79 IN UINTN ProcessorNumber,\r
80 OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer\r
81 );\r
82\r
83/**\r
84 Activate all of the application proessors.\r
85\r
86 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
87 published by the PEI Foundation.\r
88 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
89 @param[in] Procedure A pointer to the function to be run on enabled APs of\r
90 the system.\r
91 @param[in] SingleThread If TRUE, then all the enabled APs execute the function\r
92 specified by Procedure one by one, in ascending order\r
93 of processor handle number. If FALSE, then all the\r
94 enabled APs execute the function specified by Procedure\r
95 simultaneously.\r
96 @param[in] TimeoutInMicroSeconds\r
97 Indicates the time limit in microseconds for APs to\r
98 return from Procedure, for blocking mode only. Zero\r
99 means infinity. If the timeout expires before all APs\r
100 return from Procedure, then Procedure on the failed APs\r
101 is terminated. All enabled APs are available for next\r
102 function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
103 or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r
104 timeout expires in blocking mode, BSP returns\r
105 EFI_TIMEOUT.\r
106 @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r
107\r
108 @retval EFI_SUCCESS In blocking mode, all APs have finished before the\r
109 timeout expired.\r
110 @retval EFI_DEVICE_ERROR Caller processor is AP.\r
111 @retval EFI_NOT_STARTED No enabled APs exist in the system.\r
112 @retval EFI_NOT_READY Any enabled APs are busy.\r
113 @retval EFI_TIMEOUT In blocking mode, the timeout expired before all\r
114 enabled APs have finished.\r
115 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
116**/\r
117typedef\r
118EFI_STATUS\r
119(EFIAPI *EFI_PEI_MP_SERVICES_STARTUP_ALL_APS) (\r
120 IN CONST EFI_PEI_SERVICES **PeiServices,\r
121 IN EFI_PEI_MP_SERVICES_PPI *This,\r
122 IN EFI_AP_PROCEDURE Procedure,\r
123 IN BOOLEAN SingleThread,\r
124 IN UINTN TimeoutInMicroSeconds,\r
125 IN VOID *ProcedureArgument OPTIONAL\r
126 );\r
127\r
128/**\r
129 Activate a specific application processor.\r
130\r
131 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
132 published by the PEI Foundation.\r
133 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
134 @param[in] Procedure A pointer to the function to be run on enabled APs of\r
135 the system.\r
136 @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
137 total number of logical processors minus 1. The total\r
138 number of logical processors can be retrieved by\r
139 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
140 @param[in] TimeoutInMicroSeconds\r
141 Indicates the time limit in microseconds for APs to\r
142 return from Procedure, for blocking mode only. Zero\r
143 means infinity. If the timeout expires before all APs\r
144 return from Procedure, then Procedure on the failed APs\r
145 is terminated. All enabled APs are available for next\r
146 function assigned by EFI_PEI_MP_SERVICES_PPI.StartupAllAPs()\r
147 or EFI_PEI_MP_SERVICES_PPI.StartupThisAP(). If the\r
148 timeout expires in blocking mode, BSP returns\r
149 EFI_TIMEOUT.\r
150 @param[in] ProcedureArgument The parameter passed into Procedure for all APs.\r
151\r
152 @retval EFI_SUCCESS In blocking mode, specified AP finished before the\r
153 timeout expires.\r
154 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
155 @retval EFI_TIMEOUT In blocking mode, the timeout expired before the\r
156 specified AP has finished.\r
157 @retval EFI_NOT_FOUND The processor with the handle specified by\r
158 ProcessorNumber does not exist.\r
159 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP or disabled AP.\r
160 @retval EFI_INVALID_PARAMETER Procedure is NULL.\r
161**/\r
162typedef\r
163EFI_STATUS\r
164(EFIAPI *EFI_PEI_MP_SERVICES_STARTUP_THIS_AP) (\r
165 IN CONST EFI_PEI_SERVICES **PeiServices,\r
166 IN EFI_PEI_MP_SERVICES_PPI *This,\r
167 IN EFI_AP_PROCEDURE Procedure,\r
168 IN UINTN ProcessorNumber,\r
169 IN UINTN TimeoutInMicroseconds,\r
170 IN VOID *ProcedureArgument OPTIONAL\r
171 );\r
172\r
173/**\r
174 Switch the boot strap processor.\r
175\r
176 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
177 published by the PEI Foundation.\r
178 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
179 @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
180 total number of logical processors minus 1. The total\r
181 number of logical processors can be retrieved by\r
182 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
183 @param[in] EnableOldBSP If TRUE, then the old BSP will be listed as an enabled\r
184 AP. Otherwise, it will be disabled.\r
185\r
186 @retval EFI_SUCCESS BSP successfully switched.\r
187 @retval EFI_UNSUPPORTED Switching the BSP cannot be completed prior to this\r
188 service returning.\r
189 @retval EFI_UNSUPPORTED Switching the BSP is not supported.\r
da71a637 190 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
d4225560
HW
191 @retval EFI_NOT_FOUND The processor with the handle specified by\r
192 ProcessorNumber does not exist.\r
193 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the current BSP or a disabled\r
194 AP.\r
195 @retval EFI_NOT_READY The specified AP is busy.\r
196**/\r
197typedef\r
198EFI_STATUS\r
199(EFIAPI *EFI_PEI_MP_SERVICES_SWITCH_BSP) (\r
200 IN CONST EFI_PEI_SERVICES **PeiServices,\r
201 IN EFI_PEI_MP_SERVICES_PPI *This,\r
202 IN UINTN ProcessorNumber,\r
203 IN BOOLEAN EnableOldBSP\r
204 );\r
205\r
206/**\r
207 Enable or disable an application processor.\r
208\r
209 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
210 published by the PEI Foundation.\r
211 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
212 @param[in] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
213 total number of logical processors minus 1. The total\r
214 number of logical processors can be retrieved by\r
215 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
216 @param[in] EnableAP Specifies the new state for the processor for enabled,\r
217 FALSE for disabled.\r
218 @param[in] HealthFlag If not NULL, a pointer to a value that specifies the\r
219 new health status of the AP. This flag corresponds to\r
220 StatusFlag defined in EFI_PEI_MP_SERVICES_PPI.GetProcessorInfo().\r
221 Only the PROCESSOR_HEALTH_STATUS_BIT is used. All other\r
222 bits are ignored. If it is NULL, this parameter is\r
223 ignored.\r
224\r
225 @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
226 @retval EFI_UNSUPPORTED Enabling or disabling an AP cannot be completed prior\r
227 to this service returning.\r
228 @retval EFI_UNSUPPORTED Enabling or disabling an AP is not supported.\r
229 @retval EFI_DEVICE_ERROR The calling processor is an AP.\r
230 @retval EFI_NOT_FOUND Processor with the handle specified by ProcessorNumber\r
231 does not exist.\r
232 @retval EFI_INVALID_PARAMETER ProcessorNumber specifies the BSP.\r
233**/\r
234typedef\r
235EFI_STATUS\r
236(EFIAPI *EFI_PEI_MP_SERVICES_ENABLEDISABLEAP) (\r
237 IN CONST EFI_PEI_SERVICES **PeiServices,\r
238 IN EFI_PEI_MP_SERVICES_PPI *This,\r
239 IN UINTN ProcessorNumber,\r
240 IN BOOLEAN EnableAP,\r
241 IN UINT32 *HealthFlag OPTIONAL\r
242 );\r
243\r
244/**\r
c8c28158 245 Identify the currently executing processor.\r
d4225560
HW
246\r
247 @param[in] PeiServices An indirect pointer to the PEI Services Table\r
248 published by the PEI Foundation.\r
249 @param[in] This A pointer to the EFI_PEI_MP_SERVICES_PPI instance.\r
250 @param[out] ProcessorNumber The handle number of the AP. The range is from 0 to the\r
251 total number of logical processors minus 1. The total\r
252 number of logical processors can be retrieved by\r
253 EFI_PEI_MP_SERVICES_PPI.GetNumberOfProcessors().\r
254\r
255 @retval EFI_SUCCESS The current processor handle number was returned in\r
256 ProcessorNumber.\r
257 @retval EFI_INVALID_PARAMETER ProcessorNumber is NULL.\r
258**/\r
259typedef\r
260EFI_STATUS\r
261(EFIAPI *EFI_PEI_MP_SERVICES_WHOAMI) (\r
262 IN CONST EFI_PEI_SERVICES **PeiServices,\r
263 IN EFI_PEI_MP_SERVICES_PPI *This,\r
264 OUT UINTN *ProcessorNumber\r
265 );\r
266\r
267///\r
268/// This PPI is installed by some platform or chipset-specific PEIM that abstracts\r
269/// handling multiprocessor support.\r
270///\r
271struct _EFI_PEI_MP_SERVICES_PPI {\r
272 EFI_PEI_MP_SERVICES_GET_NUMBER_OF_PROCESSORS GetNumberOfProcessors;\r
273 EFI_PEI_MP_SERVICES_GET_PROCESSOR_INFO GetProcessorInfo;\r
274 EFI_PEI_MP_SERVICES_STARTUP_ALL_APS StartupAllAPs;\r
275 EFI_PEI_MP_SERVICES_STARTUP_THIS_AP StartupThisAP;\r
276 EFI_PEI_MP_SERVICES_SWITCH_BSP SwitchBSP;\r
277 EFI_PEI_MP_SERVICES_ENABLEDISABLEAP EnableDisableAP;\r
278 EFI_PEI_MP_SERVICES_WHOAMI WhoAmI;\r
279};\r
280\r
281extern EFI_GUID gEfiPeiMpServicesPpiGuid;\r
282\r
283#endif\r