X86: Extend mov2int and mov2fp so they can support insert and extract instructions.
[gem5.git] / src / dev / copy_engine.cc
index 46d3127e74621e746d73beeb2c3820bf377551a2..3c759ac1dfe16125c9fb1a311ebd781c6cd4db9a 100644 (file)
@@ -34,6 +34,7 @@
 
 #include <algorithm>
 
+#include "base/cp_annotate.hh"
 #include "base/trace.hh"
 #include "dev/copy_engine.hh"
 #include "mem/packet.hh"
@@ -427,6 +428,8 @@ CopyEngine::regStats()
 void
 CopyEngine::CopyEngineChannel::fetchDescriptor(Addr address)
 {
+    anDq();
+    anBegin("FetchDescriptor");
     DPRINTF(DMACopyEngine, "Reading descriptor from at memory location %#x(%#x)\n",
            address, ce->platform->pciToDma(address));
     assert(address);
@@ -455,6 +458,8 @@ CopyEngine::CopyEngineChannel::fetchDescComplete()
             if (inDrain()) return;
             writeCompletionStatus();
         } else {
+            anBegin("Idle");
+            anWait();
             busy = false;
             nextState = Idle;
             inDrain();
@@ -473,6 +478,7 @@ CopyEngine::CopyEngineChannel::fetchDescComplete()
 void
 CopyEngine::CopyEngineChannel::readCopyBytes()
 {
+    anBegin("ReadCopyBytes");
     DPRINTF(DMACopyEngine, "Reading %d bytes from buffer to memory location %#x(%#x)\n",
            curDmaDesc->len, curDmaDesc->dest,
            ce->platform->pciToDma(curDmaDesc->src));
@@ -493,6 +499,7 @@ CopyEngine::CopyEngineChannel::readCopyBytesComplete()
 void
 CopyEngine::CopyEngineChannel::writeCopyBytes()
 {
+    anBegin("WriteCopyBytes");
     DPRINTF(DMACopyEngine, "Writing %d bytes from buffer to memory location %#x(%#x)\n",
            curDmaDesc->len, curDmaDesc->dest,
            ce->platform->pciToDma(curDmaDesc->dest));
@@ -513,6 +520,8 @@ CopyEngine::CopyEngineChannel::writeCopyBytesComplete()
     cr.status.compl_desc_addr(lastDescriptorAddr >> 6);
     completionDataReg = cr.status() | 1;
 
+    anQ("DMAUsedDescQ", channelId, 1);
+    anQ("AppRecvQ", curDmaDesc->user1, curDmaDesc->len);
     if (curDmaDesc->command & DESC_CTRL_CP_STS) {
         nextState = CompletionWrite;
         if (inDrain()) return;
@@ -529,6 +538,8 @@ CopyEngine::CopyEngineChannel::continueProcessing()
     busy = false;
 
     if (underReset) {
+        anBegin("Reset");
+        anWait();
         underReset = false;
         refreshNext = false;
         busy = false;
@@ -549,12 +560,15 @@ CopyEngine::CopyEngineChannel::continueProcessing()
     } else {
         inDrain();
         nextState = Idle;
+        anWait();
+        anBegin("Idle");
     }
 }
 
 void
 CopyEngine::CopyEngineChannel::writeCompletionStatus()
 {
+    anBegin("WriteCompletionStatus");
     DPRINTF(DMACopyEngine, "Writing completion status %#x to address %#x(%#x)\n",
             completionDataReg, cr.completionAddr,
             ce->platform->pciToDma(cr.completionAddr));
@@ -574,6 +588,7 @@ CopyEngine::CopyEngineChannel::writeStatusComplete()
 void
 CopyEngine::CopyEngineChannel::fetchNextAddr(Addr address)
 {
+    anBegin("FetchNextAddr");
     DPRINTF(DMACopyEngine, "Fetching next address...\n");
     busy = true;
     cePort->dmaAction(MemCmd::ReadReq, ce->platform->pciToDma(address +
@@ -590,6 +605,8 @@ CopyEngine::CopyEngineChannel::fetchAddrComplete()
         DPRINTF(DMACopyEngine, "Got NULL descriptor, nothing more to do\n");
         busy = false;
         nextState = Idle;
+        anWait();
+        anBegin("Idle");
         inDrain();
         return;
     }