From patchwork Fri May 25 04:52:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 920235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40sYm228qtz9s19 for ; Fri, 25 May 2018 14:53:06 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (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.b="ehkU0Gdp"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40sYm20CkxzF1fp for ; Fri, 25 May 2018 14:53:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=ozlabs.org header.i=@ozlabs.org header.b="ehkU0Gdp"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sYll0cvNzF1fP for ; Fri, 25 May 2018 14:52:51 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (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.b="ehkU0Gdp"; dkim-atps=neutral Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 40sYlk5nD2z9s19; Fri, 25 May 2018 14:52:50 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ozlabs.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1527223970; bh=3C9ENttpFnUfDlYh/ityNGM/02Q7s/YPttyb4TRIUbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehkU0Gdp/5P9YDbzK3+Fa4fquC0h1a/u9mfWTEOWn8IJVvbMw5vTTSy+5kMi384o1 h9jLOVgnRH1t6XWweuRa9GOnw0bj9r+eQG739xzAof+6NS/gRvE2r1qIBQ6XMGG7WH cp6jURRX3s4CiW5QLlm4Wf6NEQiLPVqRoEGMvKrAPe2WdvwwdXlUyw+HJ3oLsBsuLa IqbUhjDhPg8qLv61AMNhi4mk37Bdkli1fQ1j6iw7ZoFQ+zwsjqoUwOpFTDtEZAFMy6 MRfQCYq+MpWiSMC1n11dvCXJETBWv8cLLpXdv2OAWeDreSubkQAUvNNKiNySaAi1zU tNxjytmbrrCBA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 14:52:38 +1000 Message-Id: <20180525045240.24196-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180525045240.24196-1-amitay@ozlabs.org> References: <20180525045240.24196-1-amitay@ozlabs.org> Subject: [Pdbg] [PATCH 4/6] fake.dts: Add more targets for testing X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.26 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 MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" The number of targets (pib/core/thread) can be changed easily by changing the arguments to dump_fsi() macro. The targets have unique addresses, so can be used for testing range-checking (if any) for getscom/putscom operations. Signed-off-by: Amitay Isaacs --- fake.dts.m4 | 121 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 103 insertions(+), 18 deletions(-) diff --git a/fake.dts.m4 b/fake.dts.m4 index 56bf35e..4c6c145 100644 --- a/fake.dts.m4 +++ b/fake.dts.m4 @@ -1,22 +1,107 @@ +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', +` + pib@$2 { + #address-cells = <0x1>; + #size-cells = <0x1>; + compatible = "ibm,fake-pib"; + reg = <0x$2 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($2+(i+1)*10), $4)') +dump_processor_post()') + +dnl +dnl dump_fsi_pre([index], [addr]) +dnl +define(`dump_fsi_pre', +` + fsi@$2 { + #address-cells = <0x1>; + #size-cells = <0x1>; + compatible = "ibm,fake-fsi"; + reg = <0x$2 0x0>; + index = <0x$1>;') + +dnl +dnl dump_fsi_post() +dnl +define(`dump_fsi_post', ` };') + +dnl +dnl dump_fsi([index], [addr], [num_processors], [num_cores], [num_threads]) +dnl +define(`dump_fsi', +`dump_fsi_pre(`$1', `$2') +forloop(`i', `0', eval(`$3-1'), `dump_processor(i, eval(10000+i*1000), $4, $5)') +dump_fsi_post()') +divert`'dnl + /dts-v1/; / { - #address-cells = <0x1>; - #size-cells = <0x0>; - - fsi@0 { - #address-cells = <0x2>; - #size-cells = <0x1>; - compatible = "ibm,fake-fsi"; - reg = <0x0 0x0 0x0>; - - index = <0x0>; - status = "mustexist"; - - pib@0 { - compatible = "ibm,fake-pib"; - reg = <0x0 0x0 0x0>; - index = <0x0>; - }; - }; + #address-cells = <0x1>; + #size-cells = <0x1>; +dump_fsi(0, 0, 8, 4, 2) };