summaryrefslogtreecommitdiff
path: root/src/dev
diff options
context:
space:
mode:
Diffstat (limited to 'src/dev')
-rw-r--r--src/dev/alpha/tsunami_io.cc73
-rw-r--r--src/dev/alpha/tsunami_io.hh3
-rw-r--r--src/dev/baddev.cc2
-rw-r--r--src/dev/ide_atareg.h2
-rw-r--r--src/dev/io_device.hh2
-rw-r--r--src/dev/pciconfigall.cc2
-rw-r--r--src/dev/pcidev.hh6
-rw-r--r--src/dev/platform.cc1
-rw-r--r--src/dev/sparc/dtod.cc35
-rw-r--r--src/dev/sparc/dtod.hh19
-rw-r--r--src/dev/sparc/mm_disk.cc5
-rw-r--r--src/dev/sparc/t1000.cc15
-rw-r--r--src/dev/sparc/t1000.hh13
13 files changed, 84 insertions, 94 deletions
diff --git a/src/dev/alpha/tsunami_io.cc b/src/dev/alpha/tsunami_io.cc
index d701dc98f..58933428c 100644
--- a/src/dev/alpha/tsunami_io.cc
+++ b/src/dev/alpha/tsunami_io.cc
@@ -65,69 +65,32 @@ TsunamiIO::RTC::RTC(const string &n, Tsunami* tsunami, const vector<int> &t,
stat_regA = RTCA_32768HZ | RTCA_1024HZ;
stat_regB = RTCB_PRDC_IE |RTCB_BIN | RTCB_24HR;
- if (year_is_bcd) {
- // The RTC uses BCD for the last two digits in the year.
- // They python year is a full year.
- int _year = t[0] % 100;
- int tens = _year / 10;
- int ones = _year % 10;
-
- year = (tens << 4) + ones;
- } else {
- // Even though the datasheet says that the year field should be
- // interpreted as BCD, we just enter the number of years since
- // 1900 since linux seems to be happy with that (and I believe
- // that Tru64 was as well)
- year = t[0] - 1900;
- }
-
- mon = t[1];
- mday = t[2];
- hour = t[3];
- min = t[4];
- sec = t[5];
-
- // wday is defined to be in the range from 1 - 7 with 1 being Sunday.
- // the value coming from python is in the range from 0 - 6 with 0 being
- // Monday. Fix that here.
- wday = t[6] + 2;
- if (wday > 7)
- wday -= 7;
-
- DPRINTFN("Real-time clock set to %s", getDateString());
-}
-
-std::string
-TsunamiIO::RTC::getDateString()
-{
struct tm tm;
+ parseTime(t, &tm);
- memset(&tm, 0, sizeof(tm));
+ year = tm.tm_year;
if (year_is_bcd) {
- // undo the BCD and conver to years since 1900 guessing that
- // anything before 1970 is actually after 2000
- int _year = (year >> 4) * 10 + (year & 0xf);
- if (_year < 70)
- _year += 100;
-
- tm.tm_year = _year;
- } else {
- // number of years since 1900
- tm.tm_year = year;
+ // The datasheet says that the year field can be either BCD or
+ // years since 1900. Linux seems to be happy with years since
+ // 1900.
+ year = year % 100;
+ int tens = year / 10;
+ int ones = year % 10;
+ year = (tens << 4) + ones;
}
- // unix is 0-11 for month
- tm.tm_mon = mon - 1;
- tm.tm_mday = mday;
- tm.tm_hour = hour;
- tm.tm_min = min;
- tm.tm_sec = sec;
+ // Unix is 0-11 for month, data seet says start at 1
+ mon = tm.tm_mon + 1;
+ mday = tm.tm_mday;
+ hour = tm.tm_hour;
+ min = tm.tm_min;
+ sec = tm.tm_sec;
- // to add more annoyance unix is 0 - 6 with 0 as sunday
- tm.tm_wday = wday - 1;
+ // Datasheet says 1 is sunday
+ wday = tm.tm_wday + 1;
- return asctime(&tm);
+ DPRINTFN("Real-time clock set to %s", asctime(&tm));
}
void
diff --git a/src/dev/alpha/tsunami_io.hh b/src/dev/alpha/tsunami_io.hh
index f42af4197..f4fa62a68 100644
--- a/src/dev/alpha/tsunami_io.hh
+++ b/src/dev/alpha/tsunami_io.hh
@@ -125,9 +125,6 @@ class TsunamiIO : public BasicPioDevice
/** RTC read data */
uint8_t readData();
- /** RTC get the date */
- std::string getDateString();
-
/**
* Serialize this object to the given output stream.
* @param base The base name of the counter object.
diff --git a/src/dev/baddev.cc b/src/dev/baddev.cc
index 6a7060455..a2d2650cb 100644
--- a/src/dev/baddev.cc
+++ b/src/dev/baddev.cc
@@ -56,12 +56,14 @@ Tick
BadDevice::read(PacketPtr pkt)
{
panic("Device %s not imlpmented\n", devname);
+ M5_DUMMY_RETURN
}
Tick
BadDevice::write(PacketPtr pkt)
{
panic("Device %s not imlpmented\n", devname);
+ M5_DUMMY_RETURN
}
BEGIN_DECLARE_SIM_OBJECT_PARAMS(BadDevice)
diff --git a/src/dev/ide_atareg.h b/src/dev/ide_atareg.h
index df16d09d5..b9f1d9e0f 100644
--- a/src/dev/ide_atareg.h
+++ b/src/dev/ide_atareg.h
@@ -35,7 +35,7 @@
#if defined(linux)
#include <endian.h>
-#elif defined(__sun__)
+#elif defined(__sun)
#include <sys/isa_defs.h>
#else
#include <machine/endian.h>
diff --git a/src/dev/io_device.hh b/src/dev/io_device.hh
index aa242d170..c56eba267 100644
--- a/src/dev/io_device.hh
+++ b/src/dev/io_device.hh
@@ -109,7 +109,7 @@ class DmaPort : public Port
virtual bool recvTiming(PacketPtr pkt);
virtual Tick recvAtomic(PacketPtr pkt)
- { panic("dma port shouldn't be used for pio access."); }
+ { panic("dma port shouldn't be used for pio access."); M5_DUMMY_RETURN }
virtual void recvFunctional(PacketPtr pkt)
{ panic("dma port shouldn't be used for pio access."); }
diff --git a/src/dev/pciconfigall.cc b/src/dev/pciconfigall.cc
index 39c8f0fa0..bd1855847 100644
--- a/src/dev/pciconfigall.cc
+++ b/src/dev/pciconfigall.cc
@@ -83,8 +83,10 @@ PciConfigAll::write(PacketPtr pkt)
{
assert(pkt->result == Packet::Unknown);
panic("Attempting to write to config space on non-existant device\n");
+ M5_DUMMY_RETURN
}
+
void
PciConfigAll::addressRanges(AddrRangeList &range_list)
{
diff --git a/src/dev/pcidev.hh b/src/dev/pcidev.hh
index fbfdbb65c..56e3ffb4a 100644
--- a/src/dev/pcidev.hh
+++ b/src/dev/pcidev.hh
@@ -37,6 +37,8 @@
#ifndef __DEV_PCIDEV_HH__
#define __DEV_PCIDEV_HH__
+#include <cstring>
+
#include "dev/io_device.hh"
#include "dev/pcireg.h"
#include "dev/platform.hh"
@@ -62,8 +64,8 @@ class PciConfigData : public SimObject
PciConfigData(const std::string &name)
: SimObject(name)
{
- memset(config.data, 0, sizeof(config.data));
- memset(BARSize, 0, sizeof(BARSize));
+ std::memset(config.data, 0, sizeof(config.data));
+ std::memset(BARSize, 0, sizeof(BARSize));
}
/** The first 64 bytes */
diff --git a/src/dev/platform.cc b/src/dev/platform.cc
index 07288249c..b2b8695a7 100644
--- a/src/dev/platform.cc
+++ b/src/dev/platform.cc
@@ -62,6 +62,7 @@ Addr
Platform::pciToDma(Addr pciAddr) const
{
panic("No PCI dma support in platform.");
+ M5_DUMMY_RETURN
}
void
diff --git a/src/dev/sparc/dtod.cc b/src/dev/sparc/dtod.cc
index 30c7baaf5..42275c60a 100644
--- a/src/dev/sparc/dtod.cc
+++ b/src/dev/sparc/dtod.cc
@@ -49,12 +49,24 @@ using namespace std;
using namespace TheISA;
DumbTOD::DumbTOD(Params *p)
- : BasicPioDevice(p), todTime(p->init_time)
+ : BasicPioDevice(p)
{
+ struct tm tm;
+ char *tz;
+
pioSize = 0x08;
- struct tm tm;
- gmtime_r((time_t*)&todTime, &tm);
+ parseTime(p->init_time, &tm);
+ tz = getenv("TZ");
+ setenv("TZ", "", 1);
+ tzset();
+ todTime = mktime(&tm);
+ if (tz)
+ setenv("TZ", tz, 1);
+ else
+ unsetenv("TZ");
+ tzset();
+
DPRINTFN("Real-time clock set to %s\n", asctime(&tm));
DPRINTFN("Real-time clock set to %d\n", todTime);
}
@@ -80,13 +92,26 @@ DumbTOD::write(PacketPtr pkt)
panic("Dumb tod device doesn't support writes\n");
}
+void
+DumbTOD::serialize(std::ostream &os)
+{
+ SERIALIZE_SCALAR(todTime);
+}
+
+void
+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;
- Param<time_t> time;
+ VectorParam<int> time;
END_DECLARE_SIM_OBJECT_PARAMS(DumbTOD)
@@ -96,7 +121,7 @@ BEGIN_INIT_SIM_OBJECT_PARAMS(DumbTOD)
INIT_PARAM(pio_latency, "Programmed IO latency"),
INIT_PARAM(platform, "platform"),
INIT_PARAM(system, "system object"),
- INIT_PARAM(time, "System time to use (0 for actual time")
+ INIT_PARAM(time, "")
END_INIT_SIM_OBJECT_PARAMS(DumbTOD)
diff --git a/src/dev/sparc/dtod.hh b/src/dev/sparc/dtod.hh
index 7d3a9f628..ddf9fcc96 100644
--- a/src/dev/sparc/dtod.hh
+++ b/src/dev/sparc/dtod.hh
@@ -36,6 +36,8 @@
#ifndef __DEV_SPARC_DTOD_HH__
#define __DEV_SPARC_DTOD_HH__
+#include <vector>
+
#include "base/range.hh"
#include "dev/io_device.hh"
@@ -52,7 +54,7 @@ class DumbTOD : public BasicPioDevice
public:
struct Params : public BasicPioDevice::Params
{
- time_t init_time;
+ std::vector<int> init_time;
};
protected:
const Params *params() const { return (const Params *)_params; }
@@ -62,6 +64,21 @@ class DumbTOD : public BasicPioDevice
virtual Tick read(PacketPtr pkt);
virtual Tick write(PacketPtr pkt);
+
+ /**
+ * Serialize this object to the given output stream.
+ * @param os The stream to serialize to.
+ */
+ virtual void serialize(std::ostream &os);
+
+ /**
+ * Reconstruct the state of this object from a checkpoint.
+ * @param cp The checkpoint use.
+ * @param section The section name of this object
+ */
+ virtual void unserialize(Checkpoint *cp, const std::string &section);
+
+
};
#endif // __DEV_BADDEV_HH__
diff --git a/src/dev/sparc/mm_disk.cc b/src/dev/sparc/mm_disk.cc
index 9057c28be..018415f6c 100644
--- a/src/dev/sparc/mm_disk.cc
+++ b/src/dev/sparc/mm_disk.cc
@@ -33,6 +33,8 @@
* in legion. Any access is translated to an offset in the disk image.
*/
+#include <cstring>
+
#include "base/trace.hh"
#include "dev/sparc/mm_disk.hh"
#include "dev/platform.hh"
@@ -45,7 +47,7 @@
MmDisk::MmDisk(Params *p)
: BasicPioDevice(p), image(p->image), curSector((uint64_t)-1), dirty(false)
{
- memset(&bytes, 0, SectorSize);
+ std::memset(&bytes, 0, SectorSize);
pioSize = image->size() * SectorSize;
}
@@ -99,6 +101,7 @@ Tick
MmDisk::write(PacketPtr pkt)
{
panic("need to implement\n");
+ M5_DUMMY_RETURN
}
diff --git a/src/dev/sparc/t1000.cc b/src/dev/sparc/t1000.cc
index 4a8de77a5..3a2f881f1 100644
--- a/src/dev/sparc/t1000.cc
+++ b/src/dev/sparc/t1000.cc
@@ -57,6 +57,7 @@ Tick
T1000::intrFrequency()
{
panic("Need implementation\n");
+ M5_DUMMY_RETURN
}
void
@@ -89,6 +90,7 @@ Addr
T1000::pciToDma(Addr pciAddr) const
{
panic("Need implementation\n");
+ M5_DUMMY_RETURN
}
@@ -96,18 +98,7 @@ Addr
T1000::calcConfigAddr(int bus, int dev, int func)
{
panic("Need implementation\n");
-}
-
-void
-T1000::serialize(std::ostream &os)
-{
- panic("Need implementation\n");
-}
-
-void
-T1000::unserialize(Checkpoint *cp, const std::string &section)
-{
- panic("Need implementation\n");
+ M5_DUMMY_RETURN
}
BEGIN_DECLARE_SIM_OBJECT_PARAMS(T1000)
diff --git a/src/dev/sparc/t1000.hh b/src/dev/sparc/t1000.hh
index 2955763a9..8e28d90e5 100644
--- a/src/dev/sparc/t1000.hh
+++ b/src/dev/sparc/t1000.hh
@@ -90,19 +90,6 @@ class T1000 : public Platform
* Calculate the configuration address given a bus/dev/func.
*/
virtual Addr calcConfigAddr(int bus, int dev, int func);
-
- /**
- * Serialize this object to the given output stream.
- * @param os The stream to serialize to.
- */
- virtual void serialize(std::ostream &os);
-
- /**
- * Reconstruct the state of this object from a checkpoint.
- * @param cp The checkpoint use.
- * @param section The section name of this object
- */
- virtual void unserialize(Checkpoint *cp, const std::string &section);
};
#endif // __DEV_T1000_HH__