public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation
@ 2017-11-05  9:30 Ard Biesheuvel
  2017-11-06  1:12 ` Wu, Hao A
  2017-11-06  8:56 ` Zeng, Star
  0 siblings, 2 replies; 4+ messages in thread
From: Ard Biesheuvel @ 2017-11-05  9:30 UTC (permalink / raw)
  To: edk2-devel; +Cc: feng.tian, star.zeng, eric.dong, Ard Biesheuvel

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 incorrecnt, 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>
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
index 23faec5e2be0..0be8828abfcc 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
@@ -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;
 }
-- 
2.11.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-06 10:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-05  9:30 [PATCH v2] MdeModulePkg/SdMmcPciHcDxe: call SdMmcFreeTrb() to complete sync operation Ard Biesheuvel
2017-11-06  1:12 ` Wu, Hao A
2017-11-06  8:56 ` Zeng, Star
2017-11-06 10:34   ` Ard Biesheuvel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox