Port: Add isSnooping to slave port (asking master port)

This patch adds isSnooping to the slave port, and thus avoids going
through getMasterPort to be able to ask the master. Over the course of
the next few patches, all getMasterPort/getSlavePort in Port and
MemObject are to be protocol agnostic, and the snooping is part of the
protocol layer.

The function is already present on the master port, where it is
implemented by the module itself, e.g. a cache. On the slave side, it
is merely asking the connected master port. The same name is used by
both functions despite their difference in behaviour. The initial
design used isMasterSnooping on the slave port side, but the more
verbose function name was later changed.
This commit is contained in:
Andreas Hansson 2012-07-09 12:35:32 -04:00
parent 17f9270dad
commit 49407d76aa
5 changed files with 14 additions and 4 deletions

View file

@ -795,7 +795,7 @@ Cache<TagStore>::functionalAccess(PacketPtr pkt, bool fromCpuSide)
// continues towards the memory side
if (fromCpuSide) {
memSidePort->sendFunctional(pkt);
} else if (forwardSnoops && cpuSidePort->getMasterPort().isSnooping()) {
} else if (forwardSnoops && cpuSidePort->isSnooping()) {
// if it came from the memory side, it must be a snoop request
// and we should only forward it if we are forwarding snoops
cpuSidePort->sendFunctionalSnoop(pkt);

View file

@ -92,7 +92,8 @@ CoherentBus::init()
// neighbouring master ports are snooping and add them as snoopers
for (SlavePortConstIter p = slavePorts.begin(); p != slavePorts.end();
++p) {
if ((*p)->getMasterPort().isSnooping()) {
// check if the connected master port is snooping
if ((*p)->isSnooping()) {
DPRINTF(BusAddrRanges, "Adding snooping master %s\n",
(*p)->getMasterPort().name());
snoopPorts.push_back(*p);

View file

@ -328,7 +328,8 @@ CommMonitor::recvTimingSnoopResp(PacketPtr pkt)
bool
CommMonitor::isSnooping() const
{
return slavePort.getMasterPort().isSnooping();
// check if the connected master port is snooping
return slavePort.isSnooping();
}
unsigned

View file

@ -355,6 +355,13 @@ class SlavePort : public Port
*/
unsigned peerBlockSize() const;
/**
* Find out if the peer master port is snooping or not.
*
* @return true if the peer master port is snooping
*/
bool isSnooping() const { return _masterPort->isSnooping(); }
/**
* Called by the owner to send a range change
*/

View file

@ -695,7 +695,8 @@ RubyPort::ruby_eviction_callback(const Address& address)
// should this really be using funcMasterId?
Request req(address.getAddress(), 0, 0, Request::funcMasterId);
for (CpuPortIter p = slave_ports.begin(); p != slave_ports.end(); ++p) {
if ((*p)->getMasterPort().isSnooping()) {
// check if the connected master port is snooping
if ((*p)->isSnooping()) {
Packet *pkt = new Packet(&req, MemCmd::InvalidationReq);
// send as a snoop request
(*p)->sendTimingSnoopReq(pkt);