From patchwork Wed Jul 17 04:08:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1133086 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 45pP1J0pt0z9sMQ for ; Wed, 17 Jul 2019 14:09:56 +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.b="BuUtEXj6"; 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 45pP1H4pjjzDqQN for ; Wed, 17 Jul 2019 14:09:55 +1000 (AEST) X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (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 45pP0L0cQrzDqLq for ; Wed, 17 Jul 2019 14:09:06 +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.b="BuUtEXj6"; 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 45pP0K5Yz4z9sLt; Wed, 17 Jul 2019 14:09:05 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1563336545; bh=Dlf+1wftoqNK3xJaKPPNHin/iDUrOPNcAS5OOxSewQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BuUtEXj6Q3a67qGDDB1ZKxQ2uk1DiQkHx9YLt2GHc2JBP8ysmMortYcYeW83dd0Wk lFIlaedu3Hgn1k+a7CJDA+5ThUCFYnlIdEN6lmHgwRiw/S3FzwTb+l+8b+SmqSiW8I tciBKdP1R//oZwQjkKSU1bg5b23uEzkS70gfKKWwYxDLU7jhLuZe7jet7ADosVt65Q 8y051LpGvdKIb9jJc3PKTNiL3WQKFQScSUFR8LlaOiL/l0+jfPcVJHiiKD7DrcyciH jZj+Qsfx09/fe02l/q+dH3l1WFbbE/YIRpKEk2a1SRXuBnSDRzW6u5D5RoxmOpFOyJ dP+kBel539obg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 17 Jul 2019 14:08:50 +1000 Message-Id: <20190717040852.13327-12-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190717040852.13327-1-amitay@ozlabs.org> References: <20190717040852.13327-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH v4 11/13] sbefifo: Add procedure for custom chipop 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 --- libpdbg/hwunit.h | 1 + libpdbg/sbefifo.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index 501ec74..1bfb872 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -74,6 +74,7 @@ struct sbefifo { int (*thread_stop)(struct sbefifo *, uint32_t core_id, uint32_t thread_id); int (*thread_step)(struct sbefifo *, uint32_t core_id, uint32_t thread_id); int (*thread_sreset)(struct sbefifo *, uint32_t core_id, uint32_t thread_id); + int (*chipop)(struct sbefifo *, uint32_t *, uint32_t, uint8_t **, uint32_t *, uint32_t *); uint32_t (*ffdc_get)(struct sbefifo *, const uint8_t **, uint32_t *); int fd; uint32_t status; diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 79a0c46..a2442cd 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -430,6 +430,38 @@ static int sbefifo_op_thread_sreset(struct sbefifo *sbefifo, return sbefifo_op_control(sbefifo, core_id, thread_id, SBEFIFO_INSN_OP_SRESET); } +static int sbefifo_op_chipop(struct sbefifo *sbefifo, + uint32_t *msg, uint32_t msg_len, + uint8_t **out, uint32_t *out_len, uint32_t *status) +{ + uint32_t len, cmd, op; + int rc; + + assert(msg_len > 3); + + len = be32toh(msg[0]); + cmd = be32toh(msg[1]); + op = be32toh(msg[2]); + + PR_NOTICE("sbefifo: chipop command=%u, op=%u\n", cmd, op); + + if (len != msg_len) { + PR_ERROR("sbefifo: chipop: Invalid msg length, expected %u, got %u\n", + len, msg_len); + return -1; + } + + /* Limit the expected data to 64K */ + if (*out_len > 0x10000) + *out_len = 0x10000; + + rc = sbefifo_op(sbefifo, msg, msg_len, cmd, out, out_len, status); + if (rc) + return rc; + + return 0; +} + static int sbefifo_probe(struct pdbg_target *target) { struct sbefifo *sf = target_to_sbefifo(target); @@ -461,6 +493,7 @@ struct sbefifo kernel_sbefifo = { .thread_stop = sbefifo_op_thread_stop, .thread_step = sbefifo_op_thread_step, .thread_sreset = sbefifo_op_thread_sreset, + .chipop = sbefifo_op_chipop, .ffdc_get = sbefifo_ffdc_get, .fd = -1, };