System *sys = params()->sys;
Tick minb = params()->min_backoff;
Tick maxb = params()->max_backoff;
- port = new DmaPort(this, sys, minb, maxb);
+ port = new DmaPort(this, sys, minb, maxb, true);
return port;
}
return NULL;
}
-DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff)
+DmaPort::DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
+ bool recv_snoops)
: Port(dev->name() + "-dmaport", dev), device(dev), sys(s),
pendingCount(0), actionInProgress(0), drainEvent(NULL),
backoffTime(0), minBackoffDelay(min_backoff),
- maxBackoffDelay(max_backoff), inRetry(false), backoffEvent(this)
+ maxBackoffDelay(max_backoff), inRetry(false), recvSnoops(recv_snoops),
+ snoopRangeSent(false), backoffEvent(this)
{ }
bool
pkt->reinitNacked();
queueDma(pkt, true);
} else if (pkt->senderState) {
+ if (recvSnoops) {
+ if (pkt->isRequest()) {
+ return true;
+ }
+ }
+
DmaReqState *state;
backoffTime >>= 2;
* it is that it's sending. */
bool inRetry;
+ /** Port accesses a cache which requires snooping */
+ bool recvSnoops;
+
+ /** Records snoop response so we only reply once to a status change */
+ bool snoopRangeSent;
+
virtual bool recvTiming(PacketPtr pkt);
virtual Tick recvAtomic(PacketPtr pkt)
- { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
+ {
+ if (recvSnoops) return 0;
+
+ panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN
+ }
virtual void recvFunctional(PacketPtr pkt)
- { panic("dma port shouldn't be used for pio access."); }
+ {
+ if (recvSnoops) return;
+
+ panic("dma port shouldn't be used for pio access.");
+ }
virtual void recvStatusChange(Status status)
- { ; }
+ {
+ if (recvSnoops) {
+ if (status == RangeChange) {
+ if (!snoopRangeSent) {
+ snoopRangeSent = true;
+ sendStatusChange(Port::RangeChange);
+ }
+ return;
+ }
+ panic("Unexpected recvStatusChange\n");
+ }
+ }
virtual void recvRetry() ;
virtual void getDeviceAddressRanges(AddrRangeList &resp,
bool &snoop)
- { resp.clear(); snoop = false; }
+ { resp.clear(); snoop = recvSnoops; }
void queueDma(PacketPtr pkt, bool front = false);
void sendDma();
EventWrapper<DmaPort, &DmaPort::sendDma> backoffEvent;
public:
- DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff);
+ DmaPort(MemObject *dev, System *s, Tick min_backoff, Tick max_backoff,
+ bool recv_snoops = false);
void dmaAction(Packet::Command cmd, Addr addr, int size, Event *event,
uint8_t *data, Tick delay, Request::Flags flag = 0);