MdeModulePkg EhciDxe: Use common buffer for AsyncInterruptTransfer

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1274

In current code, EhcMonitorAsyncRequests (timer handler) will do
unmap and map operations for AsyncIntTransfers to "Flush data from
PCI controller specific address to mapped system memory address".
EhcMonitorAsyncRequests
  EhcFlushAsyncIntMap
    PciIo->Unmap
      IoMmu->SetAttribute
    PciIo->Map
      IoMmu->SetAttribute

This may impact the boot performance.

Since the data buffer for EhcMonitorAsyncRequests is internal
buffer, we can allocate common buffer by PciIo->AllocateBuffer
and map the buffer with EfiPciIoOperationBusMasterCommonBuffer,
then the unmap and map operations can be removed.

///
/// Provides both read and write access to system memory by
/// both the processor and a bus master. The buffer is coherent
/// from both the processor's and the bus master's point of view.
///
EfiPciIoOperationBusMasterCommonBuffer,

Test done:
USB KB works normally.
USB disk read/write works normally.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@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>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
Star Zeng
2018-10-25 16:20:34 +08:00
parent 7779209971
commit 0cd6452503
4 changed files with 57 additions and 95 deletions

View File

@@ -763,6 +763,7 @@ EhcControlTransfer (
Translator,
EHC_CTRL_TRANSFER,
Request,
FALSE,
Data,
*DataLength,
NULL,
@@ -906,6 +907,7 @@ EhcBulkTransfer (
Translator,
EHC_BULK_TRANSFER,
NULL,
FALSE,
Data[0],
*DataLength,
NULL,
@@ -1163,6 +1165,7 @@ EhcSyncInterruptTransfer (
Translator,
EHC_INT_TRANSFER_SYNC,
NULL,
FALSE,
Data,
*DataLength,
NULL,