From patchwork Tue Jun 19 05:25:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Neuling X-Patchwork-Id: 931385 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.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 418xJs4rg7z9s3C for ; Tue, 19 Jun 2018 15:26:21 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 418xJs2x7kzF0dd for ; Tue, 19 Jun 2018 15:26:21 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org 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 418xJ569cczF0l6 for ; Tue, 19 Jun 2018 15:25:41 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=neuling.org Received: from localhost.localdomain (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id 418xJ44Mmyz9s52; Tue, 19 Jun 2018 15:25:40 +1000 (AEST) Received: by localhost.localdomain (Postfix, from userid 1000) id 72B02EE78C2; Tue, 19 Jun 2018 15:25:40 +1000 (AEST) From: Michael Neuling To: alistair@popple.id.au Date: Tue, 19 Jun 2018 15:25:24 +1000 Message-Id: <20180619052535.24043-7-mikey@neuling.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180619052535.24043-1-mikey@neuling.org> References: <20180619052535.24043-1-mikey@neuling.org> Subject: [Pdbg] [PATCH 07/18] htm: Move start() and stop() lower 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: grimm@linux.vnet.ibm.com, pdbg@lists.ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" So they can use some helper functions later. Signed-off-by: Michael Neuling --- libpdbg/htm.c | 100 +++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/libpdbg/htm.c b/libpdbg/htm.c index 0e5890182e..b4bdd3f5e5 100644 --- a/libpdbg/htm.c +++ b/libpdbg/htm.c @@ -315,27 +315,6 @@ static int get_status(struct htm *htm, struct htm_status *status) return 0; } -static int do_htm_stop(struct htm *htm) -{ - struct htm_status status; - get_status(htm, &status); - if (HTM_ERR(get_status(htm, &status))) - return -1; - - if (status.state == UNINITIALIZED) { - PR_INFO("* Skipping STOP trigger, HTM appears uninitialized\n"); - return -1; - } - if (status.state == TRACING) { - PR_INFO("* Sending STOP trigger to HTM\n"); - if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_STOP))) - return -1; - } else { - PR_INFO("* Skipping STOP trigger, HTM is not running\n"); - } - return 1; -} - /* * This sequence will trigger all HTM to start at "roughly" the same * time. @@ -538,35 +517,6 @@ static int is_startable(struct htm_status *status) return (status->state == READY || status->state == PAUSED); } -static int do_htm_start(struct htm *htm) -{ - struct htm_status status; - - if (HTM_ERR(get_status(htm, &status))) - return -1; - - if (!is_startable(&status)) { - PR_ERROR("HTM not in a startable state!\n"); - return -1; - } - - PR_INFO("* Sending START trigger to HTM\n"); - if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_MARK_VALID))) - return -1; - - if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_START))) - return -1; - - /* - * Instead of the HTM_TRIG_START, this is where you might want - * to call do_adu_magic() - * for_each_child_target("adu", &htm->target.parent, do_adu_magic, NULL, NULL); - * see what I mean? - */ - - return 1; -} - static char *get_debugfs_file(struct htm *htm, const char *file) { uint32_t chip_id; @@ -756,6 +706,56 @@ static int do_htm_reset(struct htm *htm, uint64_t *r_base, uint64_t *r_size) return 1; } +static int do_htm_start(struct htm *htm) +{ + struct htm_status status; + + if (HTM_ERR(get_status(htm, &status))) + return -1; + + if (!is_startable(&status)) { + PR_ERROR("HTM not in a startable state!\n"); + return -1; + } + + PR_INFO("* Sending START trigger to HTM\n"); + if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_MARK_VALID))) + return -1; + + if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_START))) + return -1; + + /* + * Instead of the HTM_TRIG_START, this is where you might want + * to call do_adu_magic() + * for_each_child_target("adu", &htm->target.parent, do_adu_magic, NULL, NULL); + * see what I mean? + */ + + return 1; +} + +static int do_htm_stop(struct htm *htm) +{ + struct htm_status status; + get_status(htm, &status); + if (HTM_ERR(get_status(htm, &status))) + return -1; + + if (status.state == UNINITIALIZED) { + PR_INFO("* Skipping STOP trigger, HTM appears uninitialized\n"); + return -1; + } + if (status.state == TRACING) { + PR_INFO("* Sending STOP trigger to HTM\n"); + if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_STOP))) + return -1; + } else { + PR_INFO("* Skipping STOP trigger, HTM is not running\n"); + } + return 1; +} + static int do_htm_status(struct htm *htm) { struct htm_status status;