From e46aa5c6eb7cfa86ed6a7e85f8441e8bbb058270 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Mon, 27 Jul 2020 17:55:27 +0100 Subject: [PATCH] dev-arm: Make Sp804 use the ArmInterruptPin Change-Id: I2d71c7e874ba1ec798e2314d7d282cb853b3f360 Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31938 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg Tested-by: kokoro --- src/dev/arm/RealView.py | 11 ++++++----- src/dev/arm/timer_sp804.cc | 16 +++++++++------- src/dev/arm/timer_sp804.hh | 10 ++++------ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py index b3d73058f..b206a3ff2 100644 --- a/src/dev/arm/RealView.py +++ b/src/dev/arm/RealView.py @@ -388,10 +388,9 @@ class Pl011(Uart): class Sp804(AmbaPioDevice): type = 'Sp804' cxx_header = "dev/arm/timer_sp804.hh" - gic = Param.BaseGic(Parent.any, "Gic to use for interrupting") - int_num0 = Param.UInt32("Interrupt number that connects to GIC") + int0 = Param.ArmSPI("Interrupt that connects to GIC") clock0 = Param.Clock('1MHz', "Clock speed of the input") - int_num1 = Param.UInt32("Interrupt number that connects to GIC") + int1 = Param.ArmSPI("Interrupt that connects to GIC") clock1 = Param.Clock('1MHz', "Clock speed of the input") amba_id = 0x00141804 @@ -708,8 +707,10 @@ class VExpress_EMM(RealView): int_virt=ArmPPI(num=27), int_hyp=ArmPPI(num=26)) - timer0 = Sp804(int_num0=34, int_num1=34, pio_addr=0x1C110000, clock0='1MHz', clock1='1MHz') - timer1 = Sp804(int_num0=35, int_num1=35, pio_addr=0x1C120000, clock0='1MHz', clock1='1MHz') + timer0 = Sp804(int0=ArmSPI(num=34), int1=ArmSPI(num=34), + pio_addr=0x1C110000, clock0='1MHz', clock1='1MHz') + timer1 = Sp804(int0=ArmSPI(num=35), int1=ArmSPI(num=35), + pio_addr=0x1C120000, clock0='1MHz', clock1='1MHz') clcd = Pl111(pio_addr=0x1c1f0000, interrupt=ArmSPI(num=46)) kmi0 = Pl050(pio_addr=0x1c060000, interrupt=ArmSPI(num=44), ps2=PS2Keyboard()) diff --git a/src/dev/arm/timer_sp804.cc b/src/dev/arm/timer_sp804.cc index bf47e6db3..dbfa7ff60 100644 --- a/src/dev/arm/timer_sp804.cc +++ b/src/dev/arm/timer_sp804.cc @@ -46,14 +46,16 @@ #include "mem/packet_access.hh" Sp804::Sp804(Params *p) - : AmbaPioDevice(p, 0x1000), gic(p->gic), - timer0(name() + ".timer0", this, p->int_num0, p->clock0), - timer1(name() + ".timer1", this, p->int_num1, p->clock1) + : AmbaPioDevice(p, 0x1000), + timer0(name() + ".timer0", this, p->int0->get(), p->clock0), + timer1(name() + ".timer1", this, p->int1->get(), p->clock1) { } -Sp804::Timer::Timer(std::string __name, Sp804 *_parent, int int_num, Tick _clock) - : _name(__name), parent(_parent), intNum(int_num), clock(_clock), control(0x20), +Sp804::Timer::Timer(std::string __name, Sp804 *_parent, + ArmInterruptPin *_interrupt, Tick _clock) + : _name(__name), parent(_parent), interrupt(_interrupt), + clock(_clock), control(0x20), rawInt(false), pendingInt(false), loadValue(0xffffffff), zeroEvent([this]{ counterAtZero(); }, name()) { @@ -158,7 +160,7 @@ Sp804::Timer::write(PacketPtr pkt, Addr daddr) if (pendingInt) { pendingInt = false; DPRINTF(Timer, "Clearing interrupt\n"); - parent->gic->clearInt(intNum); + interrupt->clear(); } break; case BGLoad: @@ -205,7 +207,7 @@ Sp804::Timer::counterAtZero() pendingInt = true; if (pendingInt && !old_pending) { DPRINTF(Timer, "-- Causing interrupt\n"); - parent->gic->sendInt(intNum); + interrupt->raise(); } if (control.oneShot) diff --git a/src/dev/arm/timer_sp804.hh b/src/dev/arm/timer_sp804.hh index ef586fc92..1054b6a73 100644 --- a/src/dev/arm/timer_sp804.hh +++ b/src/dev/arm/timer_sp804.hh @@ -80,8 +80,8 @@ class Sp804 : public AmbaPioDevice /** Pointer to parent class */ Sp804 *parent; - /** Number of interrupt to cause/clear */ - const uint32_t intNum; + /** Pointer to the interrupt pin */ + ArmInterruptPin * const interrupt; /** Number of ticks in a clock input */ const Tick clock; @@ -109,7 +109,8 @@ class Sp804 : public AmbaPioDevice * @param val the value to start at (pre-16 bit masking if en) */ void restartCounter(uint32_t val); - Timer(std::string __name, Sp804 *parent, int int_num, Tick clock); + Timer(std::string __name, Sp804 *parent, ArmInterruptPin *_interrupt, + Tick clock); std::string name() const { return _name; } @@ -123,9 +124,6 @@ class Sp804 : public AmbaPioDevice void unserialize(CheckpointIn &cp) override; }; - /** Pointer to the GIC for causing an interrupt */ - BaseGic *gic; - /** Timers that do the actual work */ Timer timer0; Timer timer1; -- 2.30.2