changeset 7cbe0e2f6b86 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=7cbe0e2f6b86
description:
        MEM: Explicit ports and Python binding on CopyEngine

        The copy-engine ports were previously created implicitly and bound
        based on the dma port peer rather than relying on the normal Python
        binding (connectPorts) being called explicitly. This patch makes the
        copy engine port similar to all other ports in that they are visibly
        in the Python class and bound using the normal explicit calls through
        Python.

diffstat:

 src/dev/CopyEngine.py  |   1 +
 src/dev/copy_engine.cc |  40 ++++++++++++++++++++++++++--------------
 src/dev/copy_engine.hh |  17 +++++++++++++++--
 3 files changed, 42 insertions(+), 16 deletions(-)

diffs (117 lines):

diff -r b62d40514d98 -r 7cbe0e2f6b86 src/dev/CopyEngine.py
--- a/src/dev/CopyEngine.py     Mon Feb 13 06:45:11 2012 -0500
+++ b/src/dev/CopyEngine.py     Mon Feb 13 06:46:43 2012 -0500
@@ -33,6 +33,7 @@
 
 class CopyEngine(PciDevice):
     type = 'CopyEngine'
+    dma = VectorMasterPort("Copy engine DMA port")
     VendorID = 0x8086
     DeviceID = 0x1a38
     Revision = 0xA2 # CM2 stepping (newest listed)
diff -r b62d40514d98 -r 7cbe0e2f6b86 src/dev/copy_engine.cc
--- a/src/dev/copy_engine.cc    Mon Feb 13 06:45:11 2012 -0500
+++ b/src/dev/copy_engine.cc    Mon Feb 13 06:46:43 2012 -0500
@@ -1,4 +1,16 @@
 /*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
  * Copyright (c) 2008 The Regents of The University of Michigan
  * All rights reserved.
  *
@@ -65,7 +77,7 @@
 
 
 CopyEngine::CopyEngineChannel::CopyEngineChannel(CopyEngine *_ce, int cid)
-    : ce(_ce), channelId(cid), busy(false), underReset(false),
+    : cePort(NULL), ce(_ce), channelId(cid), busy(false), underReset(false),
     refreshNext(false), latBeforeBegin(ce->params()->latBeforeBegin),
     latAfterCompletion(ce->params()->latAfterCompletion),
     completionDataReg(0), nextState(Idle), drainEvent(NULL),
@@ -97,24 +109,24 @@
     delete cePort;
 }
 
-void
-CopyEngine::init()
+Port *
+CopyEngine::getPort(const std::string &if_name, int idx)
 {
-    PciDev::init();
-    for (int x = 0; x < chan.size(); x++)
-        chan[x]->init();
+    if (if_name == "dma") {
+        if (idx < chan.size())
+            return chan[idx]->getPort();
+    }
+    return PciDev::getPort(if_name, idx);
 }
 
-void
-CopyEngine::CopyEngineChannel::init()
+
+Port *
+CopyEngine::CopyEngineChannel::getPort()
 {
-    Port *peer;
-
+    assert(cePort == NULL);
     cePort = new DmaPort(ce, ce->sys, ce->params()->min_backoff_delay,
-            ce->params()->max_backoff_delay);
-    peer = ce->dmaPort->getPeer()->getOwner()->getPort("");
-    peer->setPeer(cePort);
-    cePort->setPeer(peer);
+                         ce->params()->max_backoff_delay);
+    return cePort;
 }
 
 void
diff -r b62d40514d98 -r 7cbe0e2f6b86 src/dev/copy_engine.hh
--- a/src/dev/copy_engine.hh    Mon Feb 13 06:45:11 2012 -0500
+++ b/src/dev/copy_engine.hh    Mon Feb 13 06:46:43 2012 -0500
@@ -1,4 +1,16 @@
 /*
+ * Copyright (c) 2012 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
  * Copyright (c) 2008 The Regents of The University of Michigan
  * All rights reserved.
  *
@@ -82,7 +94,7 @@
       public:
         CopyEngineChannel(CopyEngine *_ce, int cid);
         virtual ~CopyEngineChannel();
-        void init();
+        Port *getPort();
 
         std::string name() { assert(ce); return ce->name() + 
csprintf("-chan%d", channelId); }
         virtual Tick read(PacketPtr pkt)
@@ -183,7 +195,8 @@
     ~CopyEngine();
 
     void regStats();
-    void init();
+
+    virtual Port *getPort(const std::string &if_name, int idx = -1);
 
     virtual Tick read(PacketPtr pkt);
     virtual Tick write(PacketPtr pkt);
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to