/* This routine wait for all AP processors to arrive in SMM. */
EFI_STATUS EFIAPI SmmWaitForAllProcessor(IN BOOLEAN BlockingMode)
/* This routine wait for all AP processors to arrive in SMM. */
EFI_STATUS EFIAPI SmmWaitForAllProcessor(IN BOOLEAN BlockingMode)
{
  EFI_STATUS  Status;
  if ((mRegistration == NULL) && (mSmmCpuRendezvous == NULL)) {
    Status = gMmst->MmLocateProtocol (
                      &gEdkiiSmmCpuRendezvousProtocolGuid,
                      NULL,
                      (VOID **)&mSmmCpuRendezvous
                      );
    if (EFI_ERROR (Status)) {
      Status = gMmst->MmRegisterProtocolNotify (
                        &gEdkiiSmmCpuRendezvousProtocolGuid,
                        SmmCpuRendezvousProtocolNotify,
                        &mRegistration
                        );
      if (EFI_ERROR (Status)) {
        return Status;
      }
    }
  }
  if (mSmmCpuRendezvous == NULL) {
    return EFI_SUCCESS;
  }
  Status = mSmmCpuRendezvous->WaitForAllProcessor (
                                mSmmCpuRendezvous,
                                BlockingMode
                                );
  return Status;
}