Don't hard code the location of m5AlphaAccess. Instead, move the
authorNathan Binkert <binkertn@umich.edu>
Tue, 28 Jun 2005 16:42:15 +0000 (12:42 -0400)
committerNathan Binkert <binkertn@umich.edu>
Tue, 28 Jun 2005 16:42:15 +0000 (12:42 -0400)
code into a function that can be called by the AlphaConsole class.
AlphaConsole will pass in its address.

arch/alpha/ev5.hh:
    Move Phys2K0Seg to ev5.hh and fixup the TSUNAMI uncacheable
    bits so that they will be converted correctly.
dev/alpha_access.h:
    Do not hard code the location of the AlphaConsole
dev/alpha_console.cc:
    fixup #includes
    tell the system where the alpha console is
sim/system.hh:
    Provide a function that will tell the system where the AlphaAccess
    structure (device) lives

--HG--
extra : convert_revision : 92d70ca926151a32eebe9925de597459ac58013e

arch/alpha/ev5.hh
dev/alpha_access.h
dev/alpha_console.cc
sim/system.cc
sim/system.hh

index 8508162ed73096b5a4bee8f43f28a0dbcb8d9ee2..a5a76b5bdd27c6f73cea9398c7b806b07a5eda93 100644 (file)
@@ -58,6 +58,16 @@ const Addr PAddrUncachedBit39 = ULL(0x8000000000);
 const Addr PAddrUncachedBit40 = ULL(0x10000000000);
 const Addr PAddrUncachedBit43 = ULL(0x80000000000);
 const Addr PAddrUncachedMask = ULL(0x807ffffffff); // Clear PA<42:35>
+inline Addr Phys2K0Seg(Addr addr)
+{
+#ifndef ALPHA_TLASER
+    if (addr & PAddrUncachedBit43) {
+        addr &= PAddrUncachedMask;
+        addr |= PAddrUncachedBit40;
+    }
+#endif
+    return addr | AlphaISA::K0SegBase;
+}
 
 inline int DTB_ASN_ASN(uint64_t reg) { return reg >> 57 & AsnMask; }
 inline Addr DTB_PTE_PPN(uint64_t reg)
index b62966ea0072537ba102528dbc8af1e838fe0f55..a20a055353dfd60aa10764376c64ccfe075f5b6b 100644 (file)
 #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
index 3c009d4bdc6a717b0bfb92df2c20e9fa1e2c86e0..34c2978aa9a1f5b69752e8cfe2e91425c5b1b0b4 100644 (file)
 #include <string>
 
 #include "base/inifile.hh"
-#include "base/str.hh" // for to_number()
+#include "base/str.hh"
 #include "base/trace.hh"
 #include "cpu/base.hh"
 #include "cpu/exec_context.hh"
 #include "dev/alpha_console.hh"
 #include "dev/simconsole.hh"
 #include "dev/simple_disk.hh"
+#include "dev/tsunami_io.hh"
 #include "mem/bus/bus.hh"
 #include "mem/bus/pio_interface.hh"
 #include "mem/bus/pio_interface_impl.hh"
 #include "mem/functional/memory_control.hh"
 #include "mem/functional/physical.hh"
 #include "sim/builder.hh"
-#include "sim/system.hh"
-#include "dev/tsunami_io.hh"
 #include "sim/sim_object.hh"
-#include "targetarch/byte_swap.hh"
+#include "sim/system.hh"
 
 using namespace std;
 
@@ -85,6 +84,8 @@ AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
     alphaAccess->bootStrapImpure = 0;
     alphaAccess->bootStrapCPU = 0;
     alphaAccess->align2 = 0;
+
+    system->setAlphaAccess(addr);
 }
 
 void
index c1a4c2a87ac8b052430929430f32c425ccc3be7e..8397b8e01d37f6fceee435bdd18c7628b864e820 100644 (file)
@@ -30,7 +30,6 @@
 #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"
@@ -144,21 +143,6 @@ 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.
@@ -196,6 +180,23 @@ System::~System()
 #endif
 }
 
+void
+System::setAlphaAccess(Addr access)
+{
+    Addr addr = 0;
+    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(EV5::Phys2K0Seg(access));
+    } else
+        panic("could not find m5AlphaAccess\n");
+}
+
 bool
 System::breakpoint()
 {
index c3e4d6d687fb072c69002a4b7132b5a54888054d..ab6d264eae7c5c08ed052b35418a7eee6b7ac6ee 100644 (file)
@@ -127,6 +127,11 @@ class System : public SimObject
     void startup();
 
   public:
+    /**
+     * Set the m5AlphaAccess pointer in the console
+     */
+    void setAlphaAccess(Addr access);
+
     /**
      * Returns the addess the kernel starts at.
      * @return address the kernel starts at