/* This return the handle number for the calling processor. */
EFI_STATUS EFIAPI SmmWhoAmI(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, OUT UINTN *ProcessorNumber)
/* This return the handle number for the calling processor. */
EFI_STATUS EFIAPI SmmWhoAmI(IN CONST EFI_SMM_CPU_SERVICE_PROTOCOL *This, OUT UINTN *ProcessorNumber)
{
  UINTN   Index;
  UINT64  ApicId;
  if (ProcessorNumber == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  ApicId = GetApicId ();
  for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
    if (gSmmCpuPrivate->ProcessorInfo[Index].ProcessorId == ApicId) {
      *ProcessorNumber = Index;
      return EFI_SUCCESS;
    }
  }
  ASSERT (FALSE);
  return EFI_NOT_FOUND;
}