]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/CpuDxe: implement Mp Services:GetProcessorInfo()
authorChen Fan <chen.fan.fnst@cn.fujitsu.com>
Thu, 13 Nov 2014 18:26:53 +0000 (18:26 +0000)
committerjljusten <jljusten@Edk2>
Thu, 13 Nov 2014 18:26:53 +0000 (18:26 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen Fan <chen.fan.fnst@cn.fujitsu.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16356 6f19259b-4bc3-4df7-8a09-765794883524

UefiCpuPkg/CpuDxe/CpuMp.c
UefiCpuPkg/CpuDxe/CpuMp.h

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
index 764db6a6f20f2edf0ef4d80349459112b32f13ff..d061bc4a61379c474ab1c36998bb6d225734989d 100644 (file)
@@ -168,6 +168,40 @@ GetNumberOfProcessors (
   OUT UINTN                     *NumberOfEnabledProcessors\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
 /**\r
   This return the handle number for the calling processor.  This service may be\r
   called from the BSP and APs.\r