MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation

Currently, we complete a synchronous operation without unmapping the
DMA mappings, and free the pages using FreePages () rather than calling
EFI_PCI_IO_PROTOCOL::FreeBuffer. This is simply incorrect, but it also
breaks non-coherent DMA as well as DMA protection and/or memory encryption
so let's do it correctly and call SdMmcFreeTrb() instead.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
This commit is contained in:
Ard Biesheuvel 2017-11-04 21:32:37 +00:00
parent 6fe575d052
commit 6743455e34

View File

@ -1008,13 +1008,7 @@ SdMmcPassThruPassThru (
}
Done:
if ((Trb != NULL) && (Trb->AdmaDesc != NULL)) {
FreePages (Trb->AdmaDesc, Trb->AdmaPages);
}
if (Trb != NULL) {
FreePool (Trb);
}
SdMmcFreeTrb (Trb);
return Status;
}