summaryrefslogtreecommitdiff
path: root/src/dev/arm/generic_timer.cc
diff options
context:
space:
mode:
authorGiacomo Travaglini <giacomo.travaglini@arm.com>2018-08-30 17:48:48 +0100
committerGiacomo Travaglini <giacomo.travaglini@arm.com>2018-09-10 10:24:10 +0000
commitbbedc395612a97429ce0e5d0d86c92c6b7557aad (patch)
tree5384f187ded29222ee4edc2ce3f1d095d69734d8 /src/dev/arm/generic_timer.cc
parent579443c64fd176ec2af4c7f38b3d37484ad21ffa (diff)
downloadgem5-bbedc395612a97429ce0e5d0d86c92c6b7557aad.tar.xz
dev-arm: Make GenericTimer use standard ArmInterruptPin
This patch is deleting the custom ArchTimer::Interrupt implementation in favour of the standard ArmInterruptPin. Change-Id: I5aa5661e48834398bd7aae15df9578b8db5c8da3 Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/12402 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/dev/arm/generic_timer.cc')
-rw-r--r--src/dev/arm/generic_timer.cc52
1 files changed, 19 insertions, 33 deletions
diff --git a/src/dev/arm/generic_timer.cc b/src/dev/arm/generic_timer.cc
index 260461e33..92c39c2ae 100644
--- a/src/dev/arm/generic_timer.cc
+++ b/src/dev/arm/generic_timer.cc
@@ -94,7 +94,7 @@ SystemCounter::unserialize(CheckpointIn &cp)
ArchTimer::ArchTimer(const std::string &name,
SimObject &parent,
SystemCounter &sysctr,
- const Interrupt &interrupt)
+ ArmInterruptPin *interrupt)
: _name(name), _parent(parent), _systemCounter(sysctr),
_interrupt(interrupt),
_control(0), _counterLimit(0), _offset(0),
@@ -114,7 +114,7 @@ ArchTimer::counterLimitReached()
if (!_control.imask) {
if (scheduleEvents()) {
DPRINTF(Timer, "Causing interrupt\n");
- _interrupt.send();
+ _interrupt->raise();
} else {
DPRINTF(Timer, "Kvm mode; skipping simulated interrupt\n");
}
@@ -219,41 +219,20 @@ ArchTimer::drainResume()
updateCounter();
}
-void
-ArchTimer::Interrupt::send()
-{
- if (_ppi) {
- _gic.sendPPInt(_irq, _cpu);
- } else {
- _gic.sendInt(_irq);
- }
-}
-
-
-void
-ArchTimer::Interrupt::clear()
-{
- if (_ppi) {
- _gic.clearPPInt(_irq, _cpu);
- } else {
- _gic.clearInt(_irq);
- }
-}
-
-
GenericTimer::GenericTimer(GenericTimerParams *p)
: ClockedObject(p),
- system(*p->system),
- gic(p->gic),
- irqPhysS(p->int_phys_s),
- irqPhysNS(p->int_phys_ns),
- irqVirt(p->int_virt),
- irqHyp(p->int_hyp)
+ system(*p->system)
{
fatal_if(!p->system, "No system specified, can't instantiate timer.\n");
system.setGenericTimer(this);
}
+const GenericTimerParams *
+GenericTimer::params() const
+{
+ return dynamic_cast<const GenericTimerParams *>(_params);
+}
+
void
GenericTimer::serialize(CheckpointOut &cp) const
{
@@ -314,13 +293,20 @@ void
GenericTimer::createTimers(unsigned cpus)
{
assert(timers.size() < cpus);
+ auto p = static_cast<const GenericTimerParams *>(_params);
const unsigned old_cpu_count(timers.size());
timers.resize(cpus);
for (unsigned i = old_cpu_count; i < cpus; ++i) {
+
+ ThreadContext *tc = system.getThreadContext(i);
+
timers[i].reset(
new CoreTimers(*this, system, i,
- irqPhysS, irqPhysNS, irqVirt, irqHyp));
+ p->int_phys_s->get(tc),
+ p->int_phys_ns->get(tc),
+ p->int_virt->get(tc),
+ p->int_hyp->get(tc)));
}
}
@@ -544,10 +530,10 @@ GenericTimerMem::GenericTimerMem(GenericTimerMemParams *p)
systemCounter(),
physTimer(csprintf("%s.phys_timer0", name()),
*this, systemCounter,
- ArchTimer::Interrupt(*p->gic, p->int_phys)),
+ p->int_phys->get()),
virtTimer(csprintf("%s.virt_timer0", name()),
*this, systemCounter,
- ArchTimer::Interrupt(*p->gic, p->int_virt))
+ p->int_virt->get())
{
}