HalpDmaFlushContiguousTransferV2

VOID __stdcall HalpDmaFlushContiguousTransferV2(
        _ADAPTER_OBJECT *ChildAdapter,
        _MDL *Mdl,
        _HALP_DMA_TRANSLATION_ENTRY *TranslationBase,
        VOID *CurrentVa,
        UINT64 Length,
        INT64 WriteToDevice){
  unsigned int ContiguousPiece; 
  __int64 v11; 
  __int64 v12; 
  __int64 v13; 
  UINT8 CacheSyncOnly; 
  char v15; 
  INT64 DeferFlushing; 
  INT64 DeferFlushinga; 
  INT64 a6; 
  INT64 a6a; 

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

Referenced by:

IoFlushAdapterBuffersV2