X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmem%2Fxbar.cc;h=b139cdc9b9dabd2a5b366b7e0007438bb60d4dde;hb=24bfdc36f19fddbfcb33cc2f33fb216e8da0382d;hp=03546194413420677d291879c1cef4e7242dbf2e;hpb=7a8dda49a4ec33be17bbd101ebd68e02562b9c3d;p=gem5.git diff --git a/src/mem/xbar.cc b/src/mem/xbar.cc index 035461944..b139cdc9b 100644 --- a/src/mem/xbar.cc +++ b/src/mem/xbar.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2015 ARM Limited + * Copyright (c) 2011-2015, 2018 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -49,7 +49,7 @@ #include "mem/xbar.hh" -#include "base/misc.hh" +#include "base/logging.hh" #include "base/trace.hh" #include "debug/AddrRanges.hh" #include "debug/Drain.hh" @@ -147,7 +147,7 @@ template BaseXBar::Layer::Layer(DstType& _port, BaseXBar& _xbar, const std::string& _name) : port(_port), xbar(_xbar), _name(_name), state(IDLE), - waitingForPeer(NULL), releaseEvent(this) + waitingForPeer(NULL), releaseEvent([this]{ releaseLayer(); }, name()) { } @@ -321,41 +321,34 @@ BaseXBar::Layer::recvRetry() } PortID -BaseXBar::findPort(Addr addr) +BaseXBar::findPort(AddrRange addr_range) { // we should never see any address lookups before we've got the // ranges of all connected slave modules assert(gotAllAddrRanges); - // Check the cache - PortID dest_id = checkPortCache(addr); - if (dest_id != InvalidPortID) - return dest_id; - // Check the address map interval tree - auto i = portMap.find(addr); + auto i = portMap.contains(addr_range); if (i != portMap.end()) { - dest_id = i->second; - updatePortCache(dest_id, i->first); - return dest_id; + return i->second; } // Check if this matches the default range if (useDefaultRange) { - if (defaultRange.contains(addr)) { - DPRINTF(AddrRanges, " found addr %#llx on default\n", - addr); + if (addr_range.isSubset(defaultRange)) { + DPRINTF(AddrRanges, " found addr %s on default\n", + addr_range.to_string()); return defaultPortID; } } else if (defaultPortID != InvalidPortID) { - DPRINTF(AddrRanges, "Unable to find destination for addr %#llx, " - "will use default port\n", addr); + DPRINTF(AddrRanges, "Unable to find destination for %s, " + "will use default port\n", addr_range.to_string()); return defaultPortID; } // we should use the range for the default port and it did not // match, or the default port is not set - fatal("Unable to find destination for addr %#llx on %s\n", addr, + fatal("Unable to find destination for %s on %s\n", addr_range.to_string(), name()); } @@ -420,8 +413,9 @@ BaseXBar::recvRangeChange(PortID master_port_id) DPRINTF(AddrRanges, "Adding range %s for id %d\n", r.to_string(), master_port_id); if (portMap.insert(r, master_port_id) == portMap.end()) { - PortID conflict_id = portMap.find(r)->second; - fatal("%s has two ports responding within range %s:\n\t%s\n\t%s\n", + PortID conflict_id = portMap.intersects(r)->second; + fatal("%s has two ports responding within range " + "%s:\n\t%s\n\t%s\n", name(), r.to_string(), masterPorts[master_port_id]->getSlavePort().name(), @@ -496,7 +490,7 @@ BaseXBar::recvRangeChange(PortID master_port_id) } } - // also check that no range partially overlaps with the + // also check that no range partially intersects with the // default range, this has to be done after all ranges are set // as there are no guarantees for when the default range is // update with respect to the other ones @@ -517,8 +511,6 @@ BaseXBar::recvRangeChange(PortID master_port_id) for (const auto& s: slavePorts) s->sendRangeChange(); } - - clearPortCache(); } AddrRangeList