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