/* Wheck whether task has been finished by all APs. */
BOOLEAN WaitForAllAPsNotBusy(IN BOOLEAN BlockMode)
/* Wheck whether task has been finished by all APs. */
BOOLEAN WaitForAllAPsNotBusy(IN BOOLEAN BlockMode)
{
  UINTN  Index;
  for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
    if (!IsPresentAp (Index)) {
      continue;
    }
    if (BlockMode) {
      AcquireSpinLock (mSmmMpSyncData->CpuData[Index].Busy);
      ReleaseSpinLock (mSmmMpSyncData->CpuData[Index].Busy);
    } else {
      if (AcquireSpinLockOrFail (mSmmMpSyncData->CpuData[Index].Busy)) {
        ReleaseSpinLock (mSmmMpSyncData->CpuData[Index].Busy);
      } else {
        return FALSE;
      }
    }
  }
  return TRUE;
}