dev-arm: Add a VExpress_GEM5_V2 platform with GICv3 support
[gem5.git] / src / dev / io_device.cc
index c25a28dd2f7ec6d7f268c733cc304e368856de98..28ea52aad6b5b729d3d092dbac56db2447038107 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012, 2015 ARM Limited
  * All rights reserved.
  *
  * The license below extends only to copyright in the software and shall
  *          Nathan Binkert
  */
 
+#include "dev/io_device.hh"
+
 #include "base/trace.hh"
 #include "debug/AddrRanges.hh"
-#include "dev/io_device.hh"
 #include "sim/system.hh"
 
 PioPort::PioPort(PioDevice *dev)
@@ -54,12 +55,14 @@ PioPort::PioPort(PioDevice *dev)
 Tick
 PioPort::recvAtomic(PacketPtr pkt)
 {
-    // @todo: We need to pay for this and not just zero it out
+    // technically the packet only reaches us after the header delay,
+    // and typically we also need to deserialise any payload
+    Tick receive_delay = pkt->headerDelay + pkt->payloadDelay;
     pkt->headerDelay = pkt->payloadDelay = 0;
 
     const Tick delay(pkt->isRead() ? device->read(pkt) : device->write(pkt));
     assert(pkt->isResponse() || pkt->isError());
-    return delay;
+    return delay + receive_delay;
 }
 
 AddrRangeList
@@ -93,18 +96,6 @@ PioDevice::getSlavePort(const std::string &if_name, PortID idx)
     return MemObject::getSlavePort(if_name, idx);
 }
 
-unsigned int
-PioDevice::drain(DrainManager *dm)
-{
-    unsigned int count;
-    count = pioPort.drain(dm);
-    if (count)
-        setDrainState(Drainable::Draining);
-    else
-        setDrainState(Drainable::Drained);
-    return count;
-}
-
 BasicPioDevice::BasicPioDevice(const Params *p, Addr size)
     : PioDevice(p), pioAddr(p->pio_addr), pioSize(size),
       pioDelay(p->pio_latency)