]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c
MdeModulePkg/AtaAtapiPassThru: unmap DMA buffers after disabling BM DMA
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaAtapiPassThru / AtaAtapiPassThru.c
index b7fdb8dd487629e4e4ffc4dd4e62d2907bdeec08..a48b295d26aad4182641887eac68d5f74ebb1d3b 100644 (file)
@@ -913,12 +913,22 @@ AtaAtapiPassThruStop (
   //\r
   DestroyDeviceInfoList (Instance);\r
 \r
+  PciIo = Instance->PciIo;\r
+\r
+  //\r
+  // Disable this ATA host controller.\r
+  //\r
+  PciIo->Attributes (\r
+           PciIo,\r
+           EfiPciIoAttributeOperationDisable,\r
+           Instance->EnabledPciAttributes,\r
+           NULL\r
+           );\r
+\r
   //\r
   // If the current working mode is AHCI mode, then pre-allocated resource\r
   // for AHCI initialization should be released.\r
   //\r
-  PciIo = Instance->PciIo;\r
-\r
   if (Instance->Mode == EfiAtaAhciMode) {\r
     AhciRegisters = &Instance->AhciRegisters;\r
     PciIo->Unmap (\r
@@ -950,16 +960,6 @@ AtaAtapiPassThruStop (
              );\r
   }\r
 \r
-  //\r
-  // Disable this ATA host controller.\r
-  //\r
-  PciIo->Attributes (\r
-           PciIo,\r
-           EfiPciIoAttributeOperationDisable,\r
-           Instance->EnabledPciAttributes,\r
-           NULL\r
-           );\r
-\r
   //\r
   // Restore original PCI attributes\r
   //\r