/*
- * 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 "base/trace.hh"
-#include "debug/BusAddrRanges.hh"
#include "dev/io_device.hh"
+
+#include "base/trace.hh"
+#include "debug/AddrRanges.hh"
#include "sim/system.hh"
PioPort::PioPort(PioDevice *dev)
Tick
PioPort::recvAtomic(PacketPtr pkt)
{
- return pkt->isRead() ? device->read(pkt) : device->write(pkt);
+ // 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 + receive_delay;
}
AddrRangeList
return MemObject::getSlavePort(if_name, idx);
}
-unsigned int
-PioDevice::drain(Event *de)
-{
- unsigned int count;
- count = pioPort.drain(de);
- if (count)
- changeState(Draining);
- else
- changeState(Drained);
- return count;
-}
-
-BasicPioDevice::BasicPioDevice(const Params *p)
- : PioDevice(p), pioAddr(p->pio_addr), pioSize(0),
+BasicPioDevice::BasicPioDevice(const Params *p, Addr size)
+ : PioDevice(p), pioAddr(p->pio_addr), pioSize(size),
pioDelay(p->pio_latency)
{}
{
assert(pioSize != 0);
AddrRangeList ranges;
- DPRINTF(BusAddrRanges, "registering range: %#x-%#x\n", pioAddr, pioSize);
+ DPRINTF(AddrRanges, "registering range: %#x-%#x\n", pioAddr, pioSize);
ranges.push_back(RangeSize(pioAddr, pioSize));
return ranges;
}