arm: DT autogeneration - Device Tree generation methods
This patch adds an extra layer to the pyfdt library such that usage gets easier and device tree nodes can be specified in less code, without limiting original usage. Note to not import both the pyfdt and fdthelper in the same namespace (but generally fdthelper is all you need, because it supplies the same classes even when they are not extended in any way) Also, this patch lays out the primary functionality for generating a device tree, where every SimObject gets an empty generateDeviceTree method and ArmSystems loop over their children in an effort to merge all the nodes. Devices are implemented in other patches. Change-Id: I4d0a0666827287fe42e18447f19acab4dc80cc49 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-on: https://gem5-review.googlesource.com/5962 Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
committed by
Curtis Dunham
parent
3da0578581
commit
7c8662f54a
@@ -34,9 +34,11 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Authors: Ali Saidi
|
||||
# Glenn Bergmans
|
||||
|
||||
from m5.params import *
|
||||
from m5.SimObject import *
|
||||
from m5.util.fdthelper import *
|
||||
|
||||
from System import System
|
||||
|
||||
@@ -79,6 +81,27 @@ class ArmSystem(System):
|
||||
"Base of the 64KiB PA range used for memory-mapped m5ops. Set to 0 "
|
||||
"to disable.")
|
||||
|
||||
def generateDeviceTree(self, state):
|
||||
# Generate a device tree root node for the system by creating the root
|
||||
# node and adding the generated subnodes of all children.
|
||||
# When a child needs to add multiple nodes, this is done by also
|
||||
# creating a node called '/' which will then be merged with the
|
||||
# root instead of appended.
|
||||
|
||||
root = FdtNode('/')
|
||||
root.append(state.addrCellsProperty())
|
||||
root.append(state.sizeCellsProperty())
|
||||
|
||||
for node in self.recurseDeviceTree(state):
|
||||
# Merge root nodes instead of adding them (for children
|
||||
# that need to add multiple root level nodes)
|
||||
if node.get_name() == root.get_name():
|
||||
root.merge(node)
|
||||
else:
|
||||
root.append(node)
|
||||
|
||||
return root
|
||||
|
||||
class GenericArmSystem(ArmSystem):
|
||||
type = 'GenericArmSystem'
|
||||
cxx_header = "arch/arm/system.hh"
|
||||
|
||||
Reference in New Issue
Block a user