dev-arm: Make AmbaInt/DmaDevice use the ArmInterruptPin
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 27 Jul 2020 16:42:25 +0000 (17:42 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 30 Jul 2020 15:44:23 +0000 (15:44 +0000)
Change-Id: I7318b9186cd81f948211e8a955dab7eea6d2a2f5
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31936
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/amba_device.cc
src/dev/arm/amba_device.hh
src/dev/arm/hdlcd.cc
src/dev/arm/kmi.cc
src/dev/arm/pl111.cc
src/dev/arm/rtc_pl031.cc
src/dev/arm/watchdog_sp805.cc

index b0e8a8e068fa939e89c2457ca88abee78702d66d..b3d73058f10aee1ce513ba001fb3f2f3b1c8b3b7 100644 (file)
@@ -85,8 +85,7 @@ class AmbaIntDevice(AmbaPioDevice):
     type = 'AmbaIntDevice'
     abstract = True
     cxx_header = "dev/arm/amba_device.hh"
-    gic = Param.BaseGic(Parent.any, "Gic to use for interrupting")
-    int_num = Param.UInt32("Interrupt number that connects to GIC")
+    interrupt = Param.ArmInterruptPin("Interrupt that connects to GIC")
     int_delay = Param.Latency("100ns",
             "Time between action and interrupt generation by device")
 
@@ -96,8 +95,7 @@ class AmbaDmaDevice(DmaDevice):
     cxx_header = "dev/arm/amba_device.hh"
     pio_addr = Param.Addr("Address for AMBA slave interface")
     pio_latency = Param.Latency("10ns", "Time between action and write/read result by AMBA DMA Device")
-    gic = Param.BaseGic(Parent.any, "Gic to use for interrupting")
-    int_num = Param.UInt32("Interrupt number that connects to GIC")
+    interrupt = Param.ArmInterruptPin("Interrupt that connects to GIC")
     amba_id = Param.UInt32("ID of AMBA device for kernel detection")
 
 class A9SCU(BasicPioDevice):
@@ -412,7 +410,7 @@ Reference:
 
     def generateDeviceTree(self, state):
         node = self.generateBasicPioDeviceNode(state, 'watchdog',
-            self.pio_addr, 0x1000, [int(self.int_num)])
+            self.pio_addr, 0x1000, [int(self.interrupt.num)])
         node.appendCompatible(['arm,sp805', 'arm,primecell'])
         clocks = [state.phandle(self.clk_domain.unproxy(self))]
         clock_names = ['wdogclk']
@@ -445,7 +443,7 @@ class PL031(AmbaIntDevice):
 
     def generateDeviceTree(self, state):
         node = self.generateBasicPioDeviceNode(state, 'rtc', self.pio_addr,
-                                               0x1000, [int(self.int_num)])
+            0x1000, [int(self.interrupt.num)])
 
         node.appendCompatible(["arm,pl031", "arm,primecell"])
         clock = state.phandle(self.clk_domain.unproxy(self))
@@ -463,7 +461,7 @@ class Pl050(AmbaIntDevice):
 
     def generateDeviceTree(self, state):
         node = self.generateBasicPioDeviceNode(state, 'kmi', self.pio_addr,
-                                               0x1000, [int(self.int_num)])
+            0x1000, [int(self.interrupt.num)])
 
         node.appendCompatible(["arm,pl050", "arm,primecell"])
         clock = state.phandle(self.clk_domain.unproxy(self))
@@ -679,7 +677,7 @@ class VExpress_EMM(RealView):
                                     pio_addr=0x2C080000)
 
     hdlcd  = HDLcd(pxl_clk=dcc.osc_pxl,
-                   pio_addr=0x2b000000, int_num=117,
+                   pio_addr=0x2b000000, interrupt=ArmSPI(num=117),
                    workaround_swap_rb=True)
 
     def _on_chip_devices(self):
@@ -712,9 +710,11 @@ class VExpress_EMM(RealView):
 
     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')
-    clcd   = Pl111(pio_addr=0x1c1f0000, int_num=46)
-    kmi0   = Pl050(pio_addr=0x1c060000, int_num=44, ps2=PS2Keyboard())
-    kmi1   = Pl050(pio_addr=0x1c070000, int_num=45, ps2=PS2TouchKit())
+    clcd   = Pl111(pio_addr=0x1c1f0000, interrupt=ArmSPI(num=46))
+    kmi0   = Pl050(pio_addr=0x1c060000, interrupt=ArmSPI(num=44),
+                   ps2=PS2Keyboard())
+    kmi1   = Pl050(pio_addr=0x1c070000, interrupt=ArmSPI(num=45),
+                   ps2=PS2TouchKit())
     cf_ctrl = IdeController(disks=[], pci_func=0, pci_dev=0, pci_bus=2,
                             io_shift = 2, ctrl_offset = 2, Command = 0x1,
                             BAR0 = 0x1C1A0000, BAR0Size = '256B',
@@ -725,7 +725,7 @@ class VExpress_EMM(RealView):
                                   conf_table_reported = False)
     vram           = SimpleMemory(range = AddrRange(0x18000000, size='32MB'),
                                   conf_table_reported = False)
-    rtc            = PL031(pio_addr=0x1C170000, int_num=36)
+    rtc            = PL031(pio_addr=0x1C170000, interrupt=ArmSPI(num=36))
 
     l2x0_fake      = IsaFake(pio_addr=0x2C100000, pio_size=0xfff)
     uart1_fake     = AmbaFake(pio_addr=0x1C0A0000)
@@ -971,7 +971,7 @@ Interrupts:
     ### On-chip devices ###
 
     # Trusted Watchdog, SP805
-    trusted_watchdog = Sp805(pio_addr=0x2a490000, int_num=56)
+    trusted_watchdog = Sp805(pio_addr=0x2a490000, interrupt=ArmSPI(num=56))
 
     sys_counter = SystemCounter()
     generic_timer = GenericTimer(int_phys_s=ArmPPI(num=29),
@@ -988,7 +988,7 @@ Interrupts:
                 int_phys=ArmSPI(num=58), int_virt=ArmSPI(num=134))
     ])
 
-    system_watchdog = Sp805(pio_addr=0x2b060000, int_num=130)
+    system_watchdog = Sp805(pio_addr=0x2b060000, interrupt=ArmSPI(num=130))
 
     def _on_chip_devices(self):
         return [
@@ -1021,12 +1021,14 @@ Interrupts:
             interrupt=ArmSPI(num=40), device=Terminal())
     ]
 
-    kmi0 = Pl050(pio_addr=0x1c060000, int_num=44, ps2=PS2Keyboard())
-    kmi1 = Pl050(pio_addr=0x1c070000, int_num=45, ps2=PS2TouchKit())
+    kmi0 = Pl050(pio_addr=0x1c060000, interrupt=ArmSPI(num=44),
+                 ps2=PS2Keyboard())
+    kmi1 = Pl050(pio_addr=0x1c070000, interrupt=ArmSPI(num=45),
+                 ps2=PS2TouchKit())
 
-    watchdog = Sp805(pio_addr=0x1c0f0000, int_num=32)
+    watchdog = Sp805(pio_addr=0x1c0f0000, interrupt=ArmSPI(num=32))
 
-    rtc = PL031(pio_addr=0x1c170000, int_num=36)
+    rtc = PL031(pio_addr=0x1C170000, interrupt=ArmSPI(num=36))
 
     ### gem5-specific off-chip devices ###
     pci_host = GenericArmPciHost(
@@ -1177,7 +1179,7 @@ class VExpress_GEM5_V1_Base(VExpress_GEM5_Base):
 
 class VExpress_GEM5_V1(VExpress_GEM5_V1_Base):
     hdlcd  = HDLcd(pxl_clk=VExpress_GEM5_V1_Base.dcc.osc_pxl,
-                   pio_addr=0x2b000000, int_num=95)
+                   pio_addr=0x2b000000, interrupt=ArmSPI(num=95))
 
     def _on_chip_devices(self):
         return super(VExpress_GEM5_V1,self)._on_chip_devices() + [
@@ -1205,7 +1207,7 @@ class VExpress_GEM5_V2_Base(VExpress_GEM5_Base):
 
 class VExpress_GEM5_V2(VExpress_GEM5_V2_Base):
     hdlcd  = HDLcd(pxl_clk=VExpress_GEM5_V2_Base.dcc.osc_pxl,
-                   pio_addr=0x2b000000, int_num=95)
+                   pio_addr=0x2b000000, interrupt=ArmSPI(num=95))
 
     def _on_chip_devices(self):
         return super(VExpress_GEM5_V2,self)._on_chip_devices() + [
index 31a21b7cc484427c3e55fd85a3875b78e363db3b..2ab2743366f59f1881218f738365e3af6796abd2 100644 (file)
@@ -55,7 +55,7 @@ AmbaPioDevice::AmbaPioDevice(const Params *p, Addr pio_size)
 
 AmbaIntDevice::AmbaIntDevice(const Params *p, Addr pio_size)
     : AmbaPioDevice(p, pio_size),
-      intNum(p->int_num), gic(p->gic), intDelay(p->int_delay)
+      interrupt(p->interrupt->get()), intDelay(p->int_delay)
 {
 }
 
@@ -64,7 +64,7 @@ AmbaIntDevice::AmbaIntDevice(const Params *p, Addr pio_size)
 AmbaDmaDevice::AmbaDmaDevice(const Params *p, Addr pio_size)
     : DmaDevice(p), ambaId(AmbaVendor | p->amba_id),
       pioAddr(p->pio_addr), pioSize(pio_size),
-      pioDelay(p->pio_latency),intNum(p->int_num), gic(p->gic)
+      pioDelay(p->pio_latency), interrupt(p->interrupt->get())
 {
 }
 
index fb6eff766bac6f0ea781f0fefa0ca549273e43f4..3d7e30c9182f7f9745a59727b663784255b2fa9b 100644 (file)
@@ -86,8 +86,7 @@ class AmbaPioDevice : public BasicPioDevice, public AmbaDevice
 class AmbaIntDevice : public AmbaPioDevice
 {
   protected:
-    int intNum;
-    BaseGic *gic;
+    ArmInterruptPin* const interrupt;
     Tick intDelay;
 
   public:
@@ -102,8 +101,7 @@ class AmbaDmaDevice : public DmaDevice, public AmbaDevice
     Addr     pioAddr;
     Addr     pioSize;
     Tick     pioDelay;
-    int      intNum;
-    BaseGic  *gic;
+    ArmInterruptPin* const interrupt;
 
   public:
     typedef AmbaDmaDeviceParams Params;
index 9b0d6da11fa99204a55c2d75748a12a24fe6786a..347844950e4a8a796bbfa3e9ada2008ab852725a 100644 (file)
@@ -592,9 +592,9 @@ HDLcd::setInterrupts(uint32_t ints, uint32_t mask)
     int_rawstat = ints;
 
     if (!old_ints && intStatus()) {
-        gic->sendInt(intNum);
+        interrupt->raise();
     } else if (old_ints && !intStatus()) {
-        gic->clearInt(intNum);
+        interrupt->clear();
     }
 }
 
index 732398ec7011976240d21e9cbba6b2d62bcc0cce..9d991c396dec87e12c1c3e4f31a17bffd51e2799 100644 (file)
@@ -183,11 +183,11 @@ Pl050::updateIntCtrl(InterruptReg ints, ControlReg ctrl)
     if (!old_pending && new_pending) {
         DPRINTF(Pl050, "Generate interrupt: rawInt=%#x ctrl=%#x int=%#x\n",
                 rawInterrupts, control, getInterrupt());
-        gic->sendInt(intNum);
+        interrupt->raise();
     } else if (old_pending && !new_pending) {
         DPRINTF(Pl050, "Clear interrupt: rawInt=%#x ctrl=%#x int=%#x\n",
                 rawInterrupts, control, getInterrupt());
-        gic->clearInt(intNum);
+        interrupt->clear();
     }
 }
 
index 36666691a17112f718ccc4bcf45467c89995cc58..f2b8e508fb1e5e5e5ff129848e4603a2581157c6 100644 (file)
@@ -303,7 +303,7 @@ Pl111::write(PacketPtr pkt)
         lcdMis = lcdImsc & lcdRis;
 
         if (!lcdMis)
-            gic->clearInt(intNum);
+            interrupt->clear();
 
          break;
       case LcdRis:
@@ -317,7 +317,7 @@ Pl111::write(PacketPtr pkt)
         lcdMis = lcdImsc & lcdRis;
 
         if (!lcdMis)
-            gic->clearInt(intNum);
+            interrupt->clear();
 
         break;
       case LcdUpCurr:
@@ -759,7 +759,7 @@ Pl111::generateInterrupt()
     lcdMis = lcdImsc & lcdRis;
 
     if (lcdMis.underflow || lcdMis.baseaddr || lcdMis.vcomp || lcdMis.ahbmaster) {
-        gic->sendInt(intNum);
+        interrupt->raise();
         DPRINTF(PL111, " -- Generated\n");
     }
 }
index e09ddbe8012183e49eb687dc46904c43ab7acb57..713d3f7f341dc7ac63c8d2be247042c4b5bb897a 100644 (file)
@@ -187,7 +187,7 @@ PL031::counterMatch()
     pendingInt = maskInt & rawInt;
     if (pendingInt && !old_pending) {
         DPRINTF(Timer, "-- Causing interrupt\n");
-        gic->sendInt(intNum);
+        interrupt->raise();
     }
 }
 
index 2a07d51c2cbb085694ec96a665f4b56291bd8a37..bed625866993d5d078757bee28b6f7ab728ef401 100644 (file)
@@ -215,7 +215,7 @@ Sp805::sendInt()
             warn("Watchdog timed out, system reset asserted\n");
     } else {
         intRaised = true;
-        gic->sendInt(intNum);
+        interrupt->raise();
     }
 }
 
@@ -223,7 +223,7 @@ void
 Sp805::clearInt()
 {
     intRaised = false;
-    gic->clearInt(intNum);
+    interrupt->clear();
 }
 
 void