dev-arm: Make Sp804 use the ArmInterruptPin
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 27 Jul 2020 16:55:27 +0000 (17:55 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 30 Jul 2020 16:06:34 +0000 (16:06 +0000)
Change-Id: I2d71c7e874ba1ec798e2314d7d282cb853b3f360
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31938
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/dev/arm/RealView.py
src/dev/arm/timer_sp804.cc
src/dev/arm/timer_sp804.hh

index b3d73058f10aee1ce513ba001fb3f2f3b1c8b3b7..b206a3ff26dab42b68090994861f21968b1056df 100644 (file)
@@ -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())
index bf47e6db3f4062ae0e8797062e905cadec8c6e1e..dbfa7ff60da541915fddca91a685fdcf91cdbf3a 100644 (file)
 #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)
index ef586fc92bb50d8f202e75b6a1b0fc4ec0769a4f..1054b6a73d00074d4cb7628b07dc931329edfbe6 100644 (file)
@@ -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;