]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuMp.c
UefiCpuPkg/CpuDxe: implement Mp Services:GetProcessorInfo()
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.c
index 23d395daec1dac146e768dbb711b545a7d6d1daa..4fae3f2f0d9a0057328d1f4aab4bb184a14c1615 100644 (file)
@@ -26,7 +26,7 @@ VOID *mApStackStart = 0;
 \r
 EFI_MP_SERVICES_PROTOCOL  mMpServicesTemplate = {\r
   GetNumberOfProcessors,\r
-  NULL, // GetProcessorInfo,\r
+  GetProcessorInfo,\r
   NULL, // StartupAllAPs,\r
   NULL, // StartupThisAP,\r
   NULL, // SwitchBSP,\r
@@ -114,6 +114,56 @@ GetNumberOfProcessors (
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Gets detailed MP-related information on the requested processor at the\r
+  instant this call is made. This service may only be called from the BSP.\r
+\r
+  This service retrieves detailed MP-related information about any processor\r
+  on the platform. Note the following:\r
+    - The processor information may change during the course of a boot session.\r
+    - The information presented here is entirely MP related.\r
+\r
+  Information regarding the number of caches and their sizes, frequency of operation,\r
+  slot numbers is all considered platform-related information and is not provided\r
+  by this service.\r
+\r
+  @param[in]  This                  A pointer to the EFI_MP_SERVICES_PROTOCOL\r
+                                    instance.\r
+  @param[in]  ProcessorNumber       The handle number of processor.\r
+  @param[out] ProcessorInfoBuffer   A pointer to the buffer where information for\r
+                                    the requested processor is deposited.\r
+\r
+  @retval EFI_SUCCESS             Processor information was returned.\r
+  @retval EFI_DEVICE_ERROR        The calling processor is an AP.\r
+  @retval EFI_INVALID_PARAMETER   ProcessorInfoBuffer is NULL.\r
+  @retval EFI_NOT_FOUND           The processor with the handle specified by\r
+                                  ProcessorNumber does not exist in the platform.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetProcessorInfo (\r
+  IN  EFI_MP_SERVICES_PROTOCOL   *This,\r
+  IN  UINTN                      ProcessorNumber,\r
+  OUT EFI_PROCESSOR_INFORMATION  *ProcessorInfoBuffer\r
+  )\r
+{\r
+  if (ProcessorInfoBuffer == NULL) {\r
+    return EFI_INVALID_PARAMETER;\r
+  }\r
+\r
+  if (!IsBSP ()) {\r
+    return EFI_DEVICE_ERROR;\r
+  }\r
+\r
+  if (ProcessorNumber >= mMpSystemData.NumberOfProcessors) {\r
+    return EFI_NOT_FOUND;\r
+  }\r
+\r
+  CopyMem (ProcessorInfoBuffer, &mMpSystemData.CpuDatas[ProcessorNumber], sizeof (EFI_PROCESSOR_INFORMATION));\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