UefiCpuPkg: Update CPU MP drivers to support single CPU configuration
[mirror_edk2.git] / UefiCpuPkg / CpuMpPei / CpuMpPei.c
index d5bc0c9b806af5672826c648c34dc580887081b1..8e35f288fe3c64fd235a84658a851671f6317029 100644 (file)
@@ -357,22 +357,28 @@ CountProcessorNumber (
   // Store BSP's MTRR setting\r
   //\r
   MtrrGetAllMtrrs (&PeiCpuMpData->MtrrTable);\r
+\r
   //\r
-  // Send broadcast IPI to APs to wakeup APs\r
-  //\r
-  PeiCpuMpData->InitFlag = 1;\r
-  WakeUpAP (PeiCpuMpData, TRUE, 0, NULL, NULL);\r
-  //\r
-  // Wait for AP task to complete and then exit.\r
-  //\r
-  MicroSecondDelay (PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds));\r
-  PeiCpuMpData->InitFlag  = 0;\r
-  PeiCpuMpData->CpuCount += (UINT32) PeiCpuMpData->MpCpuExchangeInfo->NumApsExecuting;\r
-  ASSERT (PeiCpuMpData->CpuCount <= PcdGet32(PcdCpuMaxLogicalProcessorNumber));\r
-  //\r
-  // Sort BSP/Aps by CPU APIC ID in ascending order\r
+  // Only perform AP detection if PcdCpuMaxLogicalProcessorNumber is greater than 1\r
   //\r
-  SortApicId (PeiCpuMpData);\r
+  if (PcdGet32 (PcdCpuMaxLogicalProcessorNumber) > 1) {\r
+    //\r
+    // Send broadcast IPI to APs to wakeup APs\r
+    //\r
+    PeiCpuMpData->InitFlag = 1;\r
+    WakeUpAP (PeiCpuMpData, TRUE, 0, NULL, NULL);\r
+    //\r
+    // Wait for AP task to complete and then exit.\r
+    //\r
+    MicroSecondDelay (PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds));\r
+    PeiCpuMpData->InitFlag = 0;\r
+    PeiCpuMpData->CpuCount += (UINT32)PeiCpuMpData->MpCpuExchangeInfo->NumApsExecuting;\r
+    ASSERT (PeiCpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber));\r
+    //\r
+    // Sort BSP/Aps by CPU APIC ID in ascending order\r
+    //\r
+    SortApicId (PeiCpuMpData);\r
+  }\r
 \r
   DEBUG ((EFI_D_INFO, "CpuMpPei: Find %d processors in system.\n", PeiCpuMpData->CpuCount));\r
   return PeiCpuMpData->CpuCount;\r