cpu: Apply the ARM TLB rework to the O3 checker CPU.
[gem5.git] / src / mem / external_slave.cc
index 2d7ba1a653e07ae2aabb66c8bbd0d6e0636b4b64..ae81e1b15e26e1fe93cff0a4a468f203f95f0c05 100644 (file)
 #include <cctype>
 #include <iomanip>
 
+#include "base/trace.hh"
 #include "debug/ExternalPort.hh"
 
 /** Implement a `stub' port which just responds to requests by printing
  *  a message.  The stub port can be used to configure and test a system
  *  where the external port is used for a peripheral before connecting
  *  the external port */
-class StubSlavePort : public ExternalSlave::Port
+class StubSlavePort : public ExternalSlave::ExternalPort
 {
   public:
-    class ResponseEvent : public Event
-    {
-      public:
-        StubSlavePort &owner;
-
-        ResponseEvent(StubSlavePort &owner_) : owner(owner_) { }
-
-        void process();
-    };
+    void processResponseEvent();
 
-    ResponseEvent responseEvent;
+    EventFunctionWrapper responseEvent;
 
     /** Stub can handle a single request at a time.  This will be
      *  NULL when no packet is in flight */
@@ -73,8 +66,9 @@ class StubSlavePort : public ExternalSlave::Port
 
     StubSlavePort(const std::string &name_,
         ExternalSlave &owner_) :
-        ExternalSlave::Port(name_, owner_),
-        responseEvent(*this), responsePacket(NULL), mustRetry(false)
+        ExternalSlave::ExternalPort(name_, owner_),
+        responseEvent([this]{ processResponseEvent(); }, name()),
+        responsePacket(NULL), mustRetry(false)
     { }
 
     Tick recvAtomic(PacketPtr packet);
@@ -89,7 +83,7 @@ class StubSlavePortHandler : public
     ExternalSlave::Handler
 {
   public:
-    ExternalSlave::Port *getExternalPort(
+    ExternalSlave::ExternalPort *getExternalPort(
         const std::string &name_,
         ExternalSlave &owner,
         const std::string &port_data)
@@ -122,18 +116,18 @@ StubSlavePort::recvFunctional(PacketPtr packet)
 }
 
 void
-StubSlavePort::ResponseEvent::process()
+StubSlavePort::processResponseEvent()
 {
-    owner.responsePacket->makeResponse();
-    owner.responsePacket->headerDelay = 0;
-    owner.responsePacket->payloadDelay = 0;
+    responsePacket->makeResponse();
+    responsePacket->headerDelay = 0;
+    responsePacket->payloadDelay = 0;
 
-    if (owner.sendTimingResp(owner.responsePacket)) {
-        owner.responsePacket = NULL;
+    if (sendTimingResp(responsePacket)) {
+        responsePacket = NULL;
 
-        if (owner.mustRetry)
-            owner.sendRetryReq();
-        owner.mustRetry = false;
+        if (mustRetry)
+            sendRetryReq();
+        mustRetry = false;
     }
 }
 
@@ -181,13 +175,13 @@ std::map<std::string, ExternalSlave::Handler *>
     ExternalSlave::portHandlers;
 
 AddrRangeList
-ExternalSlave::Port::getAddrRanges() const
+ExternalSlave::ExternalPort::getAddrRanges() const
 {
     return owner.addrRanges;
 }
 
 ExternalSlave::ExternalSlave(ExternalSlaveParams *params) :
-    MemObject(params),
+    SimObject(params),
     externalPort(NULL),
     portName(params->name + ".port"),
     portType(params->port_type),
@@ -199,9 +193,8 @@ ExternalSlave::ExternalSlave(ExternalSlaveParams *params) :
         registerHandler("stub", new StubSlavePortHandler);
 }
 
-BaseSlavePort &
-ExternalSlave::getSlavePort(const std::string &if_name,
-    PortID idx)
+Port &
+ExternalSlave::getPort(const std::string &if_name, PortID idx)
 {
     if (if_name == "port") {
         DPRINTF(ExternalPort, "Trying to bind external port: %s %s\n",
@@ -223,7 +216,7 @@ ExternalSlave::getSlavePort(const std::string &if_name,
         }
         return *externalPort;
     } else {
-        return MemObject::getSlavePort(if_name, idx);
+        return SimObject::getPort(if_name, idx);
     }
 }