return EFI_NOT_FOUND;\r
}\r
\r
+/**\r
+ * Calculated and stalled the interval time by BSP to check whether\r
+ * the APs have finished.\r
+ *\r
+ * @param[in] Timeout The time limit in microseconds for\r
+ * APs to return from Procedure.\r
+ *\r
+ * @retval StallTime Time of execution stall.\r
+**/\r
+UINTN\r
+CalculateAndStallInterval (\r
+ IN UINTN Timeout\r
+ )\r
+{\r
+ UINTN StallTime;\r
\r
+ if (Timeout < gPollInterval && Timeout != 0) {\r
+ StallTime = Timeout;\r
+ } else {\r
+ StallTime = gPollInterval;\r
+ }\r
+ gBS->Stall (StallTime);\r
\r
+ return StallTime;\r
+}\r
\r
/**\r
This service retrieves the number of logical processor in the platform\r
UINTN NextNumber;\r
PROCESSOR_STATE APInitialState;\r
PROCESSOR_STATE ProcessorState;\r
- INTN Timeout;\r
+ UINTN Timeout;\r
\r
\r
if (!IsBSP ()) {\r
goto Done;\r
}\r
\r
- if ((TimeoutInMicroseconds != 0) && (Timeout < 0)) {\r
+ if ((TimeoutInMicroseconds != 0) && (Timeout == 0)) {\r
Status = EFI_TIMEOUT;\r
goto Done;\r
}\r
\r
- gBS->Stall (gPollInterval);\r
- Timeout -= gPollInterval;\r
+ Timeout -= CalculateAndStallInterval (Timeout);\r
}\r
\r
Done:\r
OUT BOOLEAN *Finished OPTIONAL\r
)\r
{\r
- INTN Timeout;\r
+ UINTN Timeout;\r
\r
if (!IsBSP ()) {\r
return EFI_DEVICE_ERROR;\r
\r
gThread->MutexUnlock (gMPSystem.ProcessorData[ProcessorNumber].StateLock);\r
\r
- if ((TimeoutInMicroseconds != 0) && (Timeout < 0)) {\r
+ if ((TimeoutInMicroseconds != 0) && (Timeout == 0)) {\r
return EFI_TIMEOUT;\r
}\r
\r
- gBS->Stall (gPollInterval);\r
- Timeout -= gPollInterval;\r
+ Timeout -= CalculateAndStallInterval (Timeout);\r
}\r
\r
return EFI_SUCCESS;\r
BOOLEAN Found;\r
\r
if (gMPSystem.TimeoutActive) {\r
- gMPSystem.Timeout -= gPollInterval;\r
+ gMPSystem.Timeout -= CalculateAndStallInterval (gMPSystem.Timeout);\r
}\r
\r
for (ProcessorNumber = 0; ProcessorNumber < gMPSystem.NumberOfProcessors; ProcessorNumber++) {\r
}\r
}\r
\r
- if (gMPSystem.TimeoutActive && gMPSystem.Timeout < 0) {\r
+ if (gMPSystem.TimeoutActive && gMPSystem.Timeout == 0) {\r
//\r
// Timeout\r
//\r