Removed dynamic cast to get interrupt frequency and replaced with a
virtual function in alphaaccess.cc dev/alpha_console.cc: dev/alpha_console.hh: dev/platform.hh: dev/tsunami.cc: dev/tsunami.hh: dev/tsunami_io.hh: Removed dynamic cast to get interrupt frequency and replaced with a virtual function --HG-- extra : convert_revision : 01f514a33d8f76c6527ab25a713d5c86f9fd646e
This commit is contained in:
parent
caf5cad959
commit
6010f637ff
6 changed files with 25 additions and 17 deletions
|
@ -55,7 +55,7 @@
|
|||
using namespace std;
|
||||
|
||||
AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
|
||||
System *system, BaseCPU *cpu, SimObject *clock,
|
||||
System *system, BaseCPU *cpu, Platform *platform,
|
||||
int num_cpus, MemoryController *mmu, Addr a,
|
||||
HierParams *hier, Bus *bus)
|
||||
: PioDevice(name), disk(d), console(cons), addr(a)
|
||||
|
@ -80,14 +80,7 @@ AlphaConsole::AlphaConsole(const string &name, SimConsole *cons, SimpleDisk *d,
|
|||
alphaAccess->numCPUs = num_cpus;
|
||||
alphaAccess->mem_size = system->physmem->size();
|
||||
alphaAccess->cpuClock = cpu->getFreq() / 1000000;
|
||||
TsunamiIO *clock_linux = dynamic_cast<TsunamiIO *>(clock);
|
||||
TlaserClock *clock_tru64 = dynamic_cast<TlaserClock *>(clock);
|
||||
if (clock_linux)
|
||||
alphaAccess->intrClockFrequency = clock_linux->frequency();
|
||||
else if (clock_tru64)
|
||||
alphaAccess->intrClockFrequency = clock_tru64->frequency();
|
||||
else
|
||||
panic("clock must be of type TlaserClock or TsunamiIO\n");
|
||||
alphaAccess->intrClockFrequency = platform->intrFrequency();
|
||||
alphaAccess->diskUnit = 1;
|
||||
}
|
||||
|
||||
|
@ -274,7 +267,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaConsole)
|
|||
Param<Addr> addr;
|
||||
SimObjectParam<System *> system;
|
||||
SimObjectParam<BaseCPU *> cpu;
|
||||
SimObjectParam<SimObject *> clock;
|
||||
SimObjectParam<Platform *> platform;
|
||||
SimObjectParam<Bus*> io_bus;
|
||||
SimObjectParam<HierParams *> hier;
|
||||
|
||||
|
@ -289,7 +282,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(AlphaConsole)
|
|||
INIT_PARAM(addr, "Device Address"),
|
||||
INIT_PARAM(system, "system object"),
|
||||
INIT_PARAM(cpu, "Processor"),
|
||||
INIT_PARAM(clock, "Clock"),
|
||||
INIT_PARAM(platform, "platform"),
|
||||
INIT_PARAM_DFLT(io_bus, "The IO Bus to attach to", NULL),
|
||||
INIT_PARAM_DFLT(hier, "Hierarchy global variables", &defaultHierParams)
|
||||
|
||||
|
@ -298,7 +291,7 @@ END_INIT_SIM_OBJECT_PARAMS(AlphaConsole)
|
|||
CREATE_SIM_OBJECT(AlphaConsole)
|
||||
{
|
||||
return new AlphaConsole(getInstanceName(), sim_console, disk,
|
||||
system, cpu, clock, num_cpus, mmu,
|
||||
system, cpu, platform, num_cpus, mmu,
|
||||
addr, hier, io_bus);
|
||||
}
|
||||
|
||||
|
|
|
@ -37,13 +37,12 @@
|
|||
#include "dev/alpha_access.h"
|
||||
#include "dev/io_device.hh"
|
||||
#include "sim/host.hh"
|
||||
#include "dev/tsunami_io.hh"
|
||||
#include "sim/sim_object.hh"
|
||||
|
||||
class BaseCPU;
|
||||
class SimConsole;
|
||||
class System;
|
||||
class TlaserClock;
|
||||
class Platform;
|
||||
class SimpleDisk;
|
||||
|
||||
/*
|
||||
|
@ -91,7 +90,7 @@ class AlphaConsole : public PioDevice
|
|||
public:
|
||||
/** Standard Constructor */
|
||||
AlphaConsole(const std::string &name, SimConsole *cons, SimpleDisk *d,
|
||||
System *system, BaseCPU *cpu, SimObject *clock,
|
||||
System *system, BaseCPU *cpu, Platform *platform,
|
||||
int num_cpus, MemoryController *mmu, Addr addr,
|
||||
HierParams *hier, Bus *bus);
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ class Platform : public SimObject
|
|||
virtual ~Platform() {}
|
||||
virtual void postConsoleInt() = 0;
|
||||
virtual void clearConsoleInt() = 0;
|
||||
virtual Tick intrFrequency() = 0;
|
||||
};
|
||||
|
||||
#endif // __PLATFORM_HH_
|
||||
|
|
|
@ -56,6 +56,12 @@ Tsunami::Tsunami(const string &name, System *s,
|
|||
intr_sum_type[i] = 0;
|
||||
}
|
||||
|
||||
Tick
|
||||
Tsunami::intrFrequency()
|
||||
{
|
||||
return io->frequency();
|
||||
}
|
||||
|
||||
void
|
||||
Tsunami::postConsoleInt()
|
||||
{
|
||||
|
|
|
@ -95,6 +95,12 @@ class Tsunami : public Platform
|
|||
Tsunami(const std::string &name, System *s, IntrControl *intctrl,
|
||||
PciConfigAll *pci, int intrFreq);
|
||||
|
||||
/**
|
||||
* Return the interrupting frequency to AlphaAccess
|
||||
* @return frequency of RTC interrupts
|
||||
*/
|
||||
virtual Tick intrFrequency();
|
||||
|
||||
/**
|
||||
* Cause the cpu to post a serial interrupt to the CPU.
|
||||
*/
|
||||
|
|
|
@ -192,8 +192,11 @@ class TsunamiIO : public FunctionalMemory
|
|||
|
||||
|
||||
public:
|
||||
/** Return the freqency of the RTC */
|
||||
uint32_t frequency() const { return RTC_RATE; }
|
||||
/**
|
||||
* Return the freqency of the RTC
|
||||
* @return interrupt rate of the RTC
|
||||
*/
|
||||
Tick frequency() const { return RTC_RATE; }
|
||||
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue