dev-arm: Make Pl011 UART use the ArmInterruptPin
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 27 Jul 2020 15:19:52 +0000 (16:19 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 30 Jul 2020 15:44:23 +0000 (15:44 +0000)
Change-Id: I995a424491f087b70b72d2558d96c7a472d4abaa
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31935
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/pl011.cc
src/dev/arm/pl011.hh

index a22ac4a9a4bb6cd5757300d537e9ee9e8b9d3e5e..b0e8a8e068fa939e89c2457ca88abee78702d66d 100644 (file)
@@ -369,14 +369,13 @@ class FixedClock(SrcClockDomain):
 class Pl011(Uart):
     type = 'Pl011'
     cxx_header = "dev/arm/pl011.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")
     end_on_eot = Param.Bool(False, "End the simulation when a EOT is received on the UART")
     int_delay = Param.Latency("100ns", "Time between action and interrupt generation by UART")
 
     def generateDeviceTree(self, state):
         node = self.generateBasicPioDeviceNode(state, 'uart', self.pio_addr,
-                                               0x1000, [int(self.int_num)])
+            0x1000, [int(self.interrupt.num)])
         node.appendCompatible(["arm,pl011", "arm,primecell"])
 
         # Hardcoded reference to the realview platform clocks, because the
@@ -700,7 +699,7 @@ class VExpress_EMM(RealView):
         return memories
 
     ### Off-chip devices ###
-    uart = Pl011(pio_addr=0x1c090000, int_num=37)
+    uart = Pl011(pio_addr=0x1c090000, interrupt=ArmSPI(num=37))
     pci_host = GenericPciHost(
         conf_base=0x30000000, conf_size='256MB', conf_device_bits=16,
         pci_pio_base=0)
@@ -1012,10 +1011,14 @@ Interrupts:
     clock24MHz = SrcClockDomain(clock="24MHz")
 
     uart = [
-        Pl011(pio_addr=0x1c090000, int_num=37),
-        Pl011(pio_addr=0x1c0a0000, int_num=38, device=Terminal()),
-        Pl011(pio_addr=0x1c0b0000, int_num=39, device=Terminal()),
-        Pl011(pio_addr=0x1c0c0000, int_num=40, device=Terminal())
+        Pl011(pio_addr=0x1c090000,
+            interrupt=ArmSPI(num=37)),
+        Pl011(pio_addr=0x1c0a0000,
+            interrupt=ArmSPI(num=38), device=Terminal()),
+        Pl011(pio_addr=0x1c0b0000,
+            interrupt=ArmSPI(num=39), device=Terminal()),
+        Pl011(pio_addr=0x1c0c0000,
+            interrupt=ArmSPI(num=40), device=Terminal())
     ]
 
     kmi0 = Pl050(pio_addr=0x1c060000, int_num=44, ps2=PS2Keyboard())
index f24cb613b719f2fa24b27e450ae6bdb4b035e3f3..11485b56ff049900abdedd825c1dc26efe60690d 100755 (executable)
@@ -55,7 +55,7 @@ Pl011::Pl011(const Pl011Params *p)
       intEvent([this]{ generateInterrupt(); }, name()),
       control(0x300), fbrd(0), ibrd(0), lcrh(0), ifls(0x12),
       imsc(0), rawInt(0),
-      gic(p->gic), endOnEOT(p->end_on_eot), intNum(p->int_num),
+      endOnEOT(p->end_on_eot), interrupt(p->interrupt->get()),
       intDelay(p->int_delay)
 {
 }
@@ -272,7 +272,7 @@ Pl011::generateInterrupt()
             imsc, rawInt, maskInt());
 
     if (maskInt()) {
-        gic->sendInt(intNum);
+        interrupt->raise();
         DPRINTF(Uart, " -- Generated\n");
     }
 }
@@ -289,7 +289,7 @@ Pl011::setInterrupts(uint16_t ints, uint16_t mask)
         if (!intEvent.scheduled())
             schedule(intEvent, curTick() + intDelay);
     } else if (old_ints && !maskInt()) {
-        gic->clearInt(intNum);
+        interrupt->clear();
     }
 }
 
index 81181b7b2cb9dc29ee100d527396887aa841239c..0ecbe1300d1c0d21647df4a4c0d93c0e5e494b06 100755 (executable)
@@ -171,14 +171,10 @@ class Pl011 : public Uart, public AmbaDevice
     uint16_t rawInt;
 
   protected: // Configuration
-    /** Gic to use for interrupting */
-    BaseGic * const gic;
-
     /** Should the simulation end on an EOT */
     const bool endOnEOT;
 
-    /** Interrupt number to generate */
-    const int intNum;
+    ArmInterruptPin* const interrupt;
 
     /** Delay before interrupting */
     const Tick intDelay;