summaryrefslogtreecommitdiff
path: root/src/dev/sparc
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2007-07-26 23:15:49 -0700
committerNathan Binkert <nate@binkert.org>2007-07-26 23:15:49 -0700
commitf0fef8f850b0c5aa73337ca11b26169163b2b2e1 (patch)
treed49d3492618ee85717554cddbe62cba1b5e7fb9c /src/dev/sparc
parent6b73ff43ff58502c80050c7aeff5a08a4ce61f87 (diff)
parentcda354b07035f73a3b220f89014721300d36a815 (diff)
downloadgem5-f0fef8f850b0c5aa73337ca11b26169163b2b2e1.tar.xz
Merge python and x86 changes with cache branch
--HG-- extra : convert_revision : e06a950964286604274fba81dcca362d75847233
Diffstat (limited to 'src/dev/sparc')
-rw-r--r--src/dev/sparc/dtod.cc42
-rw-r--r--src/dev/sparc/dtod.hh17
-rw-r--r--src/dev/sparc/iob.cc32
-rw-r--r--src/dev/sparc/iob.hh21
-rw-r--r--src/dev/sparc/mm_disk.cc40
-rw-r--r--src/dev/sparc/mm_disk.hh16
-rw-r--r--src/dev/sparc/t1000.cc23
7 files changed, 44 insertions, 147 deletions
diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc
index 22df873b6..81132ac65 100644
--- a/src/dev/sparc/dtod.cc
+++ b/src/dev/sparc/dtod.cc
@@ -37,26 +37,25 @@
#include <string>
#include <vector>
+#include "base/time.hh"
#include "base/trace.hh"
#include "dev/sparc/dtod.hh"
#include "dev/platform.hh"
#include "mem/packet_access.hh"
#include "mem/port.hh"
-#include "sim/builder.hh"
#include "sim/system.hh"
using namespace std;
using namespace TheISA;
-DumbTOD::DumbTOD(Params *p)
+DumbTOD::DumbTOD(const Params *p)
: BasicPioDevice(p)
{
- struct tm tm;
+ struct tm tm = p->time;
char *tz;
pioSize = 0x08;
- parseTime(p->init_time, &tm);
tz = getenv("TZ");
setenv("TZ", "", 1);
tzset();
@@ -103,37 +102,8 @@ DumbTOD::unserialize(Checkpoint *cp, const std::string &section)
UNSERIALIZE_SCALAR(todTime);
}
-
-BEGIN_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
-
- Param<Addr> pio_addr;
- Param<Tick> pio_latency;
- SimObjectParam<Platform *> platform;
- SimObjectParam<System *> system;
- VectorParam<int> time;
-
-END_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
-
-BEGIN_INIT_SIM_OBJECT_PARAMS(DumbTOD)
-
- INIT_PARAM(pio_addr, "Device Address"),
- INIT_PARAM(pio_latency, "Programmed IO latency"),
- INIT_PARAM(platform, "platform"),
- INIT_PARAM(system, "system object"),
- INIT_PARAM(time, "")
-
-END_INIT_SIM_OBJECT_PARAMS(DumbTOD)
-
-CREATE_SIM_OBJECT(DumbTOD)
+DumbTOD *
+DumbTODParams::create()
{
- DumbTOD::Params *p = new DumbTOD::Params;
- p->name =getInstanceName();
- p->pio_addr = pio_addr;
- p->pio_delay = pio_latency;
- p->platform = platform;
- p->system = system;
- p->init_time = time;
- return new DumbTOD(p);
+ return new DumbTOD(this);
}
-
-REGISTER_SIM_OBJECT("DumbTOD", DumbTOD)
diff --git a/src/dev/sparc/dtod.hh b/src/dev/sparc/dtod.hh
index ddf9fcc96..35dda42dd 100644
--- a/src/dev/sparc/dtod.hh
+++ b/src/dev/sparc/dtod.hh
@@ -40,7 +40,7 @@
#include "base/range.hh"
#include "dev/io_device.hh"
-
+#include "params/DumbTOD.hh"
/**
* DumbTOD simply returns some idea of time when read. Until we finish with
@@ -52,15 +52,14 @@ class DumbTOD : public BasicPioDevice
uint64_t todTime;
public:
- struct Params : public BasicPioDevice::Params
- {
- std::vector<int> init_time;
- };
- protected:
- const Params *params() const { return (const Params *)_params; }
+ typedef DumbTODParams Params;
+ DumbTOD(const Params *p);
- public:
- DumbTOD(Params *p);
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
virtual Tick read(PacketPtr pkt);
virtual Tick write(PacketPtr pkt);
diff --git a/src/dev/sparc/iob.cc b/src/dev/sparc/iob.cc
index b27f45eba..d0182770f 100644
--- a/src/dev/sparc/iob.cc
+++ b/src/dev/sparc/iob.cc
@@ -45,11 +45,10 @@
#include "dev/platform.hh"
#include "mem/port.hh"
#include "mem/packet_access.hh"
-#include "sim/builder.hh"
#include "sim/faults.hh"
#include "sim/system.hh"
-Iob::Iob(Params *p)
+Iob::Iob(const Params *p)
: PioDevice(p), ic(p->platform->intrctrl)
{
iobManAddr = ULL(0x9800000000);
@@ -371,31 +370,8 @@ Iob::unserialize(Checkpoint *cp, const std::string &section)
};
}
-
-
-
-BEGIN_DECLARE_SIM_OBJECT_PARAMS(Iob)
- Param<Tick> pio_latency;
- SimObjectParam<Platform *> platform;
- SimObjectParam<System *> system;
-END_DECLARE_SIM_OBJECT_PARAMS(Iob)
-
-BEGIN_INIT_SIM_OBJECT_PARAMS(Iob)
-
- INIT_PARAM(pio_latency, "Programmed IO latency"),
- INIT_PARAM(platform, "platform"),
- INIT_PARAM(system, "system object")
-
-END_INIT_SIM_OBJECT_PARAMS(Iob)
-
-CREATE_SIM_OBJECT(Iob)
+Iob *
+IobParams::create()
{
- Iob::Params *p = new Iob::Params;
- p->name = getInstanceName();
- p->pio_delay = pio_latency;
- p->platform = platform;
- p->system = system;
- return new Iob(p);
+ return new Iob(this);
}
-
-REGISTER_SIM_OBJECT("Iob", Iob)
diff --git a/src/dev/sparc/iob.hh b/src/dev/sparc/iob.hh
index c05c4f2ef..b2fd6cbf6 100644
--- a/src/dev/sparc/iob.hh
+++ b/src/dev/sparc/iob.hh
@@ -39,6 +39,7 @@
#include "base/range.hh"
#include "dev/io_device.hh"
#include "dev/disk_image.hh"
+#include "params/Iob.hh"
class IntrControl;
@@ -123,24 +124,22 @@ class Iob : public PioDevice
void readIob(PacketPtr pkt);
void readJBus(PacketPtr pkt);
-
public:
- struct Params : public PioDevice::Params
- {
- Tick pio_delay;
- };
- protected:
- const Params *params() const { return (const Params*)_params; }
+ typedef IobParams Params;
+ Iob(const Params *p);
- public:
- Iob(Params *p);
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
virtual Tick read(PacketPtr pkt);
virtual Tick write(PacketPtr pkt);
void generateIpi(Type type, int cpu_id, int vector);
void receiveDeviceInterrupt(DeviceId devid);
- bool receiveJBusInterrupt(int cpu_id, int source, uint64_t d0, uint64_t d1);
-
+ bool receiveJBusInterrupt(int cpu_id, int source, uint64_t d0,
+ uint64_t d1);
void addressRanges(AddrRangeList &range_list);
diff --git a/src/dev/sparc/mm_disk.cc b/src/dev/sparc/mm_disk.cc
index bbb773c48..f0d51eef4 100644
--- a/src/dev/sparc/mm_disk.cc
+++ b/src/dev/sparc/mm_disk.cc
@@ -40,11 +40,10 @@
#include "dev/platform.hh"
#include "mem/port.hh"
#include "mem/packet_access.hh"
-#include "sim/builder.hh"
#include "sim/byteswap.hh"
#include "sim/system.hh"
-MmDisk::MmDisk(Params *p)
+MmDisk::MmDisk(const Params *p)
: BasicPioDevice(p), image(p->image), curSector((off_t)-1), dirty(false)
{
std::memset(&diskData, 0, SectorSize);
@@ -171,39 +170,8 @@ MmDisk::serialize(std::ostream &os)
}
}
-
-
-
-BEGIN_DECLARE_SIM_OBJECT_PARAMS(MmDisk)
- Param<Addr> pio_addr;
- Param<Tick> pio_latency;
- Param<Addr> pio_size;
- SimObjectParam<Platform *> platform;
- SimObjectParam<System *> system;
- SimObjectParam<DiskImage *> image;
-END_DECLARE_SIM_OBJECT_PARAMS(MmDisk)
-
-BEGIN_INIT_SIM_OBJECT_PARAMS(MmDisk)
-
- INIT_PARAM(pio_addr, "Device Address"),
- INIT_PARAM(pio_latency, "Programmed IO latency"),
- INIT_PARAM(pio_size, "Size of address range"),
- INIT_PARAM(platform, "platform"),
- INIT_PARAM(system, "system object"),
- INIT_PARAM(image, "disk image")
-
-END_INIT_SIM_OBJECT_PARAMS(MmDisk)
-
-CREATE_SIM_OBJECT(MmDisk)
+MmDisk *
+MmDiskParams::create()
{
- MmDisk::Params *p = new MmDisk::Params;
- p->name = getInstanceName();
- p->pio_addr = pio_addr;
- p->pio_delay = pio_latency;
- p->platform = platform;
- p->system = system;
- p->image = image;
- return new MmDisk(p);
+ return new MmDisk(this);
}
-
-REGISTER_SIM_OBJECT("MmDisk", MmDisk)
diff --git a/src/dev/sparc/mm_disk.hh b/src/dev/sparc/mm_disk.hh
index 30028d2b6..41ec0cc59 100644
--- a/src/dev/sparc/mm_disk.hh
+++ b/src/dev/sparc/mm_disk.hh
@@ -39,6 +39,7 @@
#include "base/range.hh"
#include "dev/io_device.hh"
#include "dev/disk_image.hh"
+#include "params/MmDisk.hh"
class MmDisk : public BasicPioDevice
{
@@ -49,15 +50,14 @@ class MmDisk : public BasicPioDevice
uint8_t diskData[SectorSize];
public:
- struct Params : public BasicPioDevice::Params
- {
- DiskImage *image;
- };
- protected:
- const Params *params() const { return (const Params*)_params; }
+ typedef MmDiskParams Params;
+ MmDisk(const Params *p);
- public:
- MmDisk(Params *p);
+ const Params *
+ params() const
+ {
+ return dynamic_cast<const Params *>(_params);
+ }
virtual Tick read(PacketPtr pkt);
virtual Tick write(PacketPtr pkt);
diff --git a/src/dev/sparc/t1000.cc b/src/dev/sparc/t1000.cc
index 3a2f881f1..692e0cfe1 100644
--- a/src/dev/sparc/t1000.cc
+++ b/src/dev/sparc/t1000.cc
@@ -39,7 +39,7 @@
#include "cpu/intr_control.hh"
#include "dev/simconsole.hh"
#include "dev/sparc/t1000.hh"
-#include "sim/builder.hh"
+#include "params/T1000.hh"
#include "sim/system.hh"
using namespace std;
@@ -101,23 +101,8 @@ T1000::calcConfigAddr(int bus, int dev, int func)
M5_DUMMY_RETURN
}
-BEGIN_DECLARE_SIM_OBJECT_PARAMS(T1000)
-
- SimObjectParam<System *> system;
- SimObjectParam<IntrControl *> intrctrl;
-
-END_DECLARE_SIM_OBJECT_PARAMS(T1000)
-
-BEGIN_INIT_SIM_OBJECT_PARAMS(T1000)
-
- INIT_PARAM(system, "system"),
- INIT_PARAM(intrctrl, "interrupt controller")
-
-END_INIT_SIM_OBJECT_PARAMS(T1000)
-
-CREATE_SIM_OBJECT(T1000)
+T1000 *
+T1000Params::create()
{
- return new T1000(getInstanceName(), system, intrctrl);
+ return new T1000(name, system, intrctrl);
}
-
-REGISTER_SIM_OBJECT("T1000", T1000)