arm: DT autogeneration - Generate memory node
authorGlenn Bergmans <glenn.bergmans@arm.com>
Fri, 22 Jan 2016 15:25:40 +0000 (15:25 +0000)
committerCurtis Dunham <curtis.dunham@arm.com>
Mon, 29 Jan 2018 22:22:06 +0000 (22:22 +0000)
Implements a high level method for generating a Device Tree node for
an AbstractMemory object.

Change-Id: I544ec642f182f103df26de535fdfaf03b3787a08
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/5964
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/arch/arm/ArmSystem.py

index 245ac55df3b3903a4c4d9c2e921f8b309cf78475..f76140bc9f7dcc0e6760ba3578dedab63899d80c 100644 (file)
@@ -88,10 +88,22 @@ class ArmSystem(System):
         # creating a node called '/' which will then be merged with the
         # root instead of appended.
 
+        def generateMemNode(mem_range):
+            node = FdtNode("memory@%x" % long(mem_range.start))
+            node.append(FdtPropertyStrings("device_type", ["memory"]))
+            node.append(FdtPropertyWords("reg",
+                state.addrCells(mem_range.start) +
+                state.sizeCells(mem_range.size()) ))
+            return node
+
         root = FdtNode('/')
         root.append(state.addrCellsProperty())
         root.append(state.sizeCellsProperty())
 
+        # Add memory nodes
+        for mem_range in self.mem_ranges:
+            root.append(generateMemNode(mem_range))
+
         for node in self.recurseDeviceTree(state):
             # Merge root nodes instead of adding them (for children
             # that need to add multiple root level nodes)