dev-arm: Automate FdtProperty generation with ArmInterruptPin
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 28 Sep 2020 16:33:57 +0000 (17:33 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Sat, 17 Oct 2020 10:21:08 +0000 (10:21 +0000)
Change-Id: I1963bd139d8abd8988d5ceedaf85c74279546078
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35396
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/Gic.py

index 987a6e0abff377b59bda510c045fee6cb32dce7f..a24256c2721725905d5de1b51e1fcd79780a1faf 100644 (file)
@@ -110,6 +110,16 @@ class ArmSPI(ArmInterruptPin):
 
     _LINUX_ID = 0
 
+    def generateFdtProperty(self, gic):
+        """
+        Return a list used as an entry for an interrupt FdtProperty
+
+        Subtracting 32 because Linux assumes that SPIs start at 0, while
+        gem5 uses the internal GIC numbering (SPIs start at 32)
+        """
+        return gic.interruptCells(
+            self._LINUX_ID, self.num - 32, int(self.int_type.getValue()))
+
 class ArmPPI(ArmInterruptPin):
     type = 'ArmPPI'
     cxx_header = "dev/arm/base_gic.hh"
@@ -117,6 +127,16 @@ class ArmPPI(ArmInterruptPin):
 
     _LINUX_ID = 1
 
+    def generateFdtProperty(self, gic):
+        """
+        Return a list used as an entry for an interrupt FdtProperty
+
+        Subtracting 16 because Linux assumes that PPIs start at 0, while
+        gem5 uses the internal GIC numbering (PPIs start at 16)
+        """
+        return gic.interruptCells(
+            self._LINUX_ID, self.num - 16, int(self.int_type.getValue()))
+
 class GicV2(BaseGic):
     type = 'GicV2'
     cxx_header = "dev/arm/gic_v2.hh"