/* Checks APs status and updates APs status if needed.  */
VOID CheckAndUpdateApsStatus(VOID)
/* Checks APs status and updates APs status if needed.  */
VOID CheckAndUpdateApsStatus(VOID)
{
  UINTN        ProcessorNumber;
  EFI_STATUS   Status;
  CPU_MP_DATA  *CpuMpData;
  CpuMpData = GetCpuMpData ();
  if (CpuMpData->WaitEvent != NULL) {
    Status = CheckAllAPs ();
    if (Status != EFI_NOT_READY) {
      Status               = gBS->SignalEvent (CpuMpData->WaitEvent);
      CpuMpData->WaitEvent = NULL;
    }
  }
  for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) {
    if (CpuMpData->CpuData[ProcessorNumber].WaitEvent == NULL) {
      continue;
    }
    Status = CheckThisAP (ProcessorNumber);
    if (Status != EFI_NOT_READY) {
      gBS->SignalEvent (CpuMpData->CpuData[ProcessorNumber].WaitEvent);
      CpuMpData->CpuData[ProcessorNumber].WaitEvent = NULL;
    }
  }
}