[Pdbg] [PATCH 11/11] dts: Split fake2 into backend and system trees
Amitay Isaacs
amitay at ozlabs.org
Thu Apr 30 13:05:44 AEST 2020
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
---
Makefile.am | 5 ++-
fake2-backend.dts.m4 | 104 +++++++++++++++++++++++++++++++++++++++++++
fake2.dts.m4 | 80 +--------------------------------
tests/test_tree2.sh | 1 +
4 files changed, 109 insertions(+), 81 deletions(-)
create mode 100644 fake2-backend.dts.m4
diff --git a/Makefile.am b/Makefile.am
index e0b0954..f9c0adc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,7 +34,7 @@ PDBG_TESTS = \
TESTS = $(libpdbg_tests) optcmd_test $(PDBG_TESTS)
-tests/test_tree2.sh: fake2.dtb
+tests/test_tree2.sh: fake2.dtb fake2-backend.dtb
tests/test_prop.sh: fake.dtb fake-backend.dtb
tests/test_p9_fapi_translation.sh: p9.dtb bmc-kernel.dtb
@@ -77,7 +77,8 @@ if TARGET_PPC
ARCH_FLAGS="-DTARGET_PPC=1"
endif
-DT = fake.dts fake-backend.dts fake2.dts p8-cronus.dts bmc-cronus.dts \
+DT = fake.dts fake-backend.dts fake2.dts fake2-backend.dts \
+ p8-cronus.dts bmc-cronus.dts \
p8-fsi.dts p8-i2c.dts p8-kernel.dts \
p9w-fsi.dts p9r-fsi.dts p9z-fsi.dts bmc-kernel.dts \
bmc-sbefifo.dts \
diff --git a/fake2-backend.dts.m4 b/fake2-backend.dts.m4
new file mode 100644
index 0000000..36c1140
--- /dev/null
+++ b/fake2-backend.dts.m4
@@ -0,0 +1,104 @@
+define(`CONCAT', `$1$2')dnl
+
+dnl
+dnl forloop([var], [start], [end], [iterator])
+dnl
+divert(`-1')
+define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')')
+define(`_forloop',
+ `$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')')
+
+dnl
+dnl dump_thread([index])
+dnl
+define(`dump_thread',
+`
+ thread@$1 {
+ #address-cells = <0x0>;
+ #size-cells = <0x0>;
+ compatible = "ibm,fake-thread";
+ reg = <0x$1 0x0>;
+ index = <0x$1>;
+ };
+')dnl
+
+dnl
+dnl dump_core_pre([index], [addr])
+dnl
+define(`dump_core_pre',
+`
+ core@$2 {
+ #address-cells = <0x1>;
+ #size-cells = <0x1>;
+ compatible = "ibm,fake-core";
+ reg = <0x$2 0x0>;
+ index = <0x$1>;')
+
+dnl
+dnl dump_core_post()
+dnl
+define(`dump_core_post', ` };
+')dnl
+
+dnl
+dnl dump_core([index], [addr], [num_threads])
+dnl
+define(`dump_core',
+`dump_core_pre(`$1', `$2')
+forloop(`i', `0', eval(`$3-1'), `dump_thread(i)')
+dump_core_post()')
+
+dnl
+dnl dump_processor_pre([index], [addr])
+dnl
+define(`dump_processor_pre',
+`define(`pib_addr', eval(`$2+100'))dnl
+ fsi@$2 {
+ #address-cells = <0x1>;
+ #size-cells = <0x1>;
+ compatible = "ibm,fake-fsi";
+ system-path = "/proc$1/fsi";
+ reg = <0x0 0x0>;
+ index = <0x$1>;
+
+ CONCAT(pib@,pib_addr) {
+ #address-cells = <0x1>;
+ #size-cells = <0x1>;
+ compatible = "ibm,fake-pib";
+ system-path = "/proc$1/pib";
+ reg = <CONCAT(0x,pib_addr) 0x0>;
+ index = <0x$1>;')
+
+dnl
+dnl dump_processor_post()
+dnl
+define(`dump_processor_post', ` };
+
+ };
+
+')dnl
+
+dnl
+dnl dump_processor([index], [addr], [num_cores], [num_threads])
+dnl
+define(`dump_processor',dnl
+`dump_processor_pre(`$1', `$2')
+forloop(`i', `0', eval(`$3-1'), `dump_core(i, eval(10000+(i+1)*10), $4)')
+dump_processor_post()')
+
+dnl
+dnl dump_system([num_processors], [num_cores], [num_threads])
+dnl
+define(`dump_system',
+`forloop(`i', `0', eval(`$1-1'), `dump_processor(i, eval(20000+i*1000), $2, $3)')
+')
+divert`'dnl
+
+/dts-v1/;
+
+/ {
+ #address-cells = <0x1>;
+ #size-cells = <0x1>;
+dump_system(8, 4, 2)
+};
+
diff --git a/fake2.dts.m4 b/fake2.dts.m4
index 8c7b21a..f71caa2 100644
--- a/fake2.dts.m4
+++ b/fake2.dts.m4
@@ -8,84 +8,6 @@ define(`forloop', `pushdef(`$1', `$2')_forloop($@)popdef(`$1')')
define(`_forloop',
`$4`'ifelse($1, `$3', `', `define(`$1', incr($1))$0($@)')')
-dnl
-dnl dump_thread([index])
-dnl
-define(`dump_thread',
-`
- thread@$1 {
- #address-cells = <0x0>;
- #size-cells = <0x0>;
- compatible = "ibm,fake-thread";
- reg = <0x$1 0x0>;
- index = <0x$1>;
- };
-')dnl
-
-dnl
-dnl dump_core_pre([index], [addr])
-dnl
-define(`dump_core_pre',
-`
- core@$2 {
- #address-cells = <0x1>;
- #size-cells = <0x1>;
- compatible = "ibm,fake-core";
- reg = <0x$2 0x0>;
- index = <0x$1>;')
-
-dnl
-dnl dump_core_post()
-dnl
-define(`dump_core_post', ` };
-')dnl
-
-dnl
-dnl dump_core([index], [addr], [num_threads])
-dnl
-define(`dump_core',
-`dump_core_pre(`$1', `$2')
-forloop(`i', `0', eval(`$3-1'), `dump_thread(i)')
-dump_core_post()')
-
-dnl
-dnl dump_processor_pre([index], [addr])
-dnl
-define(`dump_processor_pre',
-`define(`pib_addr', eval(`$2+100'))dnl
- fsi@$2 {
- #address-cells = <0x1>;
- #size-cells = <0x1>;
- compatible = "ibm,fake-fsi";
- system-path = "/proc$1/fsi";
- reg = <0x0 0x0>;
- index = <0x$1>;
-
- CONCAT(pib@,pib_addr) {
- #address-cells = <0x1>;
- #size-cells = <0x1>;
- compatible = "ibm,fake-pib";
- system-path = "/proc$1/pib";
- reg = <CONCAT(0x,pib_addr) 0x0>;
- index = <0x$1>;')
-
-dnl
-dnl dump_processor_post()
-dnl
-define(`dump_processor_post', ` };
-
- };
-
-')dnl
-
-dnl
-dnl dump_processor([index], [addr], [num_cores], [num_threads])
-dnl
-define(`dump_processor',dnl
-`dump_processor_pre(`$1', `$2')
-forloop(`i', `0', eval(`$3-1'), `dump_core(i, eval(10000+(i+1)*10), $4)')
-dump_processor_post()')
-
dnl
dnl dump_system([num_processors], [num_cores], [num_threads])
dnl
@@ -96,7 +18,7 @@ define(`dump_system',
index = < CONCAT(0x,i) >;
};
')
-forloop(`i', `0', eval(`$1-1'), `dump_processor(i, eval(20000+i*1000), $2, $3)')')
+')
divert`'dnl
/dts-v1/;
diff --git a/tests/test_tree2.sh b/tests/test_tree2.sh
index 7b8ccc8..3b475eb 100755
--- a/tests/test_tree2.sh
+++ b/tests/test_tree2.sh
@@ -5,6 +5,7 @@
test_group "tree tests for fake2.dts"
export PDBG_DTB="fake2.dtb"
+export PDBG_BACKEND_DTB="fake2-backend.dtb"
test_result 0 <<EOF
/ (/)
--
2.25.4
More information about the Pdbg
mailing list