HalpDmaMapScatterTransferV2

VOID __stdcall HalpDmaMapScatterTransferV2(
        _ADAPTER_OBJECT *ChildAdapter,
        _MDL *Mdl,
        _HALP_DMA_TRANSLATION_ENTRY *TranslationBase,
        VOID *CurrentVa,
        UINT64 *Length,
        INT64 WriteToDevice,
        _LARGE_INTEGER *LogicalAddressOut){
  unsigned int ContiguousPiece; 
  unsigned int v12; 
  __int64 v13; 
  __int64 v14; 
  LONGLONG v15; 
  __int64 v16; 
  __int64 v17; 
  _HALP_DMA_TRANSLATION_ENTRY *NextMapping; 
  _HALP_DMA_TRANSLATION_ENTRY *v19; 
  unsigned __int64 v20; 
  __int64 v21; 
  bool v22; 
  INT64 v23; 
  INT64 v24; 
  UINT64 v25; 
  INT64 v26; 
  UINT8 CacheSyncOnly; 

  LODWORD(v25) = *(_DWORD *)Length;
  LOBYTE(v23) = WriteToDevice;
  ContiguousPiece = HalpDmaNextContiguousPiece(ChildAdapter, Mdl, TranslationBase, CurrentVa, v23, v25);
  v12 = ContiguousPiece;
  *(_DWORD *)Length = ContiguousPiece;
  v13 = (unsigned __int16)CurrentVa & 0xFFF;
  v14 = (unsigned int)(((unsigned __int64)CurrentVa - (unsigned __int64)Mdl->StartVa) >> 12);
  v15 = v13 + (*((_QWORD *)&Mdl[1].Next + v14) << 12);
  if( TranslationBase )
  {
    v16 = ContiguousPiece;
    if( ChildAdapter->AdapterObject.MaximumPhysicalAddress.QuadPart < (unsigned __int64)ContiguousPiece + v15 - 1
      || !(_BYTE)WriteToDevice
      && !ChildAdapter->CacheCoherent
      && ((v14 = (unsigned int)(HalpDmaGetAdapterCacheAlignment(ChildAdapter) - 1), (v14 & v15) != 0) || (v17 & v14) != 0) )
    {
      NextMapping = TranslationBase->NextMapping;
      LogicalAddressOut->QuadPart = v13 + NextMapping->PhysicalAddress;
      if( (_BYTE)WriteToDevice )
      {
        CacheSyncOnly = 0;
        LOBYTE(v26) = WriteToDevice;
      }
      else
      {
        if( ChildAdapter->CacheCoherent )
        {
LABEL_12:
          v19 = TranslationBase->NextMapping;
          v20 = (unsigned __int64)(v16 + v13 + 4095) >> 12;
          if( (_DWORD)v20 )
          {
            v21 = (unsigned int)v20;
            do
            {
              v19 = v19->Next;
              --v21;
            }
            while( v21 );
          }
          TranslationBase->NextMapping = v19;
          return;
        }
        CacheSyncOnly = 1;
        LOBYTE(v26) = 0;
      }
      LODWORD(v24) = v12;
      HalpDmaSyncMapBuffers(ChildAdapter, Mdl, CurrentVa, NextMapping, v24, v26, CacheSyncOnly, 0);
      goto LABEL_12;
    }
  }
  v22 = ChildAdapter->CacheCoherent == 0;
  LogicalAddressOut->QuadPart = v15;
  if( v22 )
  {
    LOBYTE(v26) = 0;
    LOBYTE(v24) = WriteToDevice;
    HalpDmaFlushBuffer(v14, Mdl, CurrentVa, v12, v24, v26);
  }
}

Referenced by:

HalpMapTransferV2