Giacomo Travaglini has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/31938 )

Change subject: dev-arm: Make Sp804 use the ArmInterruptPin
......................................................................

dev-arm: Make Sp804 use the ArmInterruptPin

Change-Id: I2d71c7e874ba1ec798e2314d7d282cb853b3f360
Signed-off-by: Giacomo Travaglini <giacomo.travagl...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31938
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
Maintainer: Andreas Sandberg <andreas.sandb...@arm.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/dev/arm/RealView.py
M src/dev/arm/timer_sp804.cc
M src/dev/arm/timer_sp804.hh
3 files changed, 19 insertions(+), 18 deletions(-)

Approvals:
  Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py
index b3d7305..b206a3f 100644
--- a/src/dev/arm/RealView.py
+++ b/src/dev/arm/RealView.py
@@ -388,10 +388,9 @@
 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 @@
                                  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 bf47e6d..dbfa7ff 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 @@
         if (pendingInt) {
             pendingInt = false;
             DPRINTF(Timer, "Clearing interrupt\n");
-            parent->gic->clearInt(intNum);
+            interrupt->clear();
         }
         break;
       case BGLoad:
@@ -205,7 +207,7 @@
         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 ef586fc..1054b6a 100644
--- a/src/dev/arm/timer_sp804.hh
+++ b/src/dev/arm/timer_sp804.hh
@@ -80,8 +80,8 @@
         /** 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 @@
          * @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 @@
         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;

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/31938
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I2d71c7e874ba1ec798e2314d7d282cb853b3f360
Gerrit-Change-Number: 31938
Gerrit-PatchSet: 3
Gerrit-Owner: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to