return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Worker function to let the caller enable or disable an AP from this point onward.\r
+ This service may only be called from the BSP.\r
+\r
+ @param[in] ProcessorNumber The handle number of AP.\r
+ @param[in] EnableAP Specifies the new state for the processor for\r
+ enabled, FALSE for disabled.\r
+ @param[in] HealthFlag If not NULL, a pointer to a value that specifies\r
+ the new health status of the AP.\r
+\r
+ @retval EFI_SUCCESS The specified AP was enabled or disabled successfully.\r
+ @retval others Failed to Enable/Disable AP.\r
+\r
+**/\r
+EFI_STATUS\r
+EnableDisableApWorker (\r
+ IN UINTN ProcessorNumber,\r
+ IN BOOLEAN EnableAP,\r
+ IN UINT32 *HealthFlag OPTIONAL\r
+ )\r
+{\r
+ CPU_MP_DATA *CpuMpData;\r
+ UINTN CallerNumber;\r
+\r
+ CpuMpData = GetCpuMpData ();\r
+\r
+ //\r
+ // Check whether caller processor is BSP\r
+ //\r
+ MpInitLibWhoAmI (&CallerNumber);\r
+ if (CallerNumber != CpuMpData->BspNumber) {\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
+ if (ProcessorNumber == CpuMpData->BspNumber) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (ProcessorNumber >= CpuMpData->CpuCount) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ if (!EnableAP) {\r
+ SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateDisabled);\r
+ } else {\r
+ SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle);\r
+ }\r
+\r
+ if (HealthFlag != NULL) {\r
+ CpuMpData->CpuData[ProcessorNumber].CpuHealthy =\r
+ (BOOLEAN) ((*HealthFlag & PROCESSOR_HEALTH_STATUS_BIT) != 0);\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
/**\r
This return the handle number for the calling processor. This service may be\r
called from the BSP and APs.\r