summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev/alpha_console.cc5
-rw-r--r--dev/alpha_console.hh3
-rw-r--r--dev/tsunami.cc17
-rw-r--r--dev/tsunami.hh5
-rw-r--r--dev/tsunami_cchip.cc25
-rw-r--r--dev/tsunami_cchip.hh5
-rw-r--r--dev/tsunami_io.cc27
-rw-r--r--dev/tsunami_io.hh14
-rw-r--r--dev/tsunami_pchip.cc12
-rw-r--r--dev/tsunami_pchip.hh2
10 files changed, 71 insertions, 44 deletions
diff --git a/dev/alpha_console.cc b/dev/alpha_console.cc
index ccf6c33fd..359995693 100644
--- a/dev/alpha_console.cc
+++ b/dev/alpha_console.cc
@@ -46,12 +46,13 @@
#include "mem/functional_mem/memory_control.hh"
#include "sim/builder.hh"
#include "sim/system.hh"
+#include "dev/tsunami_io.hh"
using namespace std;
AlphaConsole::AlphaConsole(const string &name, SimConsole *cons,
SimpleDisk *d, int size, System *system,
- BaseCPU *cpu, TlaserClock *clock, int num_cpus,
+ BaseCPU *cpu, TsunamiIO *clock, int num_cpus,
Addr addr, Addr mask, MemoryController *mmu)
: MmapDevice(name, addr, mask, mmu), disk(d), console(cons)
{
@@ -250,7 +251,7 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(AlphaConsole)
Param<Addr> mask;
SimObjectParam<System *> system;
SimObjectParam<BaseCPU *> cpu;
- SimObjectParam<TlaserClock *> clock;
+ SimObjectParam<TsunamiIO *> clock;
END_DECLARE_SIM_OBJECT_PARAMS(AlphaConsole)
diff --git a/dev/alpha_console.hh b/dev/alpha_console.hh
index 9e774773e..105b03849 100644
--- a/dev/alpha_console.hh
+++ b/dev/alpha_console.hh
@@ -36,6 +36,7 @@
#include "sim/host.hh"
#include "dev/alpha_access.h"
#include "mem/functional_mem/mmap_device.hh"
+#include "dev/tsunami_io.hh"
class BaseCPU;
class SimConsole;
@@ -87,7 +88,7 @@ class AlphaConsole : public MmapDevice
AlphaConsole(const std::string &name, SimConsole *cons,
SimpleDisk *d, int size,
System *system, BaseCPU *cpu,
- TlaserClock *clock, int num_cpus,
+ TsunamiIO *clock, int num_cpus,
Addr addr, Addr mask, MemoryController *mmu);
public:
diff --git a/dev/tsunami.cc b/dev/tsunami.cc
index 95c671495..a8cf551d3 100644
--- a/dev/tsunami.cc
+++ b/dev/tsunami.cc
@@ -44,10 +44,9 @@
using namespace std;
Tsunami::Tsunami(const string &name, ScsiController *s, EtherDev *e,
- TlaserClock *c, TsunamiCChip *cc, TsunamiPChip *pc, SimConsole *con,
- IntrControl *ic, int intr_freq)
- : SimObject(name), intctrl(ic), cons(con), scsi(s), ethernet(e),
- clock(c), cchip(cc), pchip(pc), interrupt_frequency(intr_freq)
+ SimConsole *con, IntrControl *ic, int intr_freq)
+ : SimObject(name), intrctrl(ic), cons(con), scsi(s), ethernet(e),
+ interrupt_frequency(intr_freq)
{
for (int i = 0; i < Tsunami::Max_CPUs; i++)
intr_sum_type[i] = 0;
@@ -69,9 +68,6 @@ BEGIN_DECLARE_SIM_OBJECT_PARAMS(Tsunami)
SimObjectParam<ScsiController *> scsi;
SimObjectParam<EtherDev *> ethernet;
- SimObjectParam<TlaserClock *> clock;
- SimObjectParam<TsunamiCChip *> cchip;
- SimObjectParam<TsunamiPChip *> pchip;
SimObjectParam<SimConsole *> cons;
SimObjectParam<IntrControl *> intrctrl;
Param<int> interrupt_frequency;
@@ -82,9 +78,6 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(Tsunami)
INIT_PARAM(scsi, "scsi controller"),
INIT_PARAM(ethernet, "ethernet controller"),
- INIT_PARAM(clock, "turbolaser clock"),
- INIT_PARAM(cchip, "cchip"),
- INIT_PARAM(pchip, "pchip"),
INIT_PARAM(cons, "system console"),
INIT_PARAM(intrctrl, "interrupt controller"),
INIT_PARAM_DFLT(interrupt_frequency, "frequency of interrupts", 1200)
@@ -94,8 +87,8 @@ END_INIT_SIM_OBJECT_PARAMS(Tsunami)
CREATE_SIM_OBJECT(Tsunami)
{
- return new Tsunami(getInstanceName(), scsi, ethernet, clock,
- cchip, pchip, cons, intrctrl, interrupt_frequency);
+ return new Tsunami(getInstanceName(), scsi, ethernet,
+ cons, intrctrl, interrupt_frequency);
}
REGISTER_SIM_OBJECT("Tsunami", Tsunami)
diff --git a/dev/tsunami.hh b/dev/tsunami.hh
index 0ba3cdf67..57e4b8991 100644
--- a/dev/tsunami.hh
+++ b/dev/tsunami.hh
@@ -46,14 +46,13 @@ class Tsunami : public SimObject
static const int Max_CPUs = 4;
- IntrControl *intctrl;
+ IntrControl *intrctrl;
// ConsoleListener *listener;
SimConsole *cons;
ScsiController *scsi;
EtherDev *ethernet;
- TlaserClock *clock;
TsunamiCChip *cchip;
TsunamiPChip *pchip;
@@ -64,7 +63,7 @@ class Tsunami : public SimObject
public:
Tsunami(const std::string &name, ScsiController *scsi,
- EtherDev *ethernet, TlaserClock *clock, TsunamiCChip *cc, TsunamiPChip *pc,
+ EtherDev *ethernet,
SimConsole *, IntrControl *intctrl, int intrFreq);
virtual void serialize(std::ostream &os);
diff --git a/dev/tsunami_cchip.cc b/dev/tsunami_cchip.cc
index ca9eae184..6559f3809 100644
--- a/dev/tsunami_cchip.cc
+++ b/dev/tsunami_cchip.cc
@@ -17,15 +17,16 @@
#include "dev/tsunami_cchip.hh"
#include "dev/tsunamireg.h"
#include "dev/tsunami.hh"
+#include "cpu/intr_control.hh"
#include "mem/functional_mem/memory_control.hh"
#include "sim/builder.hh"
#include "sim/system.hh"
using namespace std;
-TsunamiCChip::TsunamiCChip(const string &name, /*Tsunami *t,*/
+TsunamiCChip::TsunamiCChip(const string &name, Tsunami *t,
Addr addr, Addr mask, MemoryController *mmu)
- : MmapDevice(name, addr, mask, mmu)/*, tsunami(t) */
+ : MmapDevice(name, addr, mask, mmu), tsunami(t)
{
for(int i=0; i < Tsunami::Max_CPUs; i++) {
dim[i] = 0;
@@ -33,6 +34,11 @@ TsunamiCChip::TsunamiCChip(const string &name, /*Tsunami *t,*/
}
drir = 0;
+ misc = 0;
+ RTCInterrupting = false;
+
+ //Put back pointer in tsunami
+ tsunami->cchip = this;
}
Fault
@@ -56,7 +62,7 @@ TsunamiCChip::read(MemReqPtr req, uint8_t *data)
panic("TSDEV_CC_MTR not implemeted\n");
return No_Fault;
case TSDEV_CC_MISC:
- panic("TSDEV_CC_MISC not implemented\n");
+ *(uint64_t*)data = misc;
return No_Fault;
case TSDEV_CC_AAR0:
case TSDEV_CC_AAR1:
@@ -141,7 +147,12 @@ TsunamiCChip::write(MemReqPtr req, const uint8_t *data)
panic("TSDEV_CC_MTR write not implemented\n");
return No_Fault;
case TSDEV_CC_MISC:
- panic("TSDEV_CC_MISC write not implemented\n");
+ //If it is the seventh bit, clear the RTC interrupt
+ if ((*(uint64_t*) data) & (1<<7)) {
+ RTCInterrupting = false;
+ tsunami->intrctrl->clear(0, TheISA::INTLEVEL_IRQ2, 0);
+ misc &= ~(1<<7);
+ } else panic("TSDEV_CC_MISC write not implemented\n");
return No_Fault;
case TSDEV_CC_AAR0:
case TSDEV_CC_AAR1:
@@ -216,7 +227,7 @@ TsunamiCChip::unserialize(Checkpoint *cp, const std::string &section)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiCChip)
- // SimObjectParam<Tsunami *> tsunami;
+ SimObjectParam<Tsunami *> tsunami;
SimObjectParam<MemoryController *> mmu;
Param<Addr> addr;
Param<Addr> mask;
@@ -225,7 +236,7 @@ END_DECLARE_SIM_OBJECT_PARAMS(TsunamiCChip)
BEGIN_INIT_SIM_OBJECT_PARAMS(TsunamiCChip)
-// INIT_PARAM(tsunami, "Tsunami"),
+ INIT_PARAM(tsunami, "Tsunami"),
INIT_PARAM(mmu, "Memory Controller"),
INIT_PARAM(addr, "Device Address"),
INIT_PARAM(mask, "Address Mask")
@@ -234,7 +245,7 @@ END_INIT_SIM_OBJECT_PARAMS(TsunamiCChip)
CREATE_SIM_OBJECT(TsunamiCChip)
{
- return new TsunamiCChip(getInstanceName(), /*tsunami,*/ addr, mask, mmu);
+ return new TsunamiCChip(getInstanceName(), tsunami, addr, mask, mmu);
}
REGISTER_SIM_OBJECT("TsunamiCChip", TsunamiCChip)
diff --git a/dev/tsunami_cchip.hh b/dev/tsunami_cchip.hh
index b5b2d194c..287fbdf70 100644
--- a/dev/tsunami_cchip.hh
+++ b/dev/tsunami_cchip.hh
@@ -50,7 +50,7 @@ class TsunamiCChip : public MmapDevice
uint64_t drir;
public:
- TsunamiCChip(const std::string &name, /*Tsunami *t,*/
+ TsunamiCChip(const std::string &name, Tsunami *t,
Addr addr, Addr mask, MemoryController *mmu);
virtual Fault read(MemReqPtr req, uint8_t *data);
@@ -58,6 +58,9 @@ class TsunamiCChip : public MmapDevice
virtual void serialize(std::ostream &os);
virtual void unserialize(Checkpoint *cp, const std::string &section);
+
+ uint64_t misc;
+ bool RTCInterrupting;
};
#endif // __TSUNAMI_CCHIP_HH__
diff --git a/dev/tsunami_io.cc b/dev/tsunami_io.cc
index b6533dcba..611496e58 100644
--- a/dev/tsunami_io.cc
+++ b/dev/tsunami_io.cc
@@ -19,6 +19,7 @@
#include "dev/tsunami.hh"
#include "mem/functional_mem/memory_control.hh"
#include "sim/builder.hh"
+#include "dev/tsunami_cchip.hh"
using namespace std;
@@ -28,8 +29,8 @@ using namespace std;
#define RTC_RATE 1024
// Timer Event for Periodic interrupt of RTC
-TsunamiIO::RTCEvent::RTCEvent()
- : Event(&mainEventQueue)
+TsunamiIO::RTCEvent::RTCEvent(Tsunami* t)
+ : Event(&mainEventQueue), tsunami(t)
{
DPRINTF(MC146818, "RTC Event Initilizing\n");
schedule(curTick + ticksPerSecond/RTC_RATE);
@@ -41,6 +42,11 @@ TsunamiIO::RTCEvent::process()
DPRINTF(MC146818, "Timer Interrupt\n");
schedule(curTick + ticksPerSecond/RTC_RATE);
//Actually interrupt the processor here
+ if (!tsunami->cchip->RTCInterrupting) {
+ tsunami->cchip->misc |= 1 << 7;
+ tsunami->cchip->RTCInterrupting = true;
+ tsunami->intrctrl->post(0, TheISA::INTLEVEL_IRQ2, 0);
+ }
}
const char *
@@ -98,9 +104,9 @@ TsunamiIO::ClockEvent::Status()
-TsunamiIO::TsunamiIO(const string &name, /*Tsunami *t,*/ time_t init_time,
- Addr addr, Addr mask, MemoryController *mmu)
- : MmapDevice(name, addr, mask, mmu)/*, tsunami(t) */
+TsunamiIO::TsunamiIO(const string &name, Tsunami *t, time_t init_time,
+ Addr addr, Addr mask, uint32_t f, MemoryController *mmu)
+ : MmapDevice(name, addr, mask, mmu), tsunami(t), rtc(t), freq(f)
{
timerData = 0;
set_time(init_time == 0 ? time(NULL) : init_time);
@@ -289,28 +295,31 @@ TsunamiIO::unserialize(Checkpoint *cp, const std::string &section)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO)
- // SimObjectParam<Tsunami *> tsunami;
+ SimObjectParam<Tsunami *> tsunami;
Param<time_t> time;
SimObjectParam<MemoryController *> mmu;
Param<Addr> addr;
Param<Addr> mask;
+ Param<uint32_t> frequency;
END_DECLARE_SIM_OBJECT_PARAMS(TsunamiIO)
BEGIN_INIT_SIM_OBJECT_PARAMS(TsunamiIO)
-// INIT_PARAM(tsunami, "Tsunami"),
+ INIT_PARAM(tsunami, "Tsunami"),
INIT_PARAM_DFLT(time, "System time to use "
"(0 for actual time, default is 1/1/06", ULL(1136073600)),
INIT_PARAM(mmu, "Memory Controller"),
INIT_PARAM(addr, "Device Address"),
- INIT_PARAM(mask, "Address Mask")
+ INIT_PARAM(mask, "Address Mask"),
+ INIT_PARAM(frequency, "clock interrupt frequency")
END_INIT_SIM_OBJECT_PARAMS(TsunamiIO)
CREATE_SIM_OBJECT(TsunamiIO)
{
- return new TsunamiIO(getInstanceName(), /*tsunami,*/ time, addr, mask, mmu);
+ return new TsunamiIO(getInstanceName(), tsunami, time, addr,
+ mask, frequency, mmu);
}
REGISTER_SIM_OBJECT("TsunamiIO", TsunamiIO)
diff --git a/dev/tsunami_io.hh b/dev/tsunami_io.hh
index fe904605c..e945eb53d 100644
--- a/dev/tsunami_io.hh
+++ b/dev/tsunami_io.hh
@@ -72,8 +72,10 @@ class TsunamiIO : public MmapDevice
class RTCEvent : public Event
{
+ protected:
+ Tsunami* tsunami;
public:
- RTCEvent();
+ RTCEvent(Tsunami* t);
virtual void process();
virtual const char *description();
@@ -86,6 +88,8 @@ class TsunamiIO : public MmapDevice
uint8_t mode1;
uint8_t mode2;
+ Tsunami *tsunami;
+
/* This timer is initilized, but after I wrote the code
it doesn't seem to be used again, and best I can tell
it too is not connected to any interrupt port */
@@ -103,9 +107,13 @@ class TsunamiIO : public MmapDevice
uint32_t timerData;
+ uint32_t freq;
+
public:
- TsunamiIO(const std::string &name, /*Tsunami *t,*/ time_t init_time,
- Addr addr, Addr mask, MemoryController *mmu);
+ uint32_t frequency() const { return freq; }
+
+ TsunamiIO(const std::string &name, Tsunami *t, time_t init_time,
+ Addr addr, Addr mask, uint32_t f, MemoryController *mmu);
void set_time(time_t t);
diff --git a/dev/tsunami_pchip.cc b/dev/tsunami_pchip.cc
index aced6f940..aadcf998f 100644
--- a/dev/tsunami_pchip.cc
+++ b/dev/tsunami_pchip.cc
@@ -23,9 +23,9 @@
using namespace std;
-TsunamiPChip::TsunamiPChip(const string &name, /*Tsunami *t,*/
+TsunamiPChip::TsunamiPChip(const string &name, Tsunami *t,
Addr addr, Addr mask, MemoryController *mmu)
- : MmapDevice(name, addr, mask, mmu)/*, tsunami(t) */
+ : MmapDevice(name, addr, mask, mmu), tsunami(t)
{
wsba0 = 0;
wsba1 = 0;
@@ -40,6 +40,8 @@ TsunamiPChip::TsunamiPChip(const string &name, /*Tsunami *t,*/
tba2 = 0;
tba3 = 0;
+ //Set back pointer in tsunami
+ tsunami->pchip = this;
}
Fault
@@ -234,7 +236,7 @@ TsunamiPChip::unserialize(Checkpoint *cp, const std::string &section)
BEGIN_DECLARE_SIM_OBJECT_PARAMS(TsunamiPChip)
-/* SimObjectParam<Tsunami *> tsunami;*/
+ SimObjectParam<Tsunami *> tsunami;
SimObjectParam<MemoryController *> mmu;
Param<Addr> addr;
Param<Addr> mask;
@@ -243,7 +245,7 @@ END_DECLARE_SIM_OBJECT_PARAMS(TsunamiPChip)
BEGIN_INIT_SIM_OBJECT_PARAMS(TsunamiPChip)
- /*INIT_PARAM(tsunami, "Tsunami"),*/
+ INIT_PARAM(tsunami, "Tsunami"),
INIT_PARAM(mmu, "Memory Controller"),
INIT_PARAM(addr, "Device Address"),
INIT_PARAM(mask, "Address Mask")
@@ -252,7 +254,7 @@ END_INIT_SIM_OBJECT_PARAMS(TsunamiPChip)
CREATE_SIM_OBJECT(TsunamiPChip)
{
- return new TsunamiPChip(getInstanceName(), /*tsunami,*/ addr, mask, mmu);
+ return new TsunamiPChip(getInstanceName(), tsunami, addr, mask, mmu);
}
REGISTER_SIM_OBJECT("TsunamiPChip", TsunamiPChip)
diff --git a/dev/tsunami_pchip.hh b/dev/tsunami_pchip.hh
index cd87cf03a..6a7f24e95 100644
--- a/dev/tsunami_pchip.hh
+++ b/dev/tsunami_pchip.hh
@@ -61,7 +61,7 @@ class TsunamiPChip : public MmapDevice
public:
- TsunamiPChip(const std::string &name, /*Tsunami *t,*/
+ TsunamiPChip(const std::string &name, Tsunami *t,
Addr addr, Addr mask, MemoryController *mmu);
virtual Fault read(MemReqPtr req, uint8_t *data);