changeset 1620cffaa3b6 in /z/repo/m5
details: http://repo.m5sim.org/m5?cmd=changeset;node=1620cffaa3b6
description:
        ruby: Removed static members in RubyPort including hitcallback
        Removed static members in RubyPort and removed the ruby request unique 
id.

diffstat:

10 files changed, 118 insertions(+), 155 deletions(-)
src/mem/protocol/RubySlicc_Exports.sm |   11 +++-
src/mem/ruby/libruby.cc               |    6 ++
src/mem/ruby/libruby.hh               |   26 +++++++---
src/mem/ruby/recorder/TraceRecord.cc  |    3 -
src/mem/ruby/system/DMASequencer.cc   |   13 ++---
src/mem/ruby/system/DMASequencer.hh   |    6 --
src/mem/ruby/system/RubyPort.cc       |   81 +++++++++++++++++----------------
src/mem/ruby/system/RubyPort.hh       |   58 ++---------------------
src/mem/ruby/system/Sequencer.cc      |   57 ++++++++---------------
src/mem/ruby/system/Sequencer.hh      |   12 ++--

diffs (truncated from 564 to 300 lines):

diff -r fd852ed8c6b4 -r 1620cffaa3b6 src/mem/protocol/RubySlicc_Exports.sm
--- a/src/mem/protocol/RubySlicc_Exports.sm     Fri Jan 29 20:29:33 2010 -0800
+++ b/src/mem/protocol/RubySlicc_Exports.sm     Fri Jan 29 20:29:33 2010 -0800
@@ -338,5 +338,12 @@
   LocalTransient, desc="";
 }
 
-
-
+// Request Status
+enumeration(RequestStatus, desc="...", default="RequestStatus_NULL")  {
+  Ready, desc="The sequencer is ready and the request does not alias";
+  Issued, desc="The sequencer successfully issued the request";
+  BufferFull, desc="Can not issue because the sequencer is full";
+  Aliased, desc="This request aliased with a currently outstanding request";
+  LlscFailed, desc="The write failed in the Load-Link Store-Conditional pair";
+  NULL, desc="";
+}
diff -r fd852ed8c6b4 -r 1620cffaa3b6 src/mem/ruby/libruby.cc
--- a/src/mem/ruby/libruby.cc   Fri Jan 29 20:29:33 2010 -0800
+++ b/src/mem/ruby/libruby.cc   Fri Jan 29 20:29:33 2010 -0800
@@ -132,7 +132,11 @@
 
 RubyPortHandle libruby_get_port(const char* port_name, void 
(*hit_callback)(int64_t access_id))
 {
-  return static_cast<RubyPortHandle>(RubySystem::getPort(port_name, 
hit_callback));
+  //
+  // Fix me: Hit callback is now a non-static member function pointer of 
+  // RubyPort and cannot be set to an arbitrary global function
+  //
+  return NULL;//static_cast<RubyPortHandle>(RubySystem::getPort(port_name, 
hit_callback));
 }
 
 RubyPortHandle libruby_get_port_by_name(const char* port_name)
diff -r fd852ed8c6b4 -r 1620cffaa3b6 src/mem/ruby/libruby.hh
--- a/src/mem/ruby/libruby.hh   Fri Jan 29 20:29:33 2010 -0800
+++ b/src/mem/ruby/libruby.hh   Fri Jan 29 20:29:33 2010 -0800
@@ -4,6 +4,7 @@
 
 #include <stdint.h>
 #include <ostream>
+#include "mem/packet.hh"
 
 typedef void* RubyPortHandle;
 enum RubyRequestType {
@@ -31,11 +32,26 @@
   uint64_t pc;
   RubyRequestType type;
   RubyAccessMode access_mode;
+  PacketPtr pkt;
   unsigned proc_id;
 
   RubyRequest() {}
-  RubyRequest(uint64_t _paddr, uint8_t* _data, int _len, uint64_t _pc, 
RubyRequestType _type, RubyAccessMode _access_mode, unsigned _proc_id = 100)
-    : paddr(_paddr), data(_data), len(_len), pc(_pc), type(_type), 
access_mode(_access_mode), proc_id(_proc_id)
+  RubyRequest(uint64_t _paddr, 
+              uint8_t* _data, 
+              int _len, 
+              uint64_t _pc, 
+              RubyRequestType _type, 
+              RubyAccessMode _access_mode, 
+              PacketPtr _pkt,
+              unsigned _proc_id = 100)
+    : paddr(_paddr), 
+      data(_data), 
+      len(_len), 
+      pc(_pc), 
+      type(_type), 
+      access_mode(_access_mode), 
+      pkt(_pkt),
+      proc_id(_proc_id)
   {}
 };
 
@@ -71,12 +87,6 @@
 RubyPortHandle libruby_get_port_by_name(const char* name);
 
 
-/** 
- * libruby_issue_request error return codes 
- */
-#define LIBRUBY_BUFFER_FULL -2
-#define LIBRUBY_ALIASED_REQUEST -3
-
 /**
  * issue_request returns a unique access_id to identify the ruby
  * transaction. This access_id is later returned to the caller via
diff -r fd852ed8c6b4 -r 1620cffaa3b6 src/mem/ruby/recorder/TraceRecord.cc
--- a/src/mem/ruby/recorder/TraceRecord.cc      Fri Jan 29 20:29:33 2010 -0800
+++ b/src/mem/ruby/recorder/TraceRecord.cc      Fri Jan 29 20:29:33 2010 -0800
@@ -85,7 +85,8 @@
                       RubySystem::getBlockSizeBytes(), 
                       m_pc_address.getAddress(), 
                       m_type, 
-                      RubyAccessMode_User);
+                      RubyAccessMode_User,
+                      NULL);
 
   // Clear out the sequencer
   while (!m_sequencer_ptr->empty()) {
diff -r fd852ed8c6b4 -r 1620cffaa3b6 src/mem/ruby/system/DMASequencer.cc
--- a/src/mem/ruby/system/DMASequencer.cc       Fri Jan 29 20:29:33 2010 -0800
+++ b/src/mem/ruby/system/DMASequencer.cc       Fri Jan 29 20:29:33 2010 -0800
@@ -24,7 +24,7 @@
   m_data_block_mask = ~ (~0 << RubySystem::getBlockSizeBits());
 }
 
-int64_t DMASequencer::makeRequest(const RubyRequest & request)
+RequestStatus DMASequencer::makeRequest(const RubyRequest & request)
 {
   uint64_t paddr = request.paddr;
   uint8_t* data = request.data;
@@ -44,7 +44,8 @@
   case RubyRequestType_RMW_Read:
   case RubyRequestType_RMW_Write:
   case RubyRequestType_NUM:
-    assert(0);
+    panic("DMASequencer::makeRequest does not support the RubyRequestType");
+    return RequestStatus_NULL;
   }
 
   assert(!m_is_busy);  // only support one outstanding DMA request
@@ -56,7 +57,7 @@
   active_request.len = len;
   active_request.bytes_completed = 0;
   active_request.bytes_issued = 0;
-  active_request.id = makeUniqueRequestID();
+  active_request.pkt = request.pkt;
 
   SequencerMsg msg;
   msg.getPhysicalAddress() = Address(paddr);
@@ -76,7 +77,7 @@
   m_mandatory_q_ptr->enqueue(msg);
   active_request.bytes_issued += msg.getLen();
 
-  return active_request.id;
+  return RequestStatus_Issued;
 }
 
 void DMASequencer::issueNext()
@@ -84,14 +85,14 @@
   assert(m_is_busy == true);
   active_request.bytes_completed = active_request.bytes_issued;
   if (active_request.len == active_request.bytes_completed) {
-    m_hit_callback(active_request.id);
+    ruby_hit_callback(active_request.pkt);
     m_is_busy = false;
     return;
   }
 
   SequencerMsg msg;
   msg.getPhysicalAddress() = Address(active_request.start_paddr + 
-                                    active_request.bytes_completed);
+                                     active_request.bytes_completed);
 
   assert((msg.getPhysicalAddress().getAddress() & m_data_block_mask) == 0);
   msg.getLineAddress() = line_address(msg.getPhysicalAddress());
diff -r fd852ed8c6b4 -r 1620cffaa3b6 src/mem/ruby/system/DMASequencer.hh
--- a/src/mem/ruby/system/DMASequencer.hh       Fri Jan 29 20:29:33 2010 -0800
+++ b/src/mem/ruby/system/DMASequencer.hh       Fri Jan 29 20:29:33 2010 -0800
@@ -15,7 +15,7 @@
   int bytes_completed;
   int bytes_issued;
   uint8* data;
-  int64_t id;
+  PacketPtr pkt;
 };
 
 class DMASequencer :public RubyPort {
@@ -24,9 +24,7 @@
   DMASequencer(const Params *);
   void init();
   /* external interface */
-  int64_t makeRequest(const RubyRequest & request);
-  bool isReady(const RubyRequest & request, bool dont_set = false) { 
assert(0); return false;};
-  //  void issueRequest(uint64_t paddr, uint8* data, int len, bool rw);
+  RequestStatus makeRequest(const RubyRequest & request);
   bool busy() { return m_is_busy;}
 
   /* SLICC callback */
diff -r fd852ed8c6b4 -r 1620cffaa3b6 src/mem/ruby/system/RubyPort.cc
--- a/src/mem/ruby/system/RubyPort.cc   Fri Jan 29 20:29:33 2010 -0800
+++ b/src/mem/ruby/system/RubyPort.cc   Fri Jan 29 20:29:33 2010 -0800
@@ -32,10 +32,6 @@
 #include "mem/ruby/slicc_interface/AbstractController.hh"
 #include "cpu/rubytest/RubyTester.hh"
 
-uint16_t RubyPort::m_num_ports = 0;
-
-RubyPort::RequestMap RubyPort::pending_cpu_requests;
-
 RubyPort::RubyPort(const Params *p)
     : MemObject(p)
 {
@@ -47,12 +43,9 @@
     m_controller = NULL;
     m_mandatory_q_ptr = NULL;
 
-    m_port_id = m_num_ports++;
     m_request_cnt = 0;
-    m_hit_callback = ruby_hit_callback;
     pio_port = NULL;
     physMemPort = NULL;
-    assert(m_num_ports <= 2048); // see below for reason
 }
 
 void RubyPort::init()
@@ -169,8 +162,7 @@
     //dsm: based on SimpleTimingPort::recvTiming(pkt);
 
     //
-    // After checking for pio responses, the remainder of packets
-    // received by ruby should only be M5 requests, which should never 
+    // The received packets should only be M5 requests, which should never 
     // get nacked.  There used to be code to hanldle nacks here, but 
     // I'm pretty sure it didn't work correctly with the drain code, 
     // so that would need to be fixed if we ever added it back.
@@ -186,17 +178,20 @@
     }
 
     //
+    // Save the port in the sender state object to be used later to
+    // route the response
+    //
+    pkt->senderState = new SenderState(this, pkt->senderState);
+
+    //
     // Check for pio requests and directly send them to the dedicated
     // pio port.
     //
     if (!isPhysMemAddress(pkt->getAddr())) {
         assert(ruby_port->pio_port != NULL);
-
-        //
-        // Save the port in the sender state object to be used later to
-        // route the response
-        //
-        pkt->senderState = new SenderState(this, pkt->senderState);
+        DPRINTF(MemoryAccess, 
+                "Request for address 0x%#x is assumed to be a pio request\n",
+                pkt->getAddr());
 
         return ruby_port->pio_port->sendTiming(pkt);
     }
@@ -225,41 +220,49 @@
         type = RubyRequestType_ST;
     } else if (pkt->isReadWrite()) {
         type = RubyRequestType_RMW_Write;
+    } else {
+      panic("Unsupported ruby packet type\n");
     }
 
-    RubyRequest ruby_request(pkt->getAddr(), pkt->getPtr<uint8_t>(),
-                             pkt->getSize(), pc, type,
-                             RubyAccessMode_Supervisor);
+    RubyRequest ruby_request(pkt->getAddr(), 
+                             pkt->getPtr<uint8_t>(),
+                             pkt->getSize(), 
+                             pc, 
+                             type,
+                             RubyAccessMode_Supervisor,
+                             pkt);
 
     // Submit the ruby request
-    int64_t req_id = ruby_port->makeRequest(ruby_request);
-    if (req_id == -1) {
-        return false;
+    RequestStatus requestStatus = ruby_port->makeRequest(ruby_request);
+    if (requestStatus == RequestStatus_Issued) {
+        return true;
     }
-
-    // Save the request for the callback
-    RubyPort::pending_cpu_requests[req_id] = new RequestCookie(pkt, this);
-
-    return true;
+     
+    DPRINTF(MemoryAccess, 
+            "Request for address #x did not issue because %s\n",
+            pkt->getAddr(),
+            RequestStatus_to_string(requestStatus));
+    
+    SenderState* senderState = safe_cast<SenderState*>(pkt->senderState);
+    pkt->senderState = senderState->saved;
+    delete senderState;
+    return false;
 }
 
 void
-RubyPort::ruby_hit_callback(int64_t req_id)
+RubyPort::ruby_hit_callback(PacketPtr pkt)
 {
     //
-    // Note: This single fuction can be called by cpu and dma ports,
-    // as well as the functional port.  
+    // Retrieve the request port from the sender State
     //
-    RequestMap::iterator i = pending_cpu_requests.find(req_id);
-    if (i == pending_cpu_requests.end())
-        panic("could not find pending request %d\n", req_id);
_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to