summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2004-06-01 17:36:38 -0400
committerAli Saidi <saidi@eecs.umich.edu>2004-06-01 17:36:38 -0400
commit6010f637ff125b25ce7ee0189a08e55b9b2de331 (patch)
tree41acc26973bb7f98ba19f8f5a45e0778529cff57
parentcaf5cad959d8c75095590e0e6e1a9ed1f243366e (diff)
downloadgem5-6010f637ff125b25ce7ee0189a08e55b9b2de331.tar.xz
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
-rw-r--r--dev/alpha_console.cc17
-rw-r--r--dev/alpha_console.hh5
-rw-r--r--dev/platform.hh1
-rw-r--r--dev/tsunami.cc6
-rw-r--r--dev/tsunami.hh6
-rw-r--r--dev/tsunami_io.hh7
6 files changed, 25 insertions, 17 deletions
diff --git a/dev/alpha_console.cc b/dev/alpha_console.cc
index 111b23c81..3d2ad0ec6 100644
--- a/dev/alpha_console.cc
+++ b/dev/alpha_console.cc
@@ -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);
}
diff --git a/dev/alpha_console.hh b/dev/alpha_console.hh
index 4986d0e5f..fa527dc32 100644
--- a/dev/alpha_console.hh
+++ b/dev/alpha_console.hh
@@ -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);
diff --git a/dev/platform.hh b/dev/platform.hh
index 407f58406..f77b520a3 100644
--- a/dev/platform.hh
+++ b/dev/platform.hh
@@ -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_
diff --git a/dev/tsunami.cc b/dev/tsunami.cc
index 8956ee557..b5e7ab3b8 100644
--- a/dev/tsunami.cc
+++ b/dev/tsunami.cc
@@ -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()
{
diff --git a/dev/tsunami.hh b/dev/tsunami.hh
index c5dbe797b..a237a8035 100644
--- a/dev/tsunami.hh
+++ b/dev/tsunami.hh
@@ -96,6 +96,12 @@ class Tsunami : public Platform
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.
*/
virtual void postConsoleInt();
diff --git a/dev/tsunami_io.hh b/dev/tsunami_io.hh
index 1dd7762e3..62af2153b 100644
--- a/dev/tsunami_io.hh
+++ b/dev/tsunami_io.hh
@@ -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; }
/**