/* Free the DMA resources allocated by an ATA AHCI controller. */
VOID AhciFreeDmaResource(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private)
/* Free the DMA resources allocated by an ATA AHCI controller. */
VOID AhciFreeDmaResource(IN PEI_AHCI_CONTROLLER_PRIVATE_DATA *Private)
{
  EFI_AHCI_REGISTERS  *AhciRegisters;
  ASSERT (Private != NULL);
  AhciRegisters = &Private->AhciRegisters;
  if (AhciRegisters->AhciRFisMap != NULL) {
    IoMmuFreeBuffer (
      EFI_SIZE_TO_PAGES (AhciRegisters->MaxRFisSize),
      AhciRegisters->AhciRFis,
      AhciRegisters->AhciRFisMap
      );
  }
  if (AhciRegisters->AhciCmdListMap != NULL) {
    IoMmuFreeBuffer (
      EFI_SIZE_TO_PAGES (AhciRegisters->MaxCmdListSize),
      AhciRegisters->AhciCmdList,
      AhciRegisters->AhciCmdListMap
      );
  }
  if (AhciRegisters->AhciCmdTableMap != NULL) {
    IoMmuFreeBuffer (
      EFI_SIZE_TO_PAGES (AhciRegisters->MaxCmdTableSize),
      AhciRegisters->AhciCmdTable,
      AhciRegisters->AhciCmdTableMap
      );
  }
}