MEM: Add port proxies instead of non-structural ports
[gem5.git] / src / dev / ns_gige.cc
index f19ca20e525f73eec9d71947afdeca2d53b96af2..a7bc6d0abffce376ee12e52ce8d7d46f08cc42e4 100644 (file)
 #include <deque>
 #include <string>
 
+#include "base/debug.hh"
 #include "base/inet.hh"
+#include "base/types.hh"
+#include "config/the_isa.hh"
 #include "cpu/thread_context.hh"
+#include "debug/EthernetAll.hh"
 #include "dev/etherlink.hh"
 #include "dev/ns_gige.hh"
 #include "dev/pciconfigall.hh"
 #include "mem/packet.hh"
 #include "mem/packet_access.hh"
 #include "params/NSGigE.hh"
-#include "sim/debug.hh"
-#include "sim/host.hh"
 #include "sim/system.hh"
 
 const char *NsRxStateStrings[] =
@@ -847,7 +849,7 @@ NSGigE::devIntrPost(uint32_t interrupts)
             interrupts, regs.isr, regs.imr);
 
     if ((regs.isr & regs.imr)) {
-        Tick when = curTick;
+        Tick when = curTick();
         if ((regs.isr & regs.imr & ISR_NODELAY) == 0)
             when += intrDelay;
         postedInterrupts++;
@@ -909,7 +911,7 @@ NSGigE::devIntrChangeMask()
             regs.isr, regs.imr, regs.isr & regs.imr);
 
     if (regs.isr & regs.imr)
-        cpuIntrPost(curTick);
+        cpuIntrPost(curTick());
     else
         cpuIntrClear();
 }
@@ -926,8 +928,8 @@ NSGigE::cpuIntrPost(Tick when)
      * @todo this warning should be removed and the intrTick code should
      * be fixed.
      */
-    assert(when >= curTick);
-    assert(intrTick >= curTick || intrTick == 0);
+    assert(when >= curTick());
+    assert(intrTick >= curTick() || intrTick == 0);
     if (when > intrTick && intrTick != 0) {
         DPRINTF(EthernetIntr, "don't need to schedule event...intrTick=%d\n",
                 intrTick);
@@ -935,9 +937,9 @@ NSGigE::cpuIntrPost(Tick when)
     }
 
     intrTick = when;
-    if (intrTick < curTick) {
-        debug_break();
-        intrTick = curTick;
+    if (intrTick < curTick()) {
+        Debug::breakpoint();
+        intrTick = curTick();
     }
 
     DPRINTF(EthernetIntr, "going to schedule an interrupt for intrTick=%d\n",
@@ -945,13 +947,14 @@ NSGigE::cpuIntrPost(Tick when)
 
     if (intrEvent)
         intrEvent->squash();
-    intrEvent = new IntrEvent(this, intrTick, true);
+    intrEvent = new IntrEvent(this, true);
+    schedule(intrEvent, intrTick);
 }
 
 void
 NSGigE::cpuInterrupt()
 {
-    assert(intrTick == curTick);
+    assert(intrTick == curTick());
 
     // Whether or not there's a pending interrupt, we don't care about
     // it anymore
@@ -1123,7 +1126,7 @@ NSGigE::rxKick()
 
   next:
     if (clock) {
-        if (rxKickTick > curTick) {
+        if (rxKickTick > curTick()) {
             DPRINTF(EthernetSM, "receive kick exiting, can't run till %d\n",
                     rxKickTick);
 
@@ -1131,7 +1134,7 @@ NSGigE::rxKick()
         }
 
         // Go to the next state machine clock tick.
-        rxKickTick = curTick + ticks(1);
+        rxKickTick = curTick() + ticks(1);
     }
 
     switch(rxDmaState) {
@@ -1442,7 +1445,7 @@ NSGigE::rxKick()
             NsRxStateStrings[rxState]);
 
     if (clock && !rxKickEvent.scheduled())
-        rxKickEvent.schedule(rxKickTick);
+        schedule(rxKickEvent, rxKickTick);
 }
 
 void
@@ -1492,7 +1495,7 @@ NSGigE::transmit()
 
    if (!txFifo.empty() && !txEvent.scheduled()) {
        DPRINTF(Ethernet, "reschedule transmit\n");
-       txEvent.schedule(curTick + retryTime);
+       schedule(txEvent, curTick() + retryTime);
    }
 }
 
@@ -1571,14 +1574,14 @@ NSGigE::txKick()
 
   next:
     if (clock) {
-        if (txKickTick > curTick) {
+        if (txKickTick > curTick()) {
             DPRINTF(EthernetSM, "transmit kick exiting, can't run till %d\n",
                     txKickTick);
             goto exit;
         }
 
         // Go to the next state machine clock tick.
-        txKickTick = curTick + ticks(1);
+        txKickTick = curTick() + ticks(1);
     }
 
     switch(txDmaState) {
@@ -1703,7 +1706,7 @@ NSGigE::txKick()
                             udp->sum(cksum(udp));
                             txUdpChecksums++;
                         } else {
-                            debug_break();
+                            Debug::breakpoint();
                             warn_once("UDPPKT set, but not UDP!\n");
                         }
                     } else if (extsts & EXTSTS_TCPPKT) {
@@ -1713,7 +1716,7 @@ NSGigE::txKick()
                             tcp->sum(cksum(tcp));
                             txTcpChecksums++;
                         } else {
-                            debug_break();
+                            Debug::breakpoint();
                             warn_once("TCPPKT set, but not UDP!\n");
                         }
                     }
@@ -1723,7 +1726,7 @@ NSGigE::txKick()
                             ip->sum(cksum(ip));
                             txIpChecksums++;
                         } else {
-                            debug_break();
+                            Debug::breakpoint();
                             warn_once("IPPKT set, but not UDP!\n");
                         }
                     }
@@ -1885,7 +1888,7 @@ NSGigE::txKick()
             NsTxStateStrings[txState]);
 
     if (clock && !txKickEvent.scheduled())
-        txKickEvent.schedule(txKickTick);
+        schedule(txKickEvent, txKickTick);
 }
 
 /**
@@ -1999,7 +2002,7 @@ NSGigE::transferDone()
 
     DPRINTF(Ethernet, "transfer complete: data in txFifo...schedule xmit\n");
 
-    txEvent.reschedule(curTick + ticks(1), true);
+    reschedule(txEvent, curTick() + ticks(1), true);
 }
 
 bool
@@ -2257,7 +2260,7 @@ NSGigE::serialize(ostream &os)
      * If there's a pending transmit, store the time so we can
      * reschedule it later
      */
-    Tick transmitTick = txEvent.scheduled() ? txEvent.when() - curTick : 0;
+    Tick transmitTick = txEvent.scheduled() ? txEvent.when() - curTick() : 0;
     SERIALIZE_SCALAR(transmitTick);
 
     /*
@@ -2400,7 +2403,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
     this->txDmaState = (DmaState) txDmaState;
     UNSERIALIZE_SCALAR(txKickTick);
     if (txKickTick)
-        txKickEvent.schedule(txKickTick);
+        schedule(txKickEvent, txKickTick);
 
     /*
      * unserialize rx state machine
@@ -2418,7 +2421,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
     this->rxDmaState = (DmaState) rxDmaState;
     UNSERIALIZE_SCALAR(rxKickTick);
     if (rxKickTick)
-        rxKickEvent.schedule(rxKickTick);
+        schedule(rxKickEvent, rxKickTick);
 
     /*
      * Unserialize EEPROM state machine
@@ -2438,7 +2441,7 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
     Tick transmitTick;
     UNSERIALIZE_SCALAR(transmitTick);
     if (transmitTick)
-        txEvent.schedule(curTick + transmitTick);
+        schedule(txEvent, curTick() + transmitTick);
 
     /*
      * unserialize receive address filter settings
@@ -2459,7 +2462,8 @@ NSGigE::unserialize(Checkpoint *cp, const std::string &section)
     Tick intrEventTick;
     UNSERIALIZE_SCALAR(intrEventTick);
     if (intrEventTick) {
-        intrEvent = new IntrEvent(this, intrEventTick, true);
+        intrEvent = new IntrEvent(this, true);
+        schedule(intrEvent, intrEventTick);
     }
 }