/* The constructor function caches the pointer to the SMM Periodic Timer Dispatch 2 Protocol and collects the list SMI tick rates that the hardware supports. */
EFI_STATUS EFIAPI SmmPeriodicSmiLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer to the SMM Periodic Timer Dispatch 2 Protocol and collects the list SMI tick rates that the hardware supports. */
EFI_STATUS EFIAPI SmmPeriodicSmiLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{
  LIST_ENTRY                            *Link;
  PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT  *PeriodicSmiLibraryHandler;
  if (gSmiTickPeriodTable != NULL) {
    FreePool (gSmiTickPeriodTable);
  }
  for (Link = GetFirstNode (&gPeriodicSmiLibraryHandlers); !IsNull (&gPeriodicSmiLibraryHandlers, Link);) {
    PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
    Link                      = GetNextNode (&gPeriodicSmiLibraryHandlers, Link);
    PeriodicSmiDisable (PeriodicSmiLibraryHandler->DispatchHandle);
  }
  for (Link = GetFirstNode (&gFreePeriodicSmiLibraryHandlers); !IsNull (&gFreePeriodicSmiLibraryHandlers, Link);) {
    PeriodicSmiLibraryHandler = PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT_FROM_LINK (Link);
    Link                      = RemoveEntryList (Link);
    FreePool (PeriodicSmiLibraryHandler);
  }
  return EFI_SUCCESS;
}