From patchwork Thu Apr 30 03:05:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1279895 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49CKzL3FDCz9sSg for ; Thu, 30 Apr 2020 13:06:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=ozlabs.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=sx0gM0Q1; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49CKzL2HGWzDr94 for ; Thu, 30 Apr 2020 13:06:38 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 49CKyb2khxzDrBR for ; Thu, 30 Apr 2020 13:05:59 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.a=rsa-sha256 header.s=201707 header.b=sx0gM0Q1; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 49CKyZ6CGBz9sSk; Thu, 30 Apr 2020 13:05:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1588215959; bh=NwDuTQuXK15HQdSdoN65jLcIlI7hlsRRMdqNqWUzhmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sx0gM0Q1RHNrsesao9XKXJywN9N4anD+mA/C3xqJ6HedAWvC+FQmRXU9HEMKMHZeh YyQPPvpoYfsczZZiNovQikih2S8KMSdioMb4C4JhQXIXjCfRKVHJIsnc29OuqTtVN4 spWmU2lYh4ruB1nvz28bId7cnB/gmgzLj2udqMkTHSIQIapbh9OqF4XztccS4KugBE 3L/IMpIpvkyCTDz4Z5XszdRsoOe9BF2sUs7OaAfX1mSNGycDko7jcqfau+8BwFNkUn mx93NeorKBkwGxc9EcwYvf2NpRlpaVC6zBsW+i8vlZEwl1iFNmve/HLyvUeBjTIPAm if7unYXocgU+g== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Thu, 30 Apr 2020 13:05:44 +1000 Message-Id: <20200430030544.234289-12-amitay@ozlabs.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200430030544.234289-1-amitay@ozlabs.org> References: <20200430030544.234289-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 11/11] dts: Split fake2 into backend and system trees X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Amitay Isaacs Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" Signed-off-by: Amitay Isaacs --- 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 = ; + 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 = ; - 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 <