From aee7bb1769acf70d1e4c4e517aa116645ae13a95 Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Mon, 28 Sep 2020 17:36:30 +0100 Subject: [PATCH] dev-arm: Use generateFdtProperty in the GenericTimer Change-Id: I4115d14ba65685627b51b0e5438fe5a3ed9328bc Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35397 Tested-by: kokoro Reviewed-by: Andreas Sandberg Maintainer: Andreas Sandberg --- src/dev/arm/GenericTimer.py | 25 +++++++++++++++---------- src/dev/arm/RealView.py | 18 ++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/dev/arm/GenericTimer.py b/src/dev/arm/GenericTimer.py index ed81b2471..db9353202 100644 --- a/src/dev/arm/GenericTimer.py +++ b/src/dev/arm/GenericTimer.py @@ -104,12 +104,13 @@ Reference: node.appendCompatible(["arm,cortex-a15-timer", "arm,armv7-timer", "arm,armv8-timer"]) - node.append(FdtPropertyWords("interrupts", [ - 1, int(self.int_phys_s.num) - 16, 0xf08, - 1, int(self.int_phys_ns.num) - 16, 0xf08, - 1, int(self.int_virt.num) - 16, 0xf08, - 1, int(self.int_hyp.num) - 16, 0xf08, - ])) + + gic = self._parent.unproxy(self).gic + node.append(FdtPropertyWords("interrupts", + self.int_phys_s.generateFdtProperty(gic) + + self.int_phys_ns.generateFdtProperty(gic) + + self.int_virt.generateFdtProperty(gic) + + self.int_hyp.generateFdtProperty(gic))) if self._freq_in_dtb: node.append(self.counter.unproxy(self).generateDtb()) @@ -139,13 +140,15 @@ Reference: int_phys = Param.ArmSPI("Physical Interrupt") int_virt = Param.ArmSPI("Virtual Interrupt") - def generateDeviceTree(self, state): + def generateDeviceTree(self, state, gic): node = FdtNode("frame@{:08x}".format(self.cnt_base.value)) node.append(FdtPropertyWords("frame-number", self._frame_num)) - ints = [0, int(self.int_phys.num) - 32, 4] + + ints = self.int_phys.generateFdtProperty(gic) if self.int_virt != NULL: - ints.extend([0, int(self.int_virt.num) - 32, 4]) + ints.extend(self.int_virt.generateFdtProperty(gic)) node.append(FdtPropertyWords("interrupts", ints)) + reg = state.addrCells(self.cnt_base) + state.sizeCells(0x1000) if self.cnt_el0_base.value != MaxAddr: reg.extend(state.addrCells(self.cnt_el0_base) @@ -193,8 +196,10 @@ Reference: if self._freq_in_dtb: node.append(self.counter.unproxy(self).generateDtb()) + gic = self._parent.unproxy(self).gic + for i, frame in enumerate(self.frames): frame._frame_num = i - node.append(frame.generateDeviceTree(state)) + node.append(frame.generateDeviceTree(state, gic)) yield node diff --git a/src/dev/arm/RealView.py b/src/dev/arm/RealView.py index 4664a19de..0d2251d8c 100644 --- a/src/dev/arm/RealView.py +++ b/src/dev/arm/RealView.py @@ -703,10 +703,11 @@ class VExpress_EMM(RealView): pci_pio_base=0) sys_counter = SystemCounter() - generic_timer = GenericTimer(int_phys_s=ArmPPI(num=29), - int_phys_ns=ArmPPI(num=30), - int_virt=ArmPPI(num=27), - int_hyp=ArmPPI(num=26)) + generic_timer = GenericTimer( + int_phys_s=ArmPPI(num=29, int_type='IRQ_TYPE_LEVEL_LOW'), + int_phys_ns=ArmPPI(num=30, int_type='IRQ_TYPE_LEVEL_LOW'), + int_virt=ArmPPI(num=27, int_type='IRQ_TYPE_LEVEL_LOW'), + int_hyp=ArmPPI(num=26, int_type='IRQ_TYPE_LEVEL_LOW')) timer0 = Sp804(int0=ArmSPI(num=34), int1=ArmSPI(num=34), pio_addr=0x1C110000, clock0='1MHz', clock1='1MHz') @@ -975,10 +976,11 @@ Interrupts: trusted_watchdog = Sp805(pio_addr=0x2a490000, interrupt=ArmSPI(num=56)) sys_counter = SystemCounter() - generic_timer = GenericTimer(int_phys_s=ArmPPI(num=29), - int_phys_ns=ArmPPI(num=30), - int_virt=ArmPPI(num=27), - int_hyp=ArmPPI(num=26)) + generic_timer = GenericTimer( + int_phys_s=ArmPPI(num=29, int_type='IRQ_TYPE_LEVEL_LOW'), + int_phys_ns=ArmPPI(num=30, int_type='IRQ_TYPE_LEVEL_LOW'), + int_virt=ArmPPI(num=27, int_type='IRQ_TYPE_LEVEL_LOW'), + int_hyp=ArmPPI(num=26, int_type='IRQ_TYPE_LEVEL_LOW')) generic_timer_mem = GenericTimerMem(cnt_control_base=0x2a430000, cnt_read_base=0x2a800000, cnt_ctl_base=0x2a810000, -- 2.30.2