HalpDmaMapContiguousTransferV2

VOID __stdcall HalpDmaMapContiguousTransferV2(
        _ADAPTER_OBJECT *ChildAdapter,
        _MDL *Mdl,
        _HALP_DMA_TRANSLATION_ENTRY *TranslationBase,
        VOID *CurrentVa,
        UINT64 *Length,
        INT64 WriteToDevice,
        _LARGE_INTEGER *LogicalAddressOut){
  unsigned int v11; 
  unsigned int ContiguousPiece; 
  __int64 v13; 
  __int64 v14; 
  __int64 v15; 
  __int64 v16; 
  __int64 v17; 
  INT64 DeferFlushing; 
  INT64 DeferFlushinga; 
  INT64 a6; 
  INT64 a6a; 
  UINT8 CacheSyncOnly; 

  v11 = *(_DWORD *)Length;
  LODWORD(a6) = *(_DWORD *)Length;
  LOBYTE(DeferFlushing) = WriteToDevice;
  ContiguousPiece = HalpDmaNextContiguousPiece(ChildAdapter, Mdl, 0i64, CurrentVa, DeferFlushing, a6);
  v13 = (unsigned __int16)CurrentVa & 0xFFF;
  v14 = (unsigned int)(((unsigned __int64)CurrentVa - (unsigned __int64)Mdl->StartVa) >> 12);
  v15 = *((_QWORD *)&Mdl[1].Next + v14);
  if( ContiguousPiece == v11
    && ChildAdapter->AdapterObject.MaximumPhysicalAddress.QuadPart >= v13
                                                                    + (*((_QWORD *)&Mdl[1].Next + v14) << 12)
                                                                    + (unsigned __int64)ContiguousPiece
                                                                    - 1 )
  {
    if( (_BYTE)WriteToDevice
      || ChildAdapter->CacheCoherent
      || (v14 = (unsigned int)(HalpDmaGetAdapterCacheAlignment(ChildAdapter) - 1), (v14 & v17) == 0) && (v14 & v16) == 0 )
    {
      LOBYTE(a6a) = 0;
      LOBYTE(DeferFlushinga) = WriteToDevice;
      LogicalAddressOut->QuadPart = v13 + (v15 << 12);
      HalpDmaFlushBuffer(v14, Mdl, CurrentVa, v11, DeferFlushinga, a6a);
      return;
    }
  }
  LogicalAddressOut->QuadPart = v13 + TranslationBase->PhysicalAddress;
  if( (_BYTE)WriteToDevice )
  {
    CacheSyncOnly = 0;
    LOBYTE(a6a) = WriteToDevice;
  }
  else
  {
    if( ChildAdapter->CacheCoherent )
      return;
    CacheSyncOnly = 1;
    LOBYTE(a6a) = 0;
  }
  LODWORD(DeferFlushinga) = v11;
  HalpDmaSyncMapBuffers(ChildAdapter, Mdl, CurrentVa, TranslationBase, DeferFlushinga, a6a, CacheSyncOnly, 0);
}

Referenced by:

HalpMapTransferV2