From: Giacomo Travaglini Date: Mon, 27 Jul 2020 15:19:52 +0000 (+0100) Subject: dev-arm: Make Pl011 UART use the ArmInterruptPin X-Git-Tag: v20.1.0.0~368 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b722108e0bb644d42dcb6c463dcee14de091f112;p=gem5.git dev-arm: Make Pl011 UART use the ArmInterruptPin Change-Id: I995a424491f087b70b72d2558d96c7a472d4abaa Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/31935 Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg Tested-by: kokoro --- diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py index a22ac4a9a..b0e8a8e06 100644 --- a/src/dev/arm/RealView.py +++ b/src/dev/arm/RealView.py @@ -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()) diff --git a/src/dev/arm/pl011.cc b/src/dev/arm/pl011.cc index f24cb613b..11485b56f 100755 --- a/src/dev/arm/pl011.cc +++ b/src/dev/arm/pl011.cc @@ -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(); } } diff --git a/src/dev/arm/pl011.hh b/src/dev/arm/pl011.hh index 81181b7b2..0ecbe1300 100755 --- a/src/dev/arm/pl011.hh +++ b/src/dev/arm/pl011.hh @@ -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;