diff options
author | Mark Hatle <mark.hatle@xilinx.com> | 2021-09-13 12:30:22 -0700 |
---|---|---|
committer | Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com> | 2021-09-28 08:20:16 -0700 |
commit | 117f5adea54bde35fa160bb3086f2c55d14857e8 (patch) | |
tree | b80407e08508095a0fa00106dcdb6035f5ab99e6 /meta-xilinx-bsp/recipes-kernel | |
parent | 088c45148693eff95864666bb551a4890ff7e43a (diff) | |
download | meta-xilinx-117f5adea54bde35fa160bb3086f2c55d14857e8.tar.gz |
xilinx-lops: Add Xilinx system device tree CPU ID processing
Add a new lop-xilinx-id-cpus.dts file to automatically identify OS hints,
domains and cpu information. Output is in the format:
$ ./lopper.py -f --enhanced -i lops/lop-cpus.dts system-device-tree-spec.dts foo.dts
arm,cortex-a72 linux1 linux,xen
arm,cortex-a72 linux2 linux,xen
arm,cortex-r5 subsystem2 baremetal
xlnx,microblaze subsystem2 baremetal
# global 'all' domains
arm,cortex-a72 xen linux
# global no-domain cpus
xlnx,microblaze None None
$ ./lopper.py -f --enhanced -i lops/lop-cpus.dts t/vck190_systemdt/system-top.dts foo.dts
# global no-domain cpus
arm,cortex-a72 None None
pmc-microblaze None None
psm-microblaze None None
arm,cortex-r5 None None
Signed-off-by: Mark Hatle <mark.hatle@xilinx.com>
Diffstat (limited to 'meta-xilinx-bsp/recipes-kernel')
-rw-r--r-- | meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops.bb | 8 | ||||
-rw-r--r-- | meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts | 127 |
2 files changed, 133 insertions, 2 deletions
diff --git a/meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops.bb b/meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops.bb index 3a41c579..cfa1bc87 100644 --- a/meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops.bb +++ b/meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops.bb | |||
@@ -5,7 +5,10 @@ LICENSE = "BSD-3-Clause" | |||
5 | 5 | ||
6 | RDEPENDS_${PN} += "lopper" | 6 | RDEPENDS_${PN} += "lopper" |
7 | 7 | ||
8 | SRC_URI = "file://lop-microblaze-yocto.dts" | 8 | SRC_URI = " \ |
9 | file://lop-microblaze-yocto.dts \ | ||
10 | file://lop-xilinx-id-cpus.dts \ | ||
11 | " | ||
9 | 12 | ||
10 | LIC_FILES_CHKSUM = "file://lop-microblaze-yocto.dts;endline=8;md5=a0e89d39fa397ec5d5320409ff701280" | 13 | LIC_FILES_CHKSUM = "file://lop-microblaze-yocto.dts;endline=8;md5=a0e89d39fa397ec5d5320409ff701280" |
11 | 14 | ||
@@ -17,7 +20,8 @@ do_compile[noexec] = '1' | |||
17 | do_install() { | 20 | do_install() { |
18 | mkdir -p ${D}/${datadir}/lopper/lops | 21 | mkdir -p ${D}/${datadir}/lopper/lops |
19 | cp ${S}/lop-microblaze-yocto.dts ${D}/${datadir}/lopper/lops/. | 22 | cp ${S}/lop-microblaze-yocto.dts ${D}/${datadir}/lopper/lops/. |
23 | cp ${S}/lop-xilinx-id-cpus.dts ${D}/${datadir}/lopper/lops/. | ||
20 | } | 24 | } |
21 | 25 | ||
22 | FILES_${PN} += "${datadir}/lopper/lops/lop-microblaze-yocto.dts" | 26 | FILES_${PN} += "${datadir}/lopper/lops" |
23 | BBCLASSEXTEND = "native nativesdk" | 27 | BBCLASSEXTEND = "native nativesdk" |
diff --git a/meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts b/meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts new file mode 100644 index 00000000..67d68bba --- /dev/null +++ b/meta-xilinx-bsp/recipes-kernel/lopper/xilinx-lops/lop-xilinx-id-cpus.dts | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2019,2020 Xilinx Inc. All rights reserved. | ||
3 | * | ||
4 | * Author: | ||
5 | * Bruce Ashfield <bruce.ashfield@xilinx.com> | ||
6 | * | ||
7 | * SPDX-License-Identifier: BSD-3-Clause | ||
8 | */ | ||
9 | |||
10 | /dts-v1/; | ||
11 | |||
12 | / { | ||
13 | compatible = "system-device-tree-v1,lop"; | ||
14 | lops { | ||
15 | compatible = "system-device-tree-v1,lop"; | ||
16 | lop_0_1 { | ||
17 | compatible = "system-device-tree-v1,lop,select-v1"; | ||
18 | select_1; | ||
19 | select_2 = "/.*:os,type:.*"; | ||
20 | lop_0_2 { | ||
21 | compatible = "system-device-tree-v1,lop,code-v1"; | ||
22 | inherit = "lopper_lib"; | ||
23 | code = " | ||
24 | for s in __selected__: | ||
25 | os_type = s['os,type'].value[0] | ||
26 | try: | ||
27 | domain_name = s.label | ||
28 | except: | ||
29 | domain_name = s.name | ||
30 | if not domain_name: | ||
31 | domain_name = s.name | ||
32 | try: | ||
33 | cpu = s['cpus'] | ||
34 | except: | ||
35 | print( '[ERROR]: os,type node, has no cpu reference' ) | ||
36 | try: | ||
37 | cpu_node = tree.pnode( cpu.value[0] ) | ||
38 | cpu_mask = cpu[1] | ||
39 | except: | ||
40 | print( '[ERROR]: os,type node, has invalid cpu reference' ) | ||
41 | |||
42 | cpu_output = {} | ||
43 | cpus_refd, cpus_unrefd = lopper_lib.cpu_refs( tree, cpu ) | ||
44 | for c in cpus_refd: | ||
45 | cpu_type = c['compatible'].value[0] | ||
46 | cpu_output[cpu_type] = '{} {} {}'.format(cpu_type,domain_name,os_type) | ||
47 | |||
48 | # print the summary lines | ||
49 | for o in cpu_output.values(): | ||
50 | print( '%s' % o ) | ||
51 | "; | ||
52 | }; | ||
53 | }; | ||
54 | lop_0_3 { | ||
55 | compatible = "system-device-tree-v1,lop,select-v1"; | ||
56 | select_1; | ||
57 | select_2 = "/.*:compatible:openamp,domain-v1"; | ||
58 | select_3 = ":!os,type:"; | ||
59 | select_4 = ":compatible:!xilinx,subsystem-v1"; | ||
60 | lop_0_3_1 { | ||
61 | compatible = "system-device-tree-v1,lop,code-v1"; | ||
62 | inherit = "lopper_lib"; | ||
63 | code = " | ||
64 | if __selected__: | ||
65 | print( '# global \\'all\\' domains' ) | ||
66 | # __selected__ are domains with no os,type specificiation | ||
67 | # we'll dump them to a global 'all' domain | ||
68 | for s in __selected__: | ||
69 | os_type = 'linux' | ||
70 | try: | ||
71 | domain_name = s.label | ||
72 | except: | ||
73 | domain_name = s.name | ||
74 | if not domain_name: | ||
75 | domain_name = s.name | ||
76 | try: | ||
77 | cpu = s['cpus'] | ||
78 | except: | ||
79 | print( '[ERROR]: os,type node, has no cpu reference' ) | ||
80 | try: | ||
81 | cpu_node = tree.pnode( cpu.value[0] ) | ||
82 | cpu_mask = cpu[1] | ||
83 | except: | ||
84 | print( '[ERROR]: os,type node, has invalid cpu reference' ) | ||
85 | |||
86 | cpu_output = {} | ||
87 | cpus_refd, cpus_unrefd = lopper_lib.cpu_refs( tree, cpu ) | ||
88 | for c in cpus_refd: | ||
89 | cpu_type = c['compatible'].value[0] | ||
90 | cpu_output[cpu_type] = '{} {} {}'.format(cpu_type,domain_name,os_type) | ||
91 | |||
92 | # print the summary lines | ||
93 | for o in cpu_output.values(): | ||
94 | print( '%s' % o ) | ||
95 | "; | ||
96 | }; | ||
97 | }; | ||
98 | lop_0_4 { | ||
99 | compatible = "system-device-tree-v1,lop,select-v1"; | ||
100 | select_1; | ||
101 | select_2 = "/.*:compatible:cpus,cluster"; | ||
102 | lop_0_3_1 { | ||
103 | compatible = "system-device-tree-v1,lop,code-v1"; | ||
104 | inherit = "lopper_lib"; | ||
105 | code = " | ||
106 | cpu_output = {} | ||
107 | for c in __selected__: | ||
108 | for c_node in c.subnodes( children_only = True ): | ||
109 | try: | ||
110 | cpu_node = c_node['device_type'].value[0] | ||
111 | except: | ||
112 | cpu_node = None | ||
113 | if cpu_node: | ||
114 | if c_node.ref == 0: | ||
115 | cpu_type = c_node['compatible'].value[0] | ||
116 | cpu_output[cpu_type] = '{} {} {}'.format(cpu_type,'None','None') | ||
117 | |||
118 | if cpu_output: | ||
119 | print( '# global no-domain cpus' ) | ||
120 | |||
121 | for o in cpu_output.values(): | ||
122 | print( '%s' % o ) | ||
123 | "; | ||
124 | }; | ||
125 | }; | ||
126 | }; | ||
127 | }; | ||