]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg XhciDxe: Fix Map and Unmap inconsistency
authorStar Zeng <star.zeng@intel.com>
Thu, 24 Aug 2017 09:42:49 +0000 (17:42 +0800)
committerStar Zeng <star.zeng@intel.com>
Fri, 25 Aug 2017 09:09:23 +0000 (17:09 +0800)
We found there are loops of *2* Maps and only *1* Unmap and
the DMA buffer address is decreasing.

It is caused by the below code flow.
XhcAsyncInterruptTransfer ->
  XhcCreateUrb ->
    XhcCreateTransferTrb ->
      Map Urb->DataMap           (1)

Timer: loops of *2* Maps and only *1* Unmap
XhcMonitorAsyncRequests ->
  XhcFlushAsyncIntMap ->
    Unmap and Map Urb->DataMap   (2)
  XhcUpdateAsyncRequest ->
    XhcCreateTransferTrb ->
      Map Urb->DataMap           (3)

This patch is to eliminate (3).

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c

index 6013d7620fe5f3d89c6d7e6bbe8599d8f79e105d..21fdcf130a5000e4e7df41ec59d9a629d53b9237 100644 (file)
@@ -259,8 +259,11 @@ XhcCreateTransferTrb (
   } else {\r
     EPType  = (UINT8) ((DEVICE_CONTEXT_64 *)OutputContext)->EP[Dci-1].EPType;\r
   }\r
   } else {\r
     EPType  = (UINT8) ((DEVICE_CONTEXT_64 *)OutputContext)->EP[Dci-1].EPType;\r
   }\r
-  \r
-  if (Urb->Data != NULL) {\r
+\r
+  //\r
+  // No need to remap.\r
+  //\r
+  if ((Urb->Data != NULL) && (Urb->DataMap == NULL)) {\r
     if (((UINT8) (Urb->Ep.Direction)) == EfiUsbDataIn) {\r
       MapOp = EfiPciIoOperationBusMasterWrite;\r
     } else {\r
     if (((UINT8) (Urb->Ep.Direction)) == EfiUsbDataIn) {\r
       MapOp = EfiPciIoOperationBusMasterWrite;\r
     } else {\r