From 6c5c51338d85f54953d11fefd956baceed37c010 Mon Sep 17 00:00:00 2001 From: Ron Dreslinski Date: Mon, 13 Nov 2006 19:56:34 -0500 Subject: [PATCH] Fix problems with snoop ranges not working properly on functional accesses src/mem/bus.cc: Actually return the snoop list when asked for it. Don't get stuck in infinite functional loops --HG-- extra : convert_revision : 8e6dafbd10b30d48d28b6b5d4b464e8e8f6a3ddc --- src/mem/bus.cc | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mem/bus.cc b/src/mem/bus.cc index 8ea67a0e4..8b77011bb 100644 --- a/src/mem/bus.cc +++ b/src/mem/bus.cc @@ -290,7 +290,10 @@ Bus::findPort(Addr addr, int id) // we shouldn't be sending this back to where it came from - assert(dest_id != id); + // only on a functional access and then we should terminate + // the cyclical call. + if (dest_id == id) + return 0; return interfaces[dest_id]; } @@ -392,8 +395,11 @@ Bus::recvFunctional(PacketPtr pkt) functionalSnoop(pkt); // If the snooping found what we were looking for, we're done. - if (pkt->result != Packet::Success) - findPort(pkt->getAddr(), pkt->getSrc())->sendFunctional(pkt); + if (pkt->result != Packet::Success) { + Port* port = findPort(pkt->getAddr(), pkt->getSrc()); + if (port) + port->sendFunctional(pkt); + } } /** Function called by the port when the bus is receiving a status change.*/ @@ -493,7 +499,7 @@ Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id) for (dflt_iter = defaultRange.begin(); dflt_iter != defaultRange.end(); dflt_iter++) { resp.push_back(*dflt_iter); - DPRINTF(BusAddrRanges, " -- %#llx : %#llx\n",dflt_iter->start, + DPRINTF(BusAddrRanges, " -- Dflt: %#llx : %#llx\n",dflt_iter->start, dflt_iter->end); } for (portIter = portList.begin(); portIter != portList.end(); portIter++) { @@ -519,6 +525,16 @@ Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id) portIter->range.start, portIter->range.end); } } + + for (portIter = portSnoopList.begin(); + portIter != portSnoopList.end(); portIter++) + { + if (portIter->portId != id) { + snoop.push_back(portIter->range); + DPRINTF(BusAddrRanges, " -- Snoop: %#llx : %#llx\n", + portIter->range.start, portIter->range.end); + } + } } unsigned int