]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuMp.c
UefiCpuPkg: Make the comments align with the functions
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuMp.c
index efab78c83de0cf19c17fe3f39876cd8bc0fdbf4c..9659bd280725c56a5a6ed325a191a4ff3f7bd83a 100644 (file)
@@ -299,8 +299,8 @@ StartupAllAPs (
 \r
   @param[in]  This                    A pointer to the EFI_MP_SERVICES_PROTOCOL\r
                                       instance.\r
-  @param[in]  Procedure               A pointer to the function to be run on\r
-                                      enabled APs of the system. See type\r
+  @param[in]  Procedure               A pointer to the function to be run on the\r
+                                      designated AP of the system. See type\r
                                       EFI_AP_PROCEDURE.\r
   @param[in]  ProcessorNumber         The handle number of the AP. The range is\r
                                       from 0 to the total number of logical\r
@@ -309,13 +309,13 @@ StartupAllAPs (
                                       EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
   @param[in]  WaitEvent               The event created by the caller with CreateEvent()\r
                                       service.  If it is NULL, then execute in\r
-                                      blocking mode. BSP waits until all APs finish\r
-                                      or TimeoutInMicroseconds expires.  If it's\r
+                                      blocking mode. BSP waits until this AP finish\r
+                                      or TimeoutInMicroSeconds expires.  If it's\r
                                       not NULL, then execute in non-blocking mode.\r
                                       BSP requests the function specified by\r
-                                      Procedure to be started on all the enabled\r
-                                      APs, and go on executing immediately. If\r
-                                      all return from Procedure or TimeoutInMicroseconds\r
+                                      Procedure to be started on this AP,\r
+                                      and go on executing immediately. If this AP\r
+                                      return from Procedure or TimeoutInMicroSeconds\r
                                       expires, this event is signaled. The BSP\r
                                       can use the CheckEvent() or WaitForEvent()\r
                                       services to check the state of event.  Type\r
@@ -323,20 +323,20 @@ StartupAllAPs (
                                       the Unified Extensible Firmware Interface\r
                                       Specification.\r
   @param[in]  TimeoutInMicroseconds   Indicates the time limit in microseconds for\r
-                                      APs to return from Procedure, either for\r
+                                      this AP to finish this Procedure, either for\r
                                       blocking or non-blocking mode. Zero means\r
                                       infinity.  If the timeout expires before\r
-                                      all APs return from Procedure, then Procedure\r
-                                      on the failed APs is terminated. All enabled\r
-                                      APs are available for next function assigned\r
+                                      this AP returns from Procedure, then Procedure\r
+                                      on the AP is terminated. The\r
+                                      AP is available for next function assigned\r
                                       by EFI_MP_SERVICES_PROTOCOL.StartupAllAPs()\r
                                       or EFI_MP_SERVICES_PROTOCOL.StartupThisAP().\r
                                       If the timeout expires in blocking mode,\r
                                       BSP returns EFI_TIMEOUT.  If the timeout\r
                                       expires in non-blocking mode, WaitEvent\r
                                       is signaled with SignalEvent().\r
-  @param[in]  ProcedureArgument       The parameter passed into Procedure for\r
-                                      all APs.\r
+  @param[in]  ProcedureArgument       The parameter passed into Procedure on the\r
+                                      specified AP.\r
   @param[out] Finished                If NULL, this parameter is ignored.  In\r
                                       blocking mode, this parameter is ignored.\r
                                       In non-blocking mode, if AP returns from\r
@@ -447,8 +447,8 @@ SwitchBSP (
   from this service, then EFI_UNSUPPORTED must be returned.\r
 \r
   @param[in] This              A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
-  @param[in] ProcessorNumber   The handle number of AP that is to become the new\r
-                               BSP. The range is from 0 to the total number of\r
+  @param[in] ProcessorNumber   The handle number of AP.\r
+                               The range is from 0 to the total number of\r
                                logical processors minus 1. The total number of\r
                                logical processors can be retrieved by\r
                                EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
@@ -497,8 +497,8 @@ EnableDisableAP (
   ProcessorNumber, and EFI_SUCCESS is returned.\r
 \r
   @param[in]  This             A pointer to the EFI_MP_SERVICES_PROTOCOL instance.\r
-  @param[out] ProcessorNumber  The handle number of AP that is to become the new\r
-                               BSP. The range is from 0 to the total number of\r
+  @param[out] ProcessorNumber  Pointer to the handle number of AP.\r
+                               The range is from 0 to the total number of\r
                                logical processors minus 1. The total number of\r
                                logical processors can be retrieved by\r
                                EFI_MP_SERVICES_PROTOCOL.GetNumberOfProcessors().\r
@@ -539,6 +539,7 @@ CollectBistDataFromHob (
   UINTN                                 ProcessorNumber;\r
   EFI_PROCESSOR_INFORMATION             ProcessorInfo;\r
   EFI_HEALTH_FLAGS                      BistData;\r
+  UINTN                                 CpuInstanceNumber;\r
 \r
   SecPlatformInformation2 = NULL;\r
   SecPlatformInformation  = NULL;\r
@@ -578,25 +579,25 @@ CollectBistDataFromHob (
     }\r
   }\r
 \r
-  while ((NumberOfData--) > 0) {\r
-    for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {\r
-      MpInitLibGetProcessorInfo (ProcessorNumber, &ProcessorInfo, &BistData);\r
-      if (ProcessorInfo.ProcessorId == CpuInstance[NumberOfData].CpuLocation) {\r
+  for (ProcessorNumber = 0; ProcessorNumber < mNumberOfProcessors; ProcessorNumber++) {\r
+    MpInitLibGetProcessorInfo (ProcessorNumber, &ProcessorInfo, &BistData);\r
+    for (CpuInstanceNumber = 0; CpuInstanceNumber < NumberOfData; CpuInstanceNumber++) {\r
+      if (ProcessorInfo.ProcessorId == CpuInstance[CpuInstanceNumber].CpuLocation) {\r
         //\r
         // Update CPU health status for MP Services Protocol according to BIST data.\r
         //\r
-        BistData = CpuInstance[NumberOfData].InfoRecord.IA32HealthFlags;\r
-      }\r
-      if (BistData.Uint32 != 0) {\r
-        //\r
-        // Report Status Code that self test is failed\r
-        //\r
-        REPORT_STATUS_CODE (\r
-          EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
-          (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST)\r
-          );\r
+        BistData = CpuInstance[CpuInstanceNumber].InfoRecord.IA32HealthFlags;\r
       }\r
     }\r
+    if (BistData.Uint32 != 0) {\r
+      //\r
+      // Report Status Code that self test is failed\r
+      //\r
+      REPORT_STATUS_CODE (\r
+        EFI_ERROR_CODE | EFI_ERROR_MAJOR,\r
+        (EFI_COMPUTING_UNIT_HOST_PROCESSOR | EFI_CU_HP_EC_SELF_TEST)\r
+        );\r
+    }\r
   }\r
 }\r
 \r
@@ -613,22 +614,14 @@ InitializeMpSupport (
   UINTN          NumberOfProcessors;\r
   UINTN          NumberOfEnabledProcessors;\r
 \r
-  NumberOfProcessors = (UINTN) PcdGet32 (PcdCpuMaxLogicalProcessorNumber);\r
-  if (NumberOfProcessors < 1) {\r
-    DEBUG ((DEBUG_ERROR, "Setting PcdCpuMaxLogicalProcessorNumber should be more than zero.\n"));\r
-    return;\r
-  }\r
-\r
   //\r
-  // Only perform AP detection if PcdCpuMaxLogicalProcessorNumber is greater than 1\r
+  // Wakeup APs to do initialization\r
   //\r
-  if (NumberOfProcessors > 1) {\r
-    Status = MpInitLibInitialize ();\r
-    ASSERT_EFI_ERROR (Status);\r
+  Status = MpInitLibInitialize ();\r
+  ASSERT_EFI_ERROR (Status);\r
 \r
-    MpInitLibGetNumberOfProcessors (&NumberOfProcessors, &NumberOfEnabledProcessors);\r
-    mNumberOfProcessors = NumberOfProcessors;\r
-  }\r
+  MpInitLibGetNumberOfProcessors (&NumberOfProcessors, &NumberOfEnabledProcessors);\r
+  mNumberOfProcessors = NumberOfProcessors;\r
   DEBUG ((EFI_D_ERROR, "Detect CPU count: %d\n", mNumberOfProcessors));\r
 \r
   //\r