// faster than a CPU we could get two responses before
// next_tick expires
if (!retryEvent.scheduled())
- schedule(retryEvent, next_tick);
+ cpu->schedule(retryEvent, next_tick);
return false;
}
}
else if (backoffTime < maxBackoffDelay)
backoffTime <<= 1;
- reschedule(backoffEvent, curTick() + backoffTime, true);
+ device->reschedule(backoffEvent, curTick() + backoffTime, true);
DPRINTF(DMA, "Backoff time set to %d ticks\n", backoffTime);
if (state->totBytes == state->numBytes) {
if (state->completionEvent) {
if (state->delay)
- schedule(state->completionEvent, curTick() + state->delay);
+ device->schedule(state->completionEvent,
+ curTick() + state->delay);
else
state->completionEvent->process();
}
if (transmitList.size() && backoffTime && !inRetry) {
DPRINTF(DMA, "Scheduling backoff for %d\n", curTick()+backoffTime);
if (!backoffEvent.scheduled())
- schedule(backoffEvent, backoffTime + curTick());
+ device->schedule(backoffEvent, backoffTime + curTick());
}
DPRINTF(DMA, "TransmitList: %d, backoffTime: %d inRetry: %d es: %d\n",
transmitList.size(), backoffTime, inRetry,
!backoffEvent.scheduled()) {
DPRINTF(DMA, "-- Scheduling backoff timer for %d\n",
backoffTime+curTick());
- schedule(backoffEvent, backoffTime + curTick());
+ device->schedule(backoffEvent, backoffTime + curTick());
}
} else if (state == Enums::atomic) {
transmitList.pop_front();
if (state->totBytes == state->numBytes) {
if (state->completionEvent) {
assert(!state->completionEvent->scheduled());
- schedule(state->completionEvent, curTick() + lat + state->delay);
+ device->schedule(state->completionEvent,
+ curTick() + lat + state->delay);
}
delete state;
delete pkt->req;
// nothing on the list, add it and we're done
if (sendQueue.empty()) {
assert(!sendEvent.scheduled());
- schedule(sendEvent, readyTime);
+ bridge->schedule(sendEvent, readyTime);
sendQueue.push_back(buf);
return;
}
while (i != end && !done) {
if (readyTime < (*i)->ready) {
if (i == begin)
- reschedule(sendEvent, readyTime);
+ bridge->reschedule(sendEvent, readyTime);
sendQueue.insert(i,buf);
done = true;
}
// should already be an event scheduled for sending the head
// packet.
if (sendQueue.empty()) {
- schedule(sendEvent, readyTime);
+ bridge->schedule(sendEvent, readyTime);
}
sendQueue.push_back(buf);
}
if (!sendQueue.empty()) {
buf = sendQueue.front();
DPRINTF(BusBridge, "Scheduling next send\n");
- schedule(sendEvent, std::max(buf->ready, curTick() + 1));
+ bridge->schedule(sendEvent, std::max(buf->ready, curTick() + 1));
}
} else {
DPRINTF(BusBridge, " unsuccessful\n");
if (nextReady <= curTick())
trySend();
else
- schedule(sendEvent, nextReady);
+ bridge->schedule(sendEvent, nextReady);
}
/** Function called by the port when the bus is receiving a Atomic
mustSendRetry = false;
SendRetryEvent *ev = new SendRetryEvent(this, true);
// @TODO: need to find a better time (next bus cycle?)
- schedule(ev, curTick() + 1);
+ cache->schedule(ev, curTick() + 1);
}
}
// @TODO: need to facotr in prefetch requests here somehow
if (nextReady != MaxTick) {
DPRINTF(CachePort, "more packets to send @ %d\n", nextReady);
- schedule(sendEvent, std::max(nextReady, curTick() + 1));
+ cache->schedule(sendEvent, std::max(nextReady, curTick() + 1));
} else {
// no more to send right now: if we're draining, we may be done
if (drainEvent && !sendEvent->scheduled()) {
DefaultPeerPort defaultPeerPort;
Port::Port(const std::string &_name, MemObject *_owner)
- : EventManager(_owner), portName(_name), peer(&defaultPeerPort),
- owner(_owner)
+ : portName(_name), peer(&defaultPeerPort), owner(_owner)
{
}
void
Port::setOwner(MemObject *_owner)
{
- eventq = _owner->queue();
owner = _owner;
}
#include "base/types.hh"
#include "mem/packet.hh"
#include "mem/request.hh"
-#include "sim/eventq.hh"
/** This typedef is used to clean up the parameter list of
* getDeviceAddressRanges() and getPeerAddressRanges(). It's declared
typedef std::list<Range<Addr> > AddrRangeList;
typedef std::list<Range<Addr> >::iterator AddrRangeIter;
-class EventQueue;
class MemObject;
/**
* Send accessor functions are being called from the device the port is
* associated with, and it will call the peer recv. accessor function.
*/
-class Port : public EventManager
+class Port
{
protected:
/** Descriptive name (for DPRINTF output) */
*/
#include "debug/Bus.hh"
+#include "mem/mem_object.hh"
#include "mem/tport.hh"
using namespace std;
SimpleTimingPort::SimpleTimingPort(string pname, MemObject *_owner)
- : Port(pname, _owner), sendEvent(0), drainEvent(NULL),
+ : Port(pname, _owner), sendEvent(NULL), drainEvent(NULL),
waitingOnRetry(false)
{
sendEvent = new EventWrapper<SimpleTimingPort,
return true;
}
+void
+SimpleTimingPort::schedSendEvent(Tick when)
+{
+ if (waitingOnRetry) {
+ assert(!sendEvent->scheduled());
+ return;
+ }
+
+ if (!sendEvent->scheduled()) {
+ owner->schedule(sendEvent, when);
+ } else if (sendEvent->when() > when) {
+ owner->reschedule(sendEvent, when);
+ }
+}
void
SimpleTimingPort::schedSendTiming(PacketPtr pkt, Tick when)
if (success) {
if (!transmitList.empty() && !sendEvent->scheduled()) {
Tick time = transmitList.front().tick;
- schedule(sendEvent, time <= curTick() ? curTick()+1 : time);
+ owner->schedule(sendEvent, time <= curTick() ? curTick()+1 : time);
}
if (transmitList.empty() && drainEvent && !sendEvent->scheduled()) {
Tick deferredPacketReadyTime()
{ return transmitList.empty() ? MaxTick : transmitList.front().tick; }
- void
- schedSendEvent(Tick when)
- {
- if (waitingOnRetry) {
- assert(!sendEvent->scheduled());
- return;
- }
-
- if (!sendEvent->scheduled()) {
- schedule(sendEvent, when);
- } else if (sendEvent->when() > when) {
- reschedule(sendEvent, when);
- }
- }
-
+ /**
+ * Schedule a send even if not already waiting for a retry. If the
+ * requested time is before an already scheduled send event it
+ * will be rescheduled.
+ *
+ * @param when
+ */
+ void schedSendEvent(Tick when);
/** Schedule a sendTiming() event to be called in the future.
* @param pkt packet to send