aboutsummaryrefslogtreecommitdiffstats
path: root/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts
diff options
context:
space:
mode:
Diffstat (limited to 'meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts')
-rw-r--r--meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts135
1 files changed, 135 insertions, 0 deletions
diff --git a/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts
new file mode 100644
index 00000000..1468801a
--- /dev/null
+++ b/meta-xilinx-core/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2019,2020 Xilinx Inc. All rights reserved.
+ *
+ * Author:
+ * Bruce Ashfield <bruce.ashfield@xilinx.com>
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/dts-v1/;
+
+/ {
+ compatible = "system-device-tree-v1,lop";
+ lops {
+ compatible = "system-device-tree-v1,lop";
+ lop_0_1 {
+ compatible = "system-device-tree-v1,lop,select-v1";
+ select_1;
+ select_2 = "/.*:os,type:.*";
+ lop_0_2 {
+ compatible = "system-device-tree-v1,lop,code-v1";
+ inherit = "lopper_lib";
+ code = "
+ for s in __selected__:
+ os_type = s['os,type'].value[0]
+ try:
+ domain_name = s.label
+ except:
+ domain_name = s.name
+ if not domain_name:
+ domain_name = s.name
+ try:
+ cpu = s['cpus']
+ except:
+ print( '[ERROR]: os,type node, has no cpu reference' )
+ try:
+ cpu_node = tree.pnode( cpu.value[0] )
+ cpu_mask = cpu[1]
+ except:
+ print( '[ERROR]: os,type node, has invalid cpu reference' )
+
+ cpu_output = {}
+ cpus_refd, cpus_unrefd = lopper_lib.cpu_refs( tree, cpu )
+ for c in cpus_refd:
+ cpu_type = c['compatible'].value[0]
+ cpu_output[cpu_type] = '{} {} {}'.format(cpu_type,domain_name,os_type)
+
+ # print the summary lines
+ for o in cpu_output.values():
+ print( '%s' % o )
+ ";
+ };
+ };
+ lop_0_3 {
+ compatible = "system-device-tree-v1,lop,select-v1";
+ select_1;
+ select_2 = "/.*:compatible:openamp,domain-v1";
+ select_3 = ":!os,type:";
+ select_4 = ":compatible:!xilinx,subsystem-v1";
+ lop_0_3_1 {
+ compatible = "system-device-tree-v1,lop,code-v1";
+ inherit = "lopper_lib";
+ code = "
+ if __selected__:
+ print( '# global \\'all\\' domains' )
+ # __selected__ are domains with no os,type specificiation
+ # we'll dump them to a global 'all' domain
+ for s in __selected__:
+ os_type = 'linux'
+ try:
+ domain_name = s.label
+ except:
+ domain_name = s.name
+ if not domain_name:
+ domain_name = s.name
+ try:
+ cpu = s['cpus']
+ except:
+ print( '[ERROR]: os,type node, has no cpu reference' )
+ try:
+ cpu_node = tree.pnode( cpu.value[0] )
+ cpu_mask = cpu[1]
+ except:
+ print( '[ERROR]: os,type node, has invalid cpu reference' )
+
+ cpu_output = {}
+ cpus_refd, cpus_unrefd = lopper_lib.cpu_refs( tree, cpu )
+ for c in cpus_refd:
+ cpu_type = c['compatible'].value[0]
+ cpu_output[cpu_type] = '{} {} {}'.format(cpu_type,domain_name,os_type)
+
+ # print the summary lines
+ for o in cpu_output.values():
+ print( '%s' % o )
+ ";
+ };
+ };
+ lop_0_4 {
+ compatible = "system-device-tree-v1,lop,select-v1";
+ select_1;
+ select_2 = "/.*:compatible:cpus,cluster";
+ lop_0_3_1 {
+ compatible = "system-device-tree-v1,lop,code-v1";
+ inherit = "lopper_lib";
+ code = "
+ cpu_output = {}
+ symbol_node = node.tree['/__symbols__']
+ prop_dict = symbol_node.__props__
+ for c in __selected__:
+ num_cpu = 0
+ for c_node in c.subnodes( children_only = True ):
+ try:
+ cpu_node = c_node['device_type'].value[0]
+ num_cpu = c_node['reg'].value[0]
+ num_cpu = num_cpu + 1
+ except:
+ cpu_node = None
+ if cpu_node:
+ match = [label for label,node_abs in prop_dict.items() if re.match(node_abs[0], c_node.abs_path) and len(node_abs[0]) == len(c_node.abs_path)]
+ cpu_name = match[0]
+ if num_cpu != 0:
+ cpu_type = c_node['compatible'].value[0]
+ dict_key = cpu_name + str(num_cpu)
+ cpu_output[dict_key] = '{} {} {} {} {}'.format(cpu_type, num_cpu-1, 'None', cpu_name, 'None')
+
+ if cpu_output:
+ print( '# global core_number no-domain cpu_name' )
+
+ for o in cpu_output.values():
+ print( '%s' % o )
+ ";
+ };
+ };
+ };
+};