]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Sat, 4 Nov 2017 21:32:37 +0000 (21:32 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Mon, 6 Nov 2017 10:33:02 +0000 (10:33 +0000)
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>
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c

index 23faec5e2be0bbc9a317130822eecb0388f4fd4f..0be8828abfcca1d36a39c91501106bb6367db506 100644 (file)
@@ -1008,13 +1008,7 @@ SdMmcPassThruPassThru (
   }\r
 \r
 Done:\r
-  if ((Trb != NULL) && (Trb->AdmaDesc != NULL)) {\r
-    FreePages (Trb->AdmaDesc, Trb->AdmaPages);\r
-  }\r
-\r
-  if (Trb != NULL) {\r
-    FreePool (Trb);\r
-  }\r
+  SdMmcFreeTrb (Trb);\r
 \r
   return Status;\r
 }\r