diff options
author | Cagdas Dirik <cdirik@micron.com> | 2015-01-03 17:51:48 -0600 |
---|---|---|
committer | Cagdas Dirik <cdirik@micron.com> | 2015-01-03 17:51:48 -0600 |
commit | 02c376ac44584484268bd714a45fa0f0265a896a (patch) | |
tree | 8bcd4be1ea858883cf68cc40e1142aaca1b8e6e3 /src/dev | |
parent | 1ee70e9d84b769b736348e1f7709bc8ede344ec2 (diff) | |
download | gem5-02c376ac44584484268bd714a45fa0f0265a896a.tar.xz |
dev: prevent RTC events firing before startup
This change includes edits to MC146818 timer to prevent RTC events
firing before startup to comply with SimObject initialization call sequence.
Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/dev')
-rw-r--r-- | src/dev/alpha/tsunami_io.cc | 6 | ||||
-rw-r--r-- | src/dev/alpha/tsunami_io.hh | 5 | ||||
-rw-r--r-- | src/dev/arm/rtc_pl031.cc | 1 | ||||
-rw-r--r-- | src/dev/mc146818.cc | 16 | ||||
-rw-r--r-- | src/dev/mc146818.hh | 12 | ||||
-rwxr-xr-x | src/dev/mips/malta_io.cc | 6 | ||||
-rwxr-xr-x | src/dev/mips/malta_io.hh | 5 | ||||
-rw-r--r-- | src/dev/x86/cmos.cc | 6 | ||||
-rw-r--r-- | src/dev/x86/cmos.hh | 1 |
9 files changed, 49 insertions, 9 deletions
diff --git a/src/dev/alpha/tsunami_io.cc b/src/dev/alpha/tsunami_io.cc index 2c503880f..a20cd8a88 100644 --- a/src/dev/alpha/tsunami_io.cc +++ b/src/dev/alpha/tsunami_io.cc @@ -284,6 +284,12 @@ TsunamiIO::unserialize(Checkpoint *cp, const string §ion) rtc.unserialize("rtc", cp, section); } +void +TsunamiIO::startup() +{ + rtc.startup(); +} + TsunamiIO * TsunamiIOParams::create() { diff --git a/src/dev/alpha/tsunami_io.hh b/src/dev/alpha/tsunami_io.hh index 684295551..f242c9e2a 100644 --- a/src/dev/alpha/tsunami_io.hh +++ b/src/dev/alpha/tsunami_io.hh @@ -151,6 +151,11 @@ class TsunamiIO : public BasicPioDevice */ virtual void unserialize(Checkpoint *cp, const std::string §ion); + /** + * Start running. + */ + virtual void startup(); + }; #endif // __DEV_TSUNAMI_IO_HH__ diff --git a/src/dev/arm/rtc_pl031.cc b/src/dev/arm/rtc_pl031.cc index a43ac6271..e619045c2 100644 --- a/src/dev/arm/rtc_pl031.cc +++ b/src/dev/arm/rtc_pl031.cc @@ -44,7 +44,6 @@ #include "debug/Timer.hh" #include "dev/arm/amba_device.hh" #include "dev/arm/rtc_pl031.hh" -#include "dev/mc146818.hh" #include "mem/packet.hh" #include "mem/packet_access.hh" diff --git a/src/dev/mc146818.cc b/src/dev/mc146818.cc index 81366b774..fa8350760 100644 --- a/src/dev/mc146818.cc +++ b/src/dev/mc146818.cc @@ -123,6 +123,15 @@ MC146818::rega_dv_disabled(const RtcRegA ®) } void +MC146818::startup() +{ + assert(!event.scheduled()); + assert(!tickEvent.scheduled()); + schedule(event, curTick() + event.offset); + schedule(tickEvent, curTick() + tickEvent.offset); +} + +void MC146818::writeData(const uint8_t addr, const uint8_t data) { bool panic_unsupported(false); @@ -291,17 +300,16 @@ MC146818::unserialize(const string &base, Checkpoint *cp, // Tick rtcTimerInterruptTickOffset; UNSERIALIZE_SCALAR(rtcTimerInterruptTickOffset); - reschedule(event, curTick() + rtcTimerInterruptTickOffset); + event.offset = rtcTimerInterruptTickOffset; Tick rtcClockTickOffset; UNSERIALIZE_SCALAR(rtcClockTickOffset); - reschedule(tickEvent, curTick() + rtcClockTickOffset); + tickEvent.offset = rtcClockTickOffset; } MC146818::RTCEvent::RTCEvent(MC146818 * _parent, Tick i) - : parent(_parent), interval(i) + : parent(_parent), interval(i), offset(i) { DPRINTF(MC146818, "RTC Event Initilizing\n"); - parent->schedule(this, curTick() + interval); } void diff --git a/src/dev/mc146818.hh b/src/dev/mc146818.hh index 76cd40c37..936f597d0 100644 --- a/src/dev/mc146818.hh +++ b/src/dev/mc146818.hh @@ -51,6 +51,7 @@ class MC146818 : public EventManager { MC146818 * parent; Tick interval; + Tick offset; RTCEvent(MC146818 * _parent, Tick i); @@ -68,11 +69,11 @@ class MC146818 : public EventManager struct RTCTickEvent : public Event { MC146818 * parent; + Tick offset; - RTCTickEvent(MC146818 * _parent) : parent(_parent) - { - parent->schedule(this, curTick() + SimClock::Int::s); - } + RTCTickEvent(MC146818 * _parent) : + parent(_parent), offset(SimClock::Int::s) + {} /** Event process to occur at interrupt*/ void process(); @@ -153,6 +154,9 @@ class MC146818 : public EventManager bool bcd, Tick frequency); virtual ~MC146818(); + /** Start ticking */ + virtual void startup(); + /** RTC write data */ void writeData(const uint8_t addr, const uint8_t data); diff --git a/src/dev/mips/malta_io.cc b/src/dev/mips/malta_io.cc index d769b1112..6797a054c 100755 --- a/src/dev/mips/malta_io.cc +++ b/src/dev/mips/malta_io.cc @@ -142,6 +142,12 @@ MaltaIO::unserialize(Checkpoint *cp, const string §ion) rtc.unserialize("rtc", cp, section); } +void +MaltaIO::startup() +{ + rtc.startup(); +} + MaltaIO * MaltaIOParams::create() { diff --git a/src/dev/mips/malta_io.hh b/src/dev/mips/malta_io.hh index f74d42da4..dd035aea2 100755 --- a/src/dev/mips/malta_io.hh +++ b/src/dev/mips/malta_io.hh @@ -143,6 +143,11 @@ class MaltaIO : public BasicPioDevice */ virtual void unserialize(Checkpoint *cp, const std::string §ion); + /** + * Start running. + */ + virtual void startup(); + }; #endif // __DEV_MALTA_IO_HH__ diff --git a/src/dev/x86/cmos.cc b/src/dev/x86/cmos.cc index d7107deb7..6a778b758 100644 --- a/src/dev/x86/cmos.cc +++ b/src/dev/x86/cmos.cc @@ -113,6 +113,12 @@ X86ISA::Cmos::writeRegister(uint8_t reg, uint8_t val) } void +X86ISA::Cmos::startup() +{ + rtc.startup(); +} + +void X86ISA::Cmos::serialize(std::ostream &os) { SERIALIZE_SCALAR(address); diff --git a/src/dev/x86/cmos.hh b/src/dev/x86/cmos.hh index 7957e5304..fa5865c0a 100644 --- a/src/dev/x86/cmos.hh +++ b/src/dev/x86/cmos.hh @@ -82,6 +82,7 @@ class Cmos : public BasicPioDevice Tick write(PacketPtr pkt); + virtual void startup(); virtual void serialize(std::ostream &os); virtual void unserialize(Checkpoint *cp, const std::string §ion); |