diff options
author | Laszlo Ersek <lersek@redhat.com> | 2017-09-07 21:04:29 +0200 |
---|---|---|
committer | Laszlo Ersek <lersek@redhat.com> | 2017-09-08 20:22:35 +0200 |
commit | 509daa658b79b21eb1ccd6230065867e22707a42 (patch) | |
tree | b26b9b216f35707a376366380651b8577765fe10 /MdeModulePkg/Bus/Ata/AtaAtapiPassThru | |
parent | eed3f713052204e31f1c4703ef544897881c552e (diff) | |
download | edk2-509daa658b79b21eb1ccd6230065867e22707a42.zip edk2-509daa658b79b21eb1ccd6230065867e22707a42.tar.gz edk2-509daa658b79b21eb1ccd6230065867e22707a42.tar.bz2 |
MdeModulePkg/AtaAtapiPassThru: unmap DMA buffers after disabling BM DMA
In AtaAtapiPassThruStop(), if the device has been operating in AHCI mode,
we unmap the DMA buffers and then disable the device (including bus master
DMA). The order of these actions is wrong; we shouldn't unmap DMA buffers
until bus master DMA is turned off. Reverse the steps.
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'MdeModulePkg/Bus/Ata/AtaAtapiPassThru')
-rw-r--r-- | MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c index b7fdb8d..a48b295 100644 --- a/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c +++ b/MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.c @@ -913,12 +913,22 @@ AtaAtapiPassThruStop ( //
DestroyDeviceInfoList (Instance);
+ PciIo = Instance->PciIo;
+
+ //
+ // Disable this ATA host controller.
+ //
+ PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationDisable,
+ Instance->EnabledPciAttributes,
+ NULL
+ );
+
//
// If the current working mode is AHCI mode, then pre-allocated resource
// for AHCI initialization should be released.
//
- PciIo = Instance->PciIo;
-
if (Instance->Mode == EfiAtaAhciMode) {
AhciRegisters = &Instance->AhciRegisters;
PciIo->Unmap (
@@ -951,16 +961,6 @@ AtaAtapiPassThruStop ( }
//
- // Disable this ATA host controller.
- //
- PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationDisable,
- Instance->EnabledPciAttributes,
- NULL
- );
-
- //
// Restore original PCI attributes
//
Status = PciIo->Attributes (
|