Merge ktlim@zizzer:/bk/newmem
[gem5.git] / src / dev / io_device.hh
index 5836da3c98030ca65f8e590de262787a118c5067..cd2c25eeb7e95ae75ac02e6bde9f8da98f6315b4 100644 (file)
@@ -24,6 +24,9 @@
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Ali Saidi
+ *          Nathan Binkert
  */
 
 #ifndef __DEV_IO_DEVICE_HH__
@@ -118,10 +121,22 @@ class PioPort : public Port
 
 struct DmaReqState : public Packet::SenderState
 {
+    /** Event to call on the device when this transaction (all packets)
+     * complete. */
     Event *completionEvent;
+
+    /** Where we came from for some sanity checking. */
+    Port *outPort;
+
+    /** Total number of bytes that this transaction involves. */
+    Addr totBytes;
+
+    /** Number of bytes that have been acked for this transaction. */
+    Addr numBytes;
+
     bool final;
-    DmaReqState(Event *ce, bool f)
-        : completionEvent(ce), final(f)
+    DmaReqState(Event *ce, Port *p, Addr tb)
+        : completionEvent(ce), outPort(p), totBytes(tb), numBytes(0)
     {}
 };
 
@@ -152,7 +167,7 @@ class DmaPort : public Port
     virtual void getDeviceAddressRanges(AddrRangeList &resp, AddrRangeList &snoop)
     { resp.clear(); snoop.clear(); }
 
-    void sendDma(Packet *pkt);
+    void sendDma(Packet *pkt, bool front = false);
 
   public:
     DmaPort(DmaDevice *dev, Platform *p);
@@ -232,7 +247,7 @@ class PioDevice : public MemObject
 
     virtual void init();
 
-    virtual Port *getPort(const std::string &if_name)
+    virtual Port *getPort(const std::string &if_name, int idx = -1)
     {
         if (if_name == "pio") {
             if (pioPort != NULL)
@@ -294,7 +309,7 @@ class DmaDevice : public PioDevice
 
     bool dmaPending() { return dmaPort->dmaPending(); }
 
-    virtual Port *getPort(const std::string &if_name)
+    virtual Port *getPort(const std::string &if_name, int idx = -1)
     {
         if (if_name == "pio") {
             if (pioPort != NULL)