Pass the location of the m5 console backdoor to the console
authorNathan Binkert <binkertn@umich.edu>
Tue, 28 Jun 2005 05:09:13 +0000 (01:09 -0400)
committerNathan Binkert <binkertn@umich.edu>
Tue, 28 Jun 2005 05:09:13 +0000 (01:09 -0400)
instead of compiling it into the console version

dev/alpha_access.h:
    move serialization stuff to alpha_console.hh
    define the ALPHA_ACCESS_BASE in m5 instead of in console.c and
    have m5 pass the value to the console
dev/alpha_console.cc:
dev/alpha_console.hh:
    Move serialization stuff into a derived class of AlphaAccess
sim/system.cc:
    pass the value of ALPHA_ACCESS_BASE to the console code via
    the m5AlphaAccess console variable.

--HG--
extra : convert_revision : 0ea4ba239f03d6dad51a6efae0385aa543064117

dev/alpha_access.h
dev/alpha_console.cc
dev/alpha_console.hh
sim/system.cc

index 07350d622ba0e5145960ba414aa6c84d8d095a64..b62966ea0072537ba102528dbc8af1e838fe0f55 100644 (file)
  * System Console Memory Mapped Register Definition
  */
 
-#define ALPHA_ACCESS_VERSION (1302)
+#define ALPHA_ACCESS_VERSION (1303)
 
-#ifndef CONSOLE
-#include <iosfwd>
-#include <string>
-class Checkpoint;
-#else
+#ifdef CONSOLE
 typedef unsigned uint32_t;
 typedef unsigned long uint64_t;
+#else
+#ifdef ALPHA_TLASER
+#define ALPHA_ACCESS_BASE ULL(0xfffffc8000a00000)
+#else
+#define ALPHA_ACCESS_BASE ULL(0xfffffd0200000000)
+#endif
 #endif
 
 // This structure hacked up from simos
@@ -74,11 +76,6 @@ struct AlphaAccess
     uint64_t   bootStrapImpure;        // 70:
     uint32_t   bootStrapCPU;           // 78:
     uint32_t   align2;                 // 7C: Dummy placeholder for alignment
-
-#ifndef CONSOLE
-    void serialize(std::ostream &os);
-    void unserialize(Checkpoint *cp, const std::string &section);
-#endif
 };
 
 #endif // __ALPHA_ACCESS_H__
index 2cbe60f47ad41cb4b8746a684fca4d5a8f48a171..3c009d4bdc6a717b0bfb92df2c20e9fa1e2c86e0 100644 (file)
@@ -69,7 +69,7 @@ AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
         pioInterface->addAddrRange(RangeSize(addr, size));
     }
 
-    alphaAccess = new AlphaAccess;
+    alphaAccess = new Access;
     alphaAccess->last_offset = size - 1;
 
     alphaAccess->version = ALPHA_ACCESS_VERSION;
@@ -268,7 +268,7 @@ AlphaConsole::cacheAccess(MemReqPtr &req)
 }
 
 void
-AlphaAccess::serialize(ostream &os)
+AlphaConsole::Access::serialize(ostream &os)
 {
     SERIALIZE_SCALAR(last_offset);
     SERIALIZE_SCALAR(version);
@@ -291,7 +291,7 @@ AlphaAccess::serialize(ostream &os)
 }
 
 void
-AlphaAccess::unserialize(Checkpoint *cp, const std::string &section)
+AlphaConsole::Access::unserialize(Checkpoint *cp, const std::string &section)
 {
     UNSERIALIZE_SCALAR(last_offset);
     UNSERIALIZE_SCALAR(version);
index 63e0d3ae4da37644df180a4d1dd634c046870b97..eb59626f54be175cc9d64fdd967c5d0cb165973a 100644 (file)
@@ -72,8 +72,14 @@ class SimpleDisk;
 class AlphaConsole : public PioDevice
 {
   protected:
+    struct Access : public AlphaAccess
+    {
+        void serialize(std::ostream &os);
+        void unserialize(Checkpoint *cp, const std::string &section);
+    };
+
     union {
-        AlphaAccess *alphaAccess;
+        Access *alphaAccess;
         uint8_t *consoleData;
     };
 
index 3ac0fdce16b8196060f5e18a5d47ddde1da106a2..c1a4c2a87ac8b052430929430f32c425ccc3be7e 100644 (file)
@@ -30,6 +30,7 @@
 #include "base/loader/symtab.hh"
 #include "base/remote_gdb.hh"
 #include "cpu/exec_context.hh"
+#include "dev/alpha_access.h"
 #include "kern/kernel_stats.hh"
 #include "mem/functional/memory_control.hh"
 #include "mem/functional/physical.hh"
@@ -143,6 +144,21 @@ System::System(Params *p)
               strcpy(osflags, params->boot_osflags.c_str());
     }
 
+    /**
+     * Set the m5AlphaAccess pointer in the console
+     */
+    if (consoleSymtab->findAddress("m5AlphaAccess", addr)) {
+        Addr paddr = vtophys(physmem, addr);
+        uint64_t *m5AlphaAccess =
+            (uint64_t *)physmem->dma_addr(paddr, sizeof(uint64_t));
+
+        if (!m5AlphaAccess)
+            panic("could not translate m5AlphaAccess addr\n");
+
+        *m5AlphaAccess = htoa(ALPHA_ACCESS_BASE);
+    } else
+        panic("could not find m5AlphaAccess\n");
+
     /**
      * Set the hardware reset parameter block system type and revision
      * information to Tsunami.