changeset da918cb3462e in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=da918cb3462e
description:
        Port: Add getAddrRanges to master port (asking slave port)

        This patch adds getAddrRanges to the master port, and thus avoids
        going through getSlavePort to be able to ask the slave. Similar to the
        previous patch that added isSnooping to the SlavePort, this patch aims
        to introduce an additional level of hierarchy in the ports (base port
        being protocol-agnostic) and getSlave/MasterPort will return port
        pointers to these base classes.

        The function is named getAddrRanges also on the master port, but does
        nothing besides asking the connected slave port. The slave port, as
        before, has to provide an implementation and actually produce a list
        of address ranges. The initial design used the name getSlaveAddrRanges
        for the new function, but the more verbose name was later changed.

diffstat:

 src/kern/tru64/tru64_events.cc |  3 ++-
 src/mem/bus.cc                 |  6 ++++--
 src/mem/comm_monitor.cc        |  3 ++-
 src/mem/port.cc                |  6 ++++++
 src/mem/port.hh                |  5 +++++
 5 files changed, 19 insertions(+), 4 deletions(-)

diffs (81 lines):

diff -r 73eeda352933 -r da918cb3462e src/kern/tru64/tru64_events.cc
--- a/src/kern/tru64/tru64_events.cc    Mon Jul 09 12:35:32 2012 -0400
+++ b/src/kern/tru64/tru64_events.cc    Mon Jul 09 12:35:33 2012 -0400
@@ -62,7 +62,8 @@
 
     MasterPort &dataPort = tc->getCpuPtr()->getDataPort();
 
-    AddrRangeList resp = dataPort.getSlavePort().getAddrRanges();
+    // get the address ranges of the connected slave port
+    AddrRangeList resp = dataPort.getAddrRanges();
     for (iter = resp.begin(); iter != resp.end(); iter++) {
         if (*iter == (K0Seg2Phys(a0) & PAddrImplMask))
             found = true;
diff -r 73eeda352933 -r da918cb3462e src/mem/bus.cc
--- a/src/mem/bus.cc    Mon Jul 09 12:35:32 2012 -0400
+++ b/src/mem/bus.cc    Mon Jul 09 12:35:33 2012 -0400
@@ -317,8 +317,9 @@
         defaultRange.clear();
         // Only try to update these ranges if the user set a default responder.
         if (useDefaultRange) {
+            // get the address ranges of the connected slave port
             AddrRangeList ranges =
-                masterPorts[master_port_id]->getSlavePort().getAddrRanges();
+                masterPorts[master_port_id]->getAddrRanges();
             for(iter = ranges.begin(); iter != ranges.end(); iter++) {
                 defaultRange.push_back(*iter);
                 DPRINTF(BusAddrRanges, "Adding range %#llx - %#llx for default 
range\n",
@@ -339,7 +340,8 @@
                 portIter++;
         }
 
-        ranges = port->getSlavePort().getAddrRanges();
+        // get the address ranges of the connected slave port
+        ranges = port->getAddrRanges();
 
         for (iter = ranges.begin(); iter != ranges.end(); iter++) {
             DPRINTF(BusAddrRanges, "Adding range %#llx - %#llx for id %d\n",
diff -r 73eeda352933 -r da918cb3462e src/mem/comm_monitor.cc
--- a/src/mem/comm_monitor.cc   Mon Jul 09 12:35:32 2012 -0400
+++ b/src/mem/comm_monitor.cc   Mon Jul 09 12:35:33 2012 -0400
@@ -347,7 +347,8 @@
 AddrRangeList
 CommMonitor::getAddrRanges()
 {
-    return masterPort.getSlavePort().getAddrRanges();
+    // get the address ranges of the connected slave port
+    return masterPort.getAddrRanges();
 }
 
 void
diff -r 73eeda352933 -r da918cb3462e src/mem/port.cc
--- a/src/mem/port.cc   Mon Jul 09 12:35:32 2012 -0400
+++ b/src/mem/port.cc   Mon Jul 09 12:35:33 2012 -0400
@@ -103,6 +103,12 @@
     return _slavePort->deviceBlockSize();
 }
 
+AddrRangeList
+MasterPort::getAddrRanges() const
+{
+    return _slavePort->getAddrRanges();
+}
+
 Tick
 MasterPort::sendAtomic(PacketPtr pkt)
 {
diff -r 73eeda352933 -r da918cb3462e src/mem/port.hh
--- a/src/mem/port.hh   Mon Jul 09 12:35:32 2012 -0400
+++ b/src/mem/port.hh   Mon Jul 09 12:35:33 2012 -0400
@@ -215,6 +215,11 @@
     */
     unsigned peerBlockSize() const;
 
+    /**
+     * Get the address ranges of the connected slave port.
+     */
+    AddrRangeList getAddrRanges() const;
+
     /** Inject a PrintReq for the given address to print the state of
      * that address throughout the memory system.  For debugging.
      */
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to