From 1a51f335ffbcf9abb685ae18daa8d00aecc6bee8 Mon Sep 17 00:00:00 2001 From: Glenn Bergmans Date: Fri, 22 Jan 2016 15:25:40 +0000 Subject: [PATCH] arm: DT autogeneration - Generate memory node Implements a high level method for generating a Device Tree node for an AbstractMemory object. Change-Id: I544ec642f182f103df26de535fdfaf03b3787a08 Reviewed-by: Andreas Sandberg Reviewed-by: Curtis Dunham Reviewed-on: https://gem5-review.googlesource.com/5964 Maintainer: Andreas Sandberg --- src/arch/arm/ArmSystem.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/arch/arm/ArmSystem.py b/src/arch/arm/ArmSystem.py index 245ac55df..f76140bc9 100644 --- a/src/arch/arm/ArmSystem.py +++ b/src/arch/arm/ArmSystem.py @@ -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) -- 2.30.2