mem-cache: Add match functions to QueueEntry
[gem5.git] / src / mem / port.hh
index 77081db4d90d80696cbd1ba3892acb1ff3153bfb..72a02711c5f2836a44815d801273f9d40e535086 100644 (file)
@@ -51,6 +51,7 @@
 #define __MEM_PORT_HH__
 
 #include "base/addr_range.hh"
+#include "mem/backdoor.hh"
 #include "mem/packet.hh"
 #include "sim/port.hh"
 
@@ -77,10 +78,7 @@ class BaseMasterPort : public Port
 
   public:
 
-    virtual void bind(BaseSlavePort& slave_port) = 0;
-    virtual void unbind() = 0;
     BaseSlavePort& getSlavePort() const;
-    bool isConnected() const;
 
 };
 
@@ -101,7 +99,6 @@ class BaseSlavePort : public Port
   public:
 
     BaseMasterPort& getMasterPort() const;
-    bool isConnected() const;
 
 };
 
@@ -138,12 +135,12 @@ class MasterPort : public BaseMasterPort
      * Bind this master port to a slave port. This also does the
      * mirror action and binds the slave port to the master port.
      */
-    void bind(BaseSlavePort& slave_port);
+    void bind(Port &peer) override;
 
     /**
      * Unbind this master port and the associated slave port.
      */
-    void unbind();
+    void unbind() override;
 
     /**
      * Send an atomic request packet, where the data is moved and the
@@ -156,6 +153,18 @@ class MasterPort : public BaseMasterPort
      */
     Tick sendAtomic(PacketPtr pkt);
 
+    /**
+     * Send an atomic request packet like above, but also request a backdoor
+     * to the data being accessed.
+     *
+     * @param pkt Packet to send.
+     * @param backdoor Can be set to a back door pointer by the target to let
+     *        caller have direct access to the requested data.
+     *
+     * @return Estimated latency of access.
+     */
+    Tick sendAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor);
+
     /**
      * Send a functional request packet, where the data is instantly
      * updated everywhere in the memory system, without affecting the
@@ -304,6 +313,7 @@ class SlavePort : public BaseSlavePort
   private:
 
     MasterPort* _masterPort;
+    bool defaultBackdoorWarned;
 
   protected:
 
@@ -394,25 +404,37 @@ class SlavePort : public BaseSlavePort
      */
     virtual AddrRangeList getAddrRanges() const = 0;
 
+    /**
+     * We let the master port do the work, so these don't do anything.
+     */
+    void unbind() override {}
+    void bind(Port &peer) override {}
+
   protected:
 
     /**
      * Called by the master port to unbind. Should never be called
      * directly.
      */
-    void unbind();
+    void slaveUnbind();
 
     /**
      * Called by the master port to bind. Should never be called
      * directly.
      */
-    void bind(MasterPort& master_port);
+    void slaveBind(MasterPort& master_port);
 
     /**
      * Receive an atomic request packet from the master port.
      */
     virtual Tick recvAtomic(PacketPtr pkt) = 0;
 
+    /**
+     * Receive an atomic request packet from the master port, and optionally
+     * provide a backdoor to the data being accessed.
+     */
+    virtual Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor);
+
     /**
      * Receive a functional request packet from the master port.
      */