/* This function may only be called at Runtime. */
EFI_STATUS EFIAPI MonotonicCounterDriverGetNextHighMonotonicCount(OUT UINT32 *HighCount)
/* This function may only be called at Runtime. */
EFI_STATUS EFIAPI MonotonicCounterDriverGetNextHighMonotonicCount(OUT UINT32 *HighCount)
{
  EFI_TPL  OldTpl;
  if (HighCount == NULL) {
    return EFI_INVALID_PARAMETER;
  }
  if (!EfiAtRuntime ()) {
    OldTpl     = gBS->RaiseTPL (TPL_HIGH_LEVEL);
    *HighCount = (UINT32)RShiftU64 (mEfiMtc, 32) + 1;
    mEfiMtc    = LShiftU64 (*HighCount, 32);
    gBS->RestoreTPL (OldTpl);
  } else {
    *HighCount = (UINT32)RShiftU64 (mEfiMtc, 32) + 1;
    mEfiMtc    = LShiftU64 (*HighCount, 32);
  }
  return EfiSetVariable (
           MTC_VARIABLE_NAME,
           &gMtcVendorGuid,
           EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
           sizeof (UINT32),
           HighCount
           );
}