HalpDmaFlushScatterTransferV3

VOID __stdcall HalpDmaFlushScatterTransferV3(
        _ADAPTER_OBJECT *ChildAdapter,
        _MDL *Mdl,
        _HALP_DMA_TRANSLATION_ENTRY *TranslationBase,
        VOID *CurrentVa,
        UINT64 Length,
        INT64 WriteToDevice,
        INT64 DeferFlushing,
        _HALP_DMA_TRANSLATION_ENTRY **NextMappingOut){
  int i; 
  _HALP_DMA_TRANSLATION_ENTRY *NextMapping; 
  __int64 ContiguousPiece; 
  __int64 v15; 
  __int64 v16; 
  unsigned __int8 CacheCoherent; 
  int v18; 
  _HALP_DMA_TRANSLATION_ENTRY *v19; 
  __int64 v20; 
  unsigned __int64 v21; 
  __int64 v22; 
  INT64 v23; 
  UINT64 v24; 

  if( (TranslationBase || !ChildAdapter->CacheCoherent) && !(_BYTE)WriteToDevice )
  {
    for( i = Length; i; i -= ContiguousPiece )
    {
      if( TranslationBase )
        NextMapping = TranslationBase->NextMapping;
      else
        NextMapping = 0i64;
      LODWORD(v24) = i;
      LOBYTE(v23) = 0;
      ContiguousPiece = (unsigned int)HalpDmaNextContiguousPiece(ChildAdapter, Mdl, NextMapping, CurrentVa, v23, v24);
      v15 = (unsigned __int16)CurrentVa & 0xFFF;
      v16 = (unsigned int)(((unsigned __int64)CurrentVa - (unsigned __int64)Mdl->StartVa) >> 12);
      if( ChildAdapter->AdapterObject.MaximumPhysicalAddress.QuadPart < (unsigned __int64)(v15
                                                                                          + (*((_QWORD *)&Mdl[1].Next
                                                                                             + v16) << 12)
                                                                                          + ContiguousPiece
                                                                                          - 1)
        && ChildAdapter->TranslationType != ExtTranslationTypeTranslate
        || (CacheCoherent = ChildAdapter->CacheCoherent) == 0
        && ((LODWORD(v16) = HalpDmaGetAdapterCacheAlignment(ChildAdapter) - 1, ((unsigned int)v16 & v18) != 0)
         || ((unsigned int)v16 & (unsigned int)ContiguousPiece) != 0)
        || TranslationBase && TranslationBase->LogicalBounceBufferPremapped )
      {
        LOBYTE(v24) = 0;
        LODWORD(v23) = ContiguousPiece;
        HalpDmaSyncMapBuffers(ChildAdapter, Mdl, CurrentVa, TranslationBase->NextMapping, v23, v24, 0, DeferFlushing);
        v19 = TranslationBase->NextMapping;
        v20 = ContiguousPiece;
        v21 = (unsigned __int64)(ContiguousPiece + v15 + 4095) >> 12;
        if( (_DWORD)v21 )
        {
          v22 = (unsigned int)v21;
          do
          {
            v19 = v19->Next;
            --v22;
          }
          while( v22 );
        }
        TranslationBase->NextMapping = v19;
      }
      else
      {
        if( !CacheCoherent )
        {
          LOBYTE(v24) = DeferFlushing;
          LOBYTE(v23) = 0;
          HalpDmaFlushBuffer(v16, Mdl, CurrentVa, (unsigned int)ContiguousPiece, v23, v24);
        }
        v20 = ContiguousPiece;
      }
      CurrentVa = (char *)CurrentVa + v20;
    }
    if( NextMappingOut )
    {
      if( TranslationBase )
        *NextMappingOut = TranslationBase->NextMapping;
      else
        *NextMappingOut = 0i64;
    }
    if( TranslationBase )
      TranslationBase->NextMapping = TranslationBase;
  }
}

Referenced by:

HalFlushAdapterBuffersEx
IoFlushAdapterBuffersV3