summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRon Dreslinski <rdreslin@umich.edu>2006-11-13 21:33:01 -0500
committerRon Dreslinski <rdreslin@umich.edu>2006-11-13 21:33:01 -0500
commit9b6fd56dd5700e29904ab03f445eafe4fcba7853 (patch)
tree06b2854967a5129cd5eb6a6032f59e70381aca85 /src
parent6c5c51338d85f54953d11fefd956baceed37c010 (diff)
downloadgem5-9b6fd56dd5700e29904ab03f445eafe4fcba7853.tar.xz
Fix some errors related to snooping and functional access in the bus
src/mem/bus.cc: Only call snoop once per port, need to fix it so snoop ranges that overlap aren't added to list Functional accesses that call snoop and it goes to a higher bus may change the src, reset it after each snoop. --HG-- extra : convert_revision : 7276059c798a85cb9d138ccc5531298ecd055c13
Diffstat (limited to 'src')
-rw-r--r--src/mem/bus.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index 8b77011bb..b97a7ddb9 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -310,7 +310,18 @@ Bus::findSnoopPorts(Addr addr, int id)
if (portSnoopList[i].range == addr && portSnoopList[i].portId != id) {
//Careful to not overlap ranges
//or snoop will be called more than once on the port
- ports.push_back(portSnoopList[i].portId);
+
+ //@todo Fix this hack because ranges are overlapping
+ //need to make sure we dont't create overlapping ranges
+ bool hack_overlap = false;
+ int size = ports.size();
+ for (int j=0; j < size; j++) {
+ if (ports[j] == portSnoopList[i].portId)
+ hack_overlap = true;
+ }
+
+ if (!hack_overlap)
+ ports.push_back(portSnoopList[i].portId);
// DPRINTF(Bus, " found snoop addr %#llx on device%d\n", addr,
// portSnoopList[i].portId);
}
@@ -342,10 +353,13 @@ Bus::functionalSnoop(PacketPtr pkt)
{
std::vector<int> ports = findSnoopPorts(pkt->getAddr(), pkt->getSrc());
+ //The packet may be changed by another bus on snoops, restore the id after each
+ int id = pkt->getSrc();
while (!ports.empty() && pkt->result != Packet::Success)
{
interfaces[ports.back()]->sendFunctional(pkt);
ports.pop_back();
+ pkt->setSrc(id);
}
}
@@ -457,6 +471,7 @@ Bus::recvStatusChange(Port::Status status, int id)
dm.portId = id;
dm.range = *iter;
+ //@todo, make sure we don't overlap ranges
DPRINTF(BusAddrRanges, "Adding snoop range %#llx - %#llx for id %d\n",
dm.range.start, dm.range.end, id);
portSnoopList.push_back(dm);
@@ -533,6 +548,8 @@ Bus::addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id)
snoop.push_back(portIter->range);
DPRINTF(BusAddrRanges, " -- Snoop: %#llx : %#llx\n",
portIter->range.start, portIter->range.end);
+ //@todo We need to properly insert snoop ranges
+ //not overlapping the ranges (multiple)
}
}
}