[Pdbg] [PATCH v5 20/30] fake: Add additional device tree for testing
Amitay Isaacs
amitay at ozlabs.org
Mon Oct 14 16:17:38 AEDT 2019
Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
Reviewed-by: Alistair Popple <alistair at popple.id.au>
---
Makefile.am | 3 +-
fake2.dts.m4 | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 110 insertions(+), 1 deletion(-)
create mode 100644 fake2.dts.m4
diff --git a/Makefile.am b/Makefile.am
index f2c3335..9b9e04e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,6 +35,7 @@ AM_CFLAGS = -I$(top_srcdir)/ccan/array_size -Wall -Werror -O2
EXTRA_DIST = \
fake.dts.m4 \
+ fake2.dts.m4 \
p8-fsi.dts.m4 \
p8-host.dts.m4 \
p8-i2c.dts.m4 \
@@ -63,7 +64,7 @@ if TARGET_PPC
ARCH_FLAGS="-DTARGET_PPC=1"
endif
-DT = fake.dts p8-cronus.dts p9-cronus.dts \
+DT = fake.dts fake2.dts p8-cronus.dts p9-cronus.dts \
p8-fsi.dts p8-i2c.dts p8-kernel.dts \
p9w-fsi.dts p9r-fsi.dts p9z-fsi.dts p9-kernel.dts \
p8-host.dts p9-host.dts
diff --git a/fake2.dts.m4 b/fake2.dts.m4
new file mode 100644
index 0000000..8c7b21a
--- /dev/null
+++ b/fake2.dts.m4
@@ -0,0 +1,108 @@
+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'),dnl
+`
+ CONCAT(proc,i) {
+ index = < CONCAT(0x,i) >;
+ };
+')
+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)
+};
--
2.21.0
More information about the Pdbg
mailing list