mem-cache: Add match functions to QueueEntry
[gem5.git] / src / mem / noncoherent_xbar.cc
index 4099378268374198f1b3fc6a1ef308218b913f8b..730c2b22671ab49e63bddc85443adab2cd49a887 100644 (file)
@@ -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
  * Definition of a non-coherent crossbar object.
  */
 
-#include "base/misc.hh"
+#include "mem/noncoherent_xbar.hh"
+
+#include "base/logging.hh"
 #include "base/trace.hh"
 #include "debug/NoncoherentXBar.hh"
 #include "debug/XBar.hh"
-#include "mem/noncoherent_xbar.hh"
 
 NoncoherentXBar::NoncoherentXBar(const NoncoherentXBarParams *p)
     : BaseXBar(p)
@@ -87,8 +88,6 @@ NoncoherentXBar::NoncoherentXBar(const NoncoherentXBarParams *p)
         respLayers.push_back(new RespLayer(*bp, *this,
                                            csprintf(".respLayer%d", i)));
     }
-
-    clearPortCache();
 }
 
 NoncoherentXBar::~NoncoherentXBar()
@@ -109,7 +108,7 @@ NoncoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
     assert(!pkt->isExpressSnoop());
 
     // determine the destination based on the address
-    PortID master_port_id = findPort(pkt->getAddr());
+    PortID master_port_id = findPort(pkt->getAddrRange());
 
     // test if the layer should be considered occupied for the current
     // port
@@ -142,15 +141,12 @@ NoncoherentXBar::recvTimingReq(PacketPtr pkt, PortID slave_port_id)
     // before forwarding the packet (and possibly altering it),
     // remember if we are expecting a response
     const bool expect_response = pkt->needsResponse() &&
-        !pkt->memInhibitAsserted();
+        !pkt->cacheResponding();
 
     // since it is a normal request, attempt to send the packet
     bool success = masterPorts[master_port_id]->sendTimingReq(pkt);
 
     if (!success)  {
-        // inhibited packets should never be forced to retry
-        assert(!pkt->memInhibitAsserted());
-
         DPRINTF(NoncoherentXBar, "recvTimingReq: src %s %s 0x%x RETRY\n",
                 src_port->name(), pkt->cmdString(), pkt->getAddr());
 
@@ -247,7 +243,8 @@ NoncoherentXBar::recvReqRetry(PortID master_port_id)
 }
 
 Tick
-NoncoherentXBar::recvAtomic(PacketPtr pkt, PortID slave_port_id)
+NoncoherentXBar::recvAtomicBackdoor(PacketPtr pkt, PortID slave_port_id,
+                                    MemBackdoorPtr *backdoor)
 {
     DPRINTF(NoncoherentXBar, "recvAtomic: packet src %s addr 0x%x cmd %s\n",
             slavePorts[slave_port_id]->name(), pkt->getAddr(),
@@ -257,7 +254,7 @@ NoncoherentXBar::recvAtomic(PacketPtr pkt, PortID slave_port_id)
     unsigned int pkt_cmd = pkt->cmdToIndex();
 
     // determine the destination port
-    PortID master_port_id = findPort(pkt->getAddr());
+    PortID master_port_id = findPort(pkt->getAddrRange());
 
     // stats updates for the request
     pktCount[slave_port_id][master_port_id]++;
@@ -265,7 +262,9 @@ NoncoherentXBar::recvAtomic(PacketPtr pkt, PortID slave_port_id)
     transDist[pkt_cmd]++;
 
     // forward the request to the appropriate destination
-    Tick response_latency = masterPorts[master_port_id]->sendAtomic(pkt);
+    auto master = masterPorts[master_port_id];
+    Tick response_latency = backdoor ?
+        master->sendAtomicBackdoor(pkt, *backdoor) : master->sendAtomic(pkt);
 
     // add the response data
     if (pkt->isResponse()) {
@@ -299,7 +298,7 @@ NoncoherentXBar::recvFunctional(PacketPtr pkt, PortID slave_port_id)
         // if we find a response that has the data, then the
         // downstream caches/memories may be out of date, so simply stop
         // here
-        if (p->checkFunctional(pkt)) {
+        if (p->trySatisfyFunctional(pkt)) {
             if (pkt->needsResponse())
                 pkt->makeResponse();
             return;
@@ -307,7 +306,7 @@ NoncoherentXBar::recvFunctional(PacketPtr pkt, PortID slave_port_id)
     }
 
     // determine the destination port
-    PortID dest_id = findPort(pkt->getAddr());
+    PortID dest_id = findPort(pkt->getAddrRange());
 
     // forward the request to the appropriate destination
     masterPorts[dest_id]->sendFunctional(pkt);