dev-arm: Use generateFdtProperty in the GenericTimer
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 28 Sep 2020 16:36:30 +0000 (17:36 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Sat, 17 Oct 2020 10:21:08 +0000 (10:21 +0000)
Change-Id: I4115d14ba65685627b51b0e5438fe5a3ed9328bc
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35397
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/dev/arm/GenericTimer.py
src/dev/arm/RealView.py

index ed81b24715b69cc42902a5ecf36289ec92c6f993..db93532028cb268cf122fd7b63ec1461ed4346e4 100644 (file)
@@ -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
index 4664a19dea02977d19a90661bdd80187a398a5f7..0d2251d8cd6853cfe296ace2197bd55364883677 100644 (file)
@@ -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,