diff options
Diffstat (limited to 'dev/alpha_console.cc')
-rw-r--r-- | dev/alpha_console.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/dev/alpha_console.cc b/dev/alpha_console.cc index 3ae1aede5..c4799bf6b 100644 --- a/dev/alpha_console.cc +++ b/dev/alpha_console.cc @@ -35,29 +35,28 @@ #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; AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d, System *s, BaseCPU *c, Platform *p, - int num_cpus, MemoryController *mmu, Addr a, + MemoryController *mmu, Addr a, HierParams *hier, Bus *bus) : PioDevice(name, p), disk(d), console(cons), system(s), cpu(c), addr(a) { @@ -69,11 +68,10 @@ 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; - alphaAccess->numCPUs = num_cpus; alphaAccess->diskUnit = 1; alphaAccess->diskCount = 0; @@ -85,11 +83,14 @@ AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d, alphaAccess->bootStrapImpure = 0; alphaAccess->bootStrapCPU = 0; alphaAccess->align2 = 0; + + system->setAlphaAccess(addr); } void -AlphaConsole::init() +AlphaConsole::startup() { + alphaAccess->numCPUs = system->getNumCPUs(); alphaAccess->kernStart = system->getKernelStart(); alphaAccess->kernEnd = system->getKernelEnd(); alphaAccess->entryPoint = system->getKernelEntry(); @@ -108,7 +109,8 @@ AlphaConsole::read(MemReqPtr &req, uint8_t *data) switch (req->size) { case sizeof(uint32_t): - DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr, *(uint32_t*)data); + DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr, + *(uint32_t*)data); switch (daddr) { case offsetof(AlphaAccess, last_offset): @@ -133,7 +135,8 @@ AlphaConsole::read(MemReqPtr &req, uint8_t *data) } break; case sizeof(uint64_t): - DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr, *(uint64_t*)data); + DPRINTF(AlphaConsole, "read: offset=%#x val=%#x\n", daddr, + *(uint64_t*)data); switch (daddr) { case offsetof(AlphaAccess, inputChar): @@ -266,7 +269,7 @@ AlphaConsole::cacheAccess(MemReqPtr &req) } void -AlphaAccess::serialize(ostream &os) +AlphaConsole::Access::serialize(ostream &os) { SERIALIZE_SCALAR(last_offset); SERIALIZE_SCALAR(version); @@ -289,7 +292,7 @@ AlphaAccess::serialize(ostream &os) } void -AlphaAccess::unserialize(Checkpoint *cp, const std::string §ion) +AlphaConsole::Access::unserialize(Checkpoint *cp, const std::string §ion) { UNSERIALIZE_SCALAR(last_offset); UNSERIALIZE_SCALAR(version); @@ -327,7 +330,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaConsole) SimObjectParam<SimConsole *> sim_console; SimObjectParam<SimpleDisk *> disk; - Param<int> num_cpus; SimObjectParam<MemoryController *> mmu; Param<Addr> addr; SimObjectParam<System *> system; @@ -343,7 +345,6 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaConsole) INIT_PARAM(sim_console, "The Simulator Console"), INIT_PARAM(disk, "Simple Disk"), - INIT_PARAM_DFLT(num_cpus, "Number of CPU's", 1), INIT_PARAM(mmu, "Memory Controller"), INIT_PARAM(addr, "Device Address"), INIT_PARAM(system, "system object"), @@ -358,8 +359,7 @@ END_INIT_SIM_OBJECT_PARAMS(AlphaConsole) CREATE_SIM_OBJECT(AlphaConsole) { return new AlphaConsole(getInstanceName(), sim_console, disk, - system, cpu, platform, num_cpus, mmu, - addr, hier, io_bus); + system, cpu, platform, mmu, addr, hier, io_bus); } REGISTER_SIM_OBJECT("AlphaConsole", AlphaConsole) |