/* Search for the next AP that is put in waiting state by single-threaded StartupAllAPs(). */
EFI_STATUS GetNextWaitingProcessorNumber(OUT UINTN *NextProcessorNumber)
/* Search for the next AP that is put in waiting state by single-threaded StartupAllAPs(). */
EFI_STATUS GetNextWaitingProcessorNumber(OUT UINTN *NextProcessorNumber)
{
  UINTN        ProcessorNumber;
  CPU_MP_DATA  *CpuMpData;
  CpuMpData = GetCpuMpData ();
  for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) {
    if (CpuMpData->CpuData[ProcessorNumber].Waiting) {
      *NextProcessorNumber = ProcessorNumber;
      return EFI_SUCCESS;
    }
  }
  return EFI_NOT_FOUND;
}