/* This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group. When the Boot Manager is about to load and execute a boot option, it reclaims variable storage if free size is below the threshold. */
VOID EFIAPI OnReadyToBoot(EFI_EVENT Event, VOID *Context)
/* This is a notification function registered on EVT_GROUP_READY_TO_BOOT event group. When the Boot Manager is about to load and execute a boot option, it reclaims variable storage if free size is below the threshold. */
VOID EFIAPI OnReadyToBoot(EFI_EVENT Event, VOID *Context)
{
  EFI_STATUS  Status;
  if (!mEndOfDxe) {
    MorLockInitAtEndOfDxe ();
    Status = LockVariablePolicy ();
    ASSERT_EFI_ERROR (Status);
    mEndOfDxe               = TRUE;
    mVarCheckAddressPointer = VarCheckLibInitializeAtEndOfDxe (&mVarCheckAddressPointerCount);
    InitializeVariableQuota ();
  }
  ReclaimForOS ();
  if (FeaturePcdGet (PcdVariableCollectStatistics)) {
    if (mVariableModuleGlobal->VariableGlobal.AuthFormat) {
      gBS->InstallConfigurationTable (&gEfiAuthenticatedVariableGuid, gVariableInfo);
    } else {
      gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo);
    }
  }
  gBS->CloseEvent (Event);
}