{\r
return EFI_UNSUPPORTED;\r
}\r
+\r
/**\r
Retrieves the number of logical processor in the platform and the number of\r
those logical processors that are enabled on this boot. This service may only\r
OUT UINTN *NumberOfEnabledProcessors OPTIONAL\r
)\r
{\r
- return EFI_UNSUPPORTED;\r
+ CPU_MP_DATA *CpuMpData;\r
+ UINTN CallerNumber;\r
+ UINTN ProcessorNumber;\r
+ UINTN EnabledProcessorNumber;\r
+ UINTN Index;\r
+\r
+ CpuMpData = GetCpuMpData ();\r
+\r
+ if ((NumberOfProcessors == NULL) && (NumberOfEnabledProcessors == NULL)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\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
+ ProcessorNumber = CpuMpData->CpuCount;\r
+ EnabledProcessorNumber = 0;\r
+ for (Index = 0; Index < ProcessorNumber; Index++) {\r
+ if (GetApState (&CpuMpData->CpuData[Index]) != CpuStateDisabled) {\r
+ EnabledProcessorNumber ++;\r
+ }\r
+ }\r
+\r
+ if (NumberOfProcessors != NULL) {\r
+ *NumberOfProcessors = ProcessorNumber;\r
+ }\r
+ if (NumberOfEnabledProcessors != NULL) {\r
+ *NumberOfEnabledProcessors = EnabledProcessorNumber;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
}\r
\r
+\r
/**\r
Get pointer to CPU MP Data structure from GUIDed HOB.\r
\r