From patchwork Wed Jul 3 03:46:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126602 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 45dn8q14bXz9s3Z for ; Wed, 3 Jul 2019 13:46:35 +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="idu2kXmj"; 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 45dn8p1kFvzDqS7 for ; Wed, 3 Jul 2019 13:46:34 +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 45dn8g06T9zDqQl for ; Wed, 3 Jul 2019 13:46:27 +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="idu2kXmj"; 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 45dn8f335sz9s8m; Wed, 3 Jul 2019 13:46:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125586; bh=WuPms55qsQOAWpuL4fIYm7gmrUtZRNs7SqC+SI5TPbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=idu2kXmjRjOiGtQ0Ov8my/EOK9qUj22Pj7wVp74cNn8mCIx0msAPPbubzkV9EcWuk zHwMRA2ekn1tKREqTR3olnxDAJtWnA67/ylJqtomfYJB/wlMMWrr9TfAX4mHHxZbpu k+JlvRZnIojPJzEXMx/QHXkTziOccU33ylGftDXGnja5rxleli0ayukxpnZKxg3GNs eFEou58xt02FWAdzV09moWawV6jk9Nylov0FZPmp1Ur3wKBGiH1+U8dvQeEWeSjzVt xJ6r0++/FHKAJU5MqG4f2V/ZmOhmSYii2rIM6EwYYMxtRDMekHv/wK7SZ1sU/DMo// 85lv6WNxlZjUQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:10 +1000 Message-Id: <20190703034619.2410-2-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 01/10] sbefifo: Refactor ffdc parsing code to store ffdc data 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" Instead of dumping ffdc data, store it so an application can query it in case of chip-op failures. FFDC data is stored only for the last chip-op. Signed-off-by: Amitay Isaacs --- libpdbg/hwunit.h | 3 ++ libpdbg/sbefifo.c | 116 +++++++++++++++++++++++++++++++++++----------- 2 files changed, 91 insertions(+), 28 deletions(-) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index b816ae3..0b0c62b 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -71,6 +71,9 @@ struct sbefifo { int (*mem_read)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); int (*mem_write)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); int fd; + uint32_t status; + uint8_t *ffdc; + uint32_t ffdc_len; }; #define target_to_sbefifo(x) container_of(x, struct sbefifo, target) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 284d3d5..a23d0b4 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -69,22 +69,76 @@ static int sbefifo_op_write(struct sbefifo *sbefifo, void *buf, size_t buflen) return 0; } -static int sbefifo_op_ffdc_read(uint8_t *buf, uint32_t buflen) +static void sbefifo_ffdc_clear(struct sbefifo *sbefifo) { - int offset = 0; + sbefifo->status = 0; + if (sbefifo->ffdc) { + free(sbefifo->ffdc); + sbefifo->ffdc = NULL; + sbefifo->ffdc_len = 0; + } +} + +static void sbefifo_ffdc_set(struct sbefifo *sbefifo, uint8_t *buf, uint32_t buflen, uint32_t status) +{ + sbefifo->status = status; + + sbefifo->ffdc = malloc(buflen); + if (!sbefifo->ffdc) { + PR_ERROR("sbefifo: Failed to store FFDC data\n"); + return; + } + + memcpy(sbefifo->ffdc, buf, buflen); + sbefifo->ffdc_len = buflen; +} + +static int sbefifo_ffdc_get_uint32(struct sbefifo *sbefifo, uint32_t offset, uint32_t *value) +{ + uint32_t v; + + if (offset + 4 > sbefifo->ffdc_len) + return -1; + + memcpy(&v, sbefifo->ffdc + offset, 4); + *value = be32toh(v); + + return 0; +} + +static int sbefifo_ffdc_dump_pkg(struct sbefifo *sbefifo, uint32_t offset) +{ + uint32_t offset2 = offset; uint32_t header, value; uint16_t magic, len_words; - int i; + int i, rc; - if (buflen < 4) + rc = sbefifo_ffdc_get_uint32(sbefifo, offset2, &header); + if (rc < 0) return -1; + offset2 += 4; - /* End of ffdc data */ - if (buflen == 4) - return 0; - - header = be32toh(*(uint32_t *)(buf + offset)); - offset += 4; + /* + * FFDC package structure + * + * +----------+----------+----------+----------+ + * | Byte 0 | Byte 1 | Byte 2 | Byte 3 | + * +----------+----------+----------+----------+----------+ + * | word 0 | magic | length in words (N) | + * +----------+---------------------+---------------------+ + * | word 1 | sequence id | command | + * +----------+---------------------+---------------------+ + * | word 2 | return code | + * +----------+-------------------------------------------+ + * | word 3 | FFDC Data - word 0 | + * +----------+-------------------------------------------+ + * | word 4 | FFDC Data - word 1 | + * +----------+-------------------------------------------+ + * | ... | ... | + * +----------+-------------------------------------------+ + * | word N | FFDC Data - word N-3 | + * +----------+----------+----------+----------+----------+ + */ magic = header >> 16; if (magic != 0xffdc) { @@ -93,44 +147,47 @@ static int sbefifo_op_ffdc_read(uint8_t *buf, uint32_t buflen) } len_words = header & 0xffff; - if (offset + len_words * 4 > buflen) - return -1; - value = be32toh(*(uint32_t *)(buf + offset)); - offset += 4; + rc = sbefifo_ffdc_get_uint32(sbefifo, offset2, &value); + if (rc < 0) + return -1; + offset2 += 4; PR_ERROR("FFDC: Sequence = %u\n", value >> 16); PR_ERROR("FFDC: Command = 0x%08x\n", value & 0xffff); - value = be32toh(*(uint32_t *)(buf + offset)); - offset += 4; + rc = sbefifo_ffdc_get_uint32(sbefifo, offset2, &value); + if (rc < 0) + return -1; + offset2 += 4; PR_ERROR("FFDC: RC = 0x%08x\n", value); for (i=0; iffdc_len) { + int n; + + n = sbefifo_ffdc_dump_pkg(sbefifo, offset); + if (n <= 0) break; - offset += rc; + offset += n; } - - return rc; } static int sbefifo_op(struct sbefifo *sbefifo, @@ -144,6 +201,8 @@ static int sbefifo_op(struct sbefifo *sbefifo, uint16_t value; int rc; + sbefifo_ffdc_clear(sbefifo); + assert(msg_len > 0); /* Allocate extra memory for FFDC (SBEFIFO_MAX_FFDC_SIZE = 0x2000) */ @@ -200,7 +259,8 @@ static int sbefifo_op(struct sbefifo *sbefifo, return 0; } else { PR_ERROR("sbefifo: Operation failed, response=0x%08x\n", resp[1]); - sbefifo_op_ffdc(buf + offset, buflen - offset); + sbefifo_ffdc_set(sbefifo, buf + offset, buflen - offset - 4, resp[1]); + sbefifo_ffdc_dump(sbefifo); } fail: From patchwork Wed Jul 3 03:46:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126601 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.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 45dn8l2pTQz9s4V for ; Wed, 3 Jul 2019 13:46:31 +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="UUMWRiPI"; 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 45dn8l1xzFzDqRr for ; Wed, 3 Jul 2019 13:46:31 +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 45dn8g2bqszDqRR for ; Wed, 3 Jul 2019 13:46:27 +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="UUMWRiPI"; 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 45dn8f6jrbz9sBp; Wed, 3 Jul 2019 13:46:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125586; bh=SrKkk+w9jyCNNDg7A3lOc3Ri6MVwFIbaMfAXfjQkl/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UUMWRiPI2x52Ci49KUI7wKa3klVK0x2LcAMXFv0k8PhZ4agPaHJW6DKYBbBZZTHoW 2iH8yUi5TzMqUQWWYBW4K33UHaRoShwrZl7MYHw2JLFd0WiUO6mSLT3qfn7YVUb+a0 tdzLaoVOg7ldDnYJBrxlFlg1i8GXE5cxUNnanLwCHD39g/fdpwLDGKHImLwTUgDJ9i XKvhATpLotjSuV7MBwG2kRGoh+AKROSjyTRaIrQI9DaKmmL6RCwOIUMV61QEfTpgUR z40O3mGDYs9RvohKDqefi2MGESufdxhk+ahWym3DONbmzitPJB7TwQCrk67yQ2HEG2 UuBbFFa4MrFjA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:11 +1000 Message-Id: <20190703034619.2410-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 02/10] sbefifo: Add sbefifo procedure to get ffdc data 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 | 2 ++ libpdbg/sbefifo.c | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index 0b0c62b..cc94c6d 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -70,6 +70,8 @@ struct sbefifo { int (*istep)(struct sbefifo *, uint32_t major, uint32_t minor); int (*mem_read)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); int (*mem_write)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); + uint32_t (*ffdc_get)(struct sbefifo *, const uint8_t **, uint32_t *); + void (*ffdc_dump)(struct sbefifo *); int fd; uint32_t status; uint8_t *ffdc; diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index a23d0b4..c48af44 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -175,6 +175,14 @@ static int sbefifo_ffdc_dump_pkg(struct sbefifo *sbefifo, uint32_t offset) return offset2 - offset; } +static uint32_t sbefifo_ffdc_get(struct sbefifo *sbefifo, const uint8_t **ffdc, uint32_t *ffdc_len) +{ + *ffdc = sbefifo->ffdc; + *ffdc_len = sbefifo->ffdc_len; + + return sbefifo->status; +} + static void sbefifo_ffdc_dump(struct sbefifo *sbefifo) { uint32_t offset = 0; @@ -440,6 +448,8 @@ struct sbefifo kernel_sbefifo = { .istep = sbefifo_op_istep, .mem_read = sbefifo_op_getmem, .mem_write = sbefifo_op_putmem, + .ffdc_get = sbefifo_ffdc_get, + .ffdc_dump = sbefifo_ffdc_dump, .fd = -1, }; DECLARE_HW_UNIT(kernel_sbefifo); From patchwork Wed Jul 3 03:46:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126604 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.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 45dn8y2pQtz9s3Z for ; Wed, 3 Jul 2019 13:46:42 +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="S2xZUExY"; 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 45dn8y1lbxzDqS6 for ; Wed, 3 Jul 2019 13:46:42 +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 45dn8g4LNzzDqRW for ; Wed, 3 Jul 2019 13:46:27 +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="S2xZUExY"; 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 45dn8g25hmz9sLt; Wed, 3 Jul 2019 13:46:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125587; bh=tMM310Bcw+nqXdVkZ+iBcUjkYjw5APuBzLjCZx5jR6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S2xZUExY4zTWi37RNRwjdezF1BqscdDxYemwuCdNaN/UroJLFr7KpmoFcl5lr9JZS oxCsR6PVD8e+IpzPd3jXd6TyadPacmJF4ssd7XHwd3iEf0f2b2d6al9g4kmJOy3oIV WhvrM8Kge2raRdWbhTe/J1NQUeQunJ1wRiXUNoUxvB+ZyIV21ScXf2AZiZc2WAOteY wiCYHH4bgq0mlOQO0FdW1Y5KU9KUd1BGKby8t1f3czrWcOLpZ+JK7GM/7zdez3QpIS fKSc+G304XF3cYQFpaKtOhJrAu4vuDUX0Qf76quceAQk7MHs/CPPd7kcVCXbxz/C+9 GjcZpRATCh0Qg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:12 +1000 Message-Id: <20190703034619.2410-4-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 03/10] libpdbg: Add api to get/dump ffdc data from sbefifo 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/libpdbg.h | 2 ++ libpdbg/target.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 14a41ab..8a6640e 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -230,6 +230,8 @@ int opb_read(struct pdbg_target *target, uint32_t addr, uint32_t *data); int opb_write(struct pdbg_target *target, uint32_t addr, uint32_t data); int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor); +uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len); +void sbe_ffdc_dump(struct pdbg_target *target); typedef void (*pdbg_progress_tick_t)(uint64_t cur, uint64_t end); diff --git a/libpdbg/target.c b/libpdbg/target.c index 066f616..6508c14 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -274,6 +274,26 @@ int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor) return sbefifo->istep(sbefifo, major, minor); } +uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len) +{ + struct sbefifo *sbefifo; + + assert(pdbg_target_is_class(target, "sbefifo")); + + sbefifo = target_to_sbefifo(target); + return sbefifo->ffdc_get(sbefifo, ffdc, ffdc_len); +} + +void sbe_ffdc_dump(struct pdbg_target *target) +{ + struct sbefifo *sbefifo; + + assert(pdbg_target_is_class(target, "sbefifo")); + + sbefifo = target_to_sbefifo(target); + sbefifo->ffdc_dump(sbefifo); +} + struct pdbg_target *require_target_parent(struct pdbg_target *target) { assert(target->parent); From patchwork Wed Jul 3 03:46:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126605 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 45dn9128Fkz9sBp for ; Wed, 3 Jul 2019 13:46:45 +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="PPa372fj"; 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 45dn906ZvZzDqRR for ; Wed, 3 Jul 2019 13:46:44 +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 45dn8g64QdzDqQl for ; Wed, 3 Jul 2019 13:46:27 +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="PPa372fj"; 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 45dn8g43Hqz9sN4; Wed, 3 Jul 2019 13:46:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125587; bh=oMnU3Z0QzVWvFX9k8n91lpLyoyGjn4E0n6Io7psYFjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PPa372fjAzs0dwsgcFR606Fb7gu5nzBG9D+0wpgmja7pAPykI8ycefME/RO/F09Of DcGaA9VW3qYycAn8UmBGlOhKtH2Eo3xFIcpp5r96Paerfx4vd8qK79waWKuRhuBzf7 OSpYdpC3QJdQkEPscZD6Uj+sQc8nygMYUpbIle3zGptcsScmutQczJ5o7J6h2D3uKO SQpz772fUNASy0RjMe0JwerwOb5xlawuAGSJKhW76D6h504HecnlwRHU68Dd8jDUhb kf2LA3Ubdztk+aT/9Sox88QdQfnjYKCqex6VgzlYjQwxVUkpZsQde2vKj02FOry5Y6 gFdq0psHy9RTQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:13 +1000 Message-Id: <20190703034619.2410-5-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 04/10] sbefifo: Do not dump FFDC data on chip-op failure 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" Application can decide to either dump the data or query it. Signed-off-by: Amitay Isaacs --- libpdbg/sbefifo.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index c48af44..9ca92f7 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -268,7 +268,6 @@ static int sbefifo_op(struct sbefifo *sbefifo, } else { PR_ERROR("sbefifo: Operation failed, response=0x%08x\n", resp[1]); sbefifo_ffdc_set(sbefifo, buf + offset, buflen - offset - 4, resp[1]); - sbefifo_ffdc_dump(sbefifo); } fail: From patchwork Wed Jul 3 03:46:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126606 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 45dn950RbQz9s3Z for ; Wed, 3 Jul 2019 13:46:49 +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="dOuvpOiU"; 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 45dn945gDWzDqS6 for ; Wed, 3 Jul 2019 13:46:48 +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 45dn8h0ZwszDqP9 for ; Wed, 3 Jul 2019 13:46:28 +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="dOuvpOiU"; 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 45dn8g5n3pz9s3Z; Wed, 3 Jul 2019 13:46:27 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125587; bh=s7+mkzPBM35ZD8XQeZHz17qz6LXSH/kDH5LGTILAyaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dOuvpOiUJk8heQdMgGrpvWwt+RRxAaRm5UPCdp9HgLJSspxygmNiL7oNbbUGsA2l+ lVi1+O7S90vThwq1quC85r3EKL83bAdS7rfwxSGthYoWi2qZl2LTrvd0b0gyxGKQku CPCRBExHAiZGSl7JhVPSoMJt5jq7+vnMLxtOWL99lfEgVGwmsjon3xsFJNXbVbyawn YoGcgG20XHDuXh4tLshvB1QCAqwkKjrklTKT2M4ZJilrAkOWXOYtqMpk1OEH9IRKFh bZaThjS8tTFGhfxAoqeOIRC++8EJgzFt9DdbqEUGBL5GKfebdDIOuDVSEdE5MWidC1 SWh84V3CtSvpg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:14 +1000 Message-Id: <20190703034619.2410-6-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 05/10] mem: Dump ffdc data if memory operations fail 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 --- src/mem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/mem.c b/src/mem.c index 0b8ad7e..b3e6b4f 100644 --- a/src/mem.c +++ b/src/mem.c @@ -105,6 +105,9 @@ static int _getmem(uint64_t addr, uint64_t size, uint8_t block_size, bool ci, bo progress_end(); if (rc) { PR_ERROR("Unable to read memory using sbefifo\n"); + if (rc == 1) + sbe_ffdc_dump(target); + continue; } @@ -198,6 +201,9 @@ static int _putmem(uint64_t addr, uint8_t block_size, bool ci) progress_end(); if (rc) { printf("Unable to write memory using sbefifo\n"); + if (rc == 1) + sbe_ffdc_dump(target); + continue; } From patchwork Wed Jul 3 03:46:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126607 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.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 45dn973fqzz9s4V for ; Wed, 3 Jul 2019 13:46:51 +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="SH1k1HLS"; 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 45dn971T7BzDqS6 for ; Wed, 3 Jul 2019 13:46:51 +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 45dn8h2lMkzDqQl for ; Wed, 3 Jul 2019 13:46:28 +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="SH1k1HLS"; 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 45dn8h0GYmz9s4V; Wed, 3 Jul 2019 13:46:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125588; bh=ksVn9coZuSYRBSBx8Bghpej2EGgPuN83aJQHQnBzdIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SH1k1HLSwfyp3fnrlIxZ/R6XSYpnoQ4S1aSL3c2NyR4X378UQ8ZnsAzMhtSedtIE1 YN8rbg98PnehlGDmPvbfNlUjmdhLlmH5tx8NVBx/k7MhDJ6KG+i9dxQd/3mSUeep0k SfZf7z+DjeZq20TvmjjveOeGafNeIhVGXSK/U/cdMpsiiuqBVhGqHEDBs20AJaYGBH qognFV5J8u430sexQzPtitVN5lk8ICysGATDzB1g+wB+DH9i+fh6UCepNfbtt0t2Mk DHOQeLSJgoJg0xdnXmEqEdsR8nEyoz53E9wYaVQkq62ahtein8ieHl7MmcD4kJ1qxG h3PVNl1wiQmqA== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:15 +1000 Message-Id: <20190703034619.2410-7-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 06/10] sbefifo: Return only the response data from sbefifo_op 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" Instead of returning the entire response buffer, extract the response data and status. To differentiate between the chip-op failure and other failures, return 1 from sbefifo_op() if chip-op completes but does not succeed. Signed-off-by: Amitay Isaacs --- libpdbg/sbefifo.c | 74 ++++++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 9ca92f7..54dc90d 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -199,8 +199,8 @@ static void sbefifo_ffdc_dump(struct sbefifo *sbefifo) } static int sbefifo_op(struct sbefifo *sbefifo, - uint32_t *msg, size_t msg_len, uint16_t cmd, - size_t out_len, uint8_t **out) + uint32_t *msg, uint32_t msg_len, uint16_t cmd, + uint8_t **out, uint32_t *out_len, uint32_t *status) { uint8_t *buf; uint32_t resp[2]; @@ -214,7 +214,7 @@ static int sbefifo_op(struct sbefifo *sbefifo, assert(msg_len > 0); /* Allocate extra memory for FFDC (SBEFIFO_MAX_FFDC_SIZE = 0x2000) */ - buflen = out_len + 0x2000; + buflen = 0x2000; buf = malloc(buflen); assert(buf); @@ -231,8 +231,7 @@ static int sbefifo_op(struct sbefifo *sbefifo, * header word, status word, header offset word */ if (buflen < 3 * 4) { - PR_ERROR("sbefifo: Short read, expected %zu, got %zu\n", - out_len + 3 * 4, buflen); + PR_ERROR("sbefifo: Short read, got %zu\n", buflen); sbefifo_op_dump("DATA:", buf, buflen); goto fail; } @@ -241,6 +240,7 @@ static int sbefifo_op(struct sbefifo *sbefifo, PR_INFO("sbefifo: status header word offset = %u\n", word_offset); offset = buflen - (word_offset * 4); + *out_len = offset; resp[0] = be32toh(*(uint32_t *)(buf + offset)); offset += 4; @@ -262,14 +262,26 @@ static int sbefifo_op(struct sbefifo *sbefifo, goto fail; } - if (resp[1] == 0) { - *out = buf; - return 0; - } else { + *status = resp[1]; + if (resp[1] != 0) { PR_ERROR("sbefifo: Operation failed, response=0x%08x\n", resp[1]); sbefifo_ffdc_set(sbefifo, buf + offset, buflen - offset - 4, resp[1]); + free(buf); + return 1; + } + + if (*out_len > 0) { + *out = malloc(*out_len); + assert(*out); + + memcpy(*out, buf, *out_len); + } else { + *out = NULL; } + free(buf); + return 0; + fail: free(buf); return -1; @@ -280,7 +292,7 @@ static int sbefifo_op_istep(struct sbefifo *sbefifo, { uint8_t *out; uint32_t msg[3]; - uint32_t cmd, step; + uint32_t cmd, step, out_len, status; int rc; PR_NOTICE("sbefifo: istep %u.%u\n", major, minor); @@ -292,12 +304,10 @@ static int sbefifo_op_istep(struct sbefifo *sbefifo, msg[1] = htobe32(cmd); msg[2] = htobe32(step); - /* Return - data read + length of data read */ - rc = sbefifo_op(sbefifo, msg, sizeof(msg), cmd, 0, &out); + rc = sbefifo_op(sbefifo, msg, sizeof(msg), cmd, &out, &out_len, &status); if (rc) return rc; - free(out); return 0; } @@ -307,9 +317,9 @@ static int sbefifo_op_getmem(struct sbefifo *sbefifo, { uint8_t *out; uint64_t start_addr, end_addr; - uint32_t align, offset, len; + uint32_t align, offset, len, out_len, status; uint32_t msg[6]; - uint32_t cmd, flags, count; + uint32_t cmd, flags; int rc; align = ci ? 8 : 128; @@ -338,22 +348,22 @@ static int sbefifo_op_getmem(struct sbefifo *sbefifo, msg[4] = htobe32(start_addr & 0xffffffff); msg[5] = htobe32(len); - /* Return - data read + length of data read */ - rc = sbefifo_op(sbefifo, msg, sizeof(msg), cmd, len+4, &out); + rc = sbefifo_op(sbefifo, msg, sizeof(msg), cmd, &out, &out_len, &status); if (rc) return rc; - memcpy(data, out+offset, size); - count = htobe32(*(uint32_t *)&out[len]); - free(out); - - pdbg_progress_tick(count, len); + pdbg_progress_tick(len + 4, out_len); - if (count != len) { - PR_ERROR("sbefifo: getmem read %u bytes of %u\n", count, len); + if (out_len != size + 4) { + PR_ERROR("sbefifo: getmem error got %u, expected %"PRIu64"\n", out_len, size + 4); + if (out_len > 0) + free(out); return -1; } + memcpy(data, out+offset, size); + free(out); + return 0; } @@ -363,7 +373,7 @@ static int sbefifo_op_putmem(struct sbefifo *sbefifo, { uint8_t *out; uint32_t *msg; - uint32_t align, len, msg_len; + uint32_t align, len, msg_len, out_len, status; uint32_t cmd, flags, count; int rc; @@ -402,16 +412,22 @@ static int sbefifo_op_putmem(struct sbefifo *sbefifo, msg[5] = htobe32(len); memcpy(&msg[6], data, len); - /* Return - length of data written */ - rc = sbefifo_op(sbefifo, msg, msg_len, cmd, 0, &out); + rc = sbefifo_op(sbefifo, msg, msg_len, cmd, &out, &out_len, &status); if (rc) return rc; + pdbg_progress_tick(len + 4, out_len); + + if (out_len != 4) { + PR_ERROR("sbefifo: putmem error got %u, expected 4\n", out_len); + if (out_len > 0) + free(out); + return -1; + } + count = be32toh(*(uint32_t *)out); free(out); - pdbg_progress_tick(count, len); - if (count != len) { PR_ERROR("sbefifo: putmem wrote %u bytes of %u\n", count, len); return -1; From patchwork Wed Jul 3 03:46:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126608 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.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 45dn9B6sx2z9s4V for ; Wed, 3 Jul 2019 13:46:54 +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="oJrodhRO"; 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 45dn9B00pmzDqRr for ; Wed, 3 Jul 2019 13:46:54 +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 45dn8h4fZMzDqP9 for ; Wed, 3 Jul 2019 13:46:28 +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="oJrodhRO"; 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 45dn8h2Q0zz9s8m; Wed, 3 Jul 2019 13:46:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125588; bh=G68eXtvT4oRlEZMLg692YMz80BarBJREeOuPKjA72X8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oJrodhRO0VueC5SFWeUhd4INwPhQRc7O82SZKQ8fN9BEw1Fr3kxX0oyhDfNmNJFCA LP+YoA/nYky6lzQ+XK2EbG9oNO2sK1jRHKoHxK79ISmUN/GRjzSVUGs/nNL0XIeq3n 2Z/H1+hA/NZGybCMc5Vx2cYQ9VvipUvppHMJS9npk7yJyJO24UK7OXT7yk7L8R/YBA O+B7GnRziT3QwiZbk2MjEcKp/tphY2QiJ3LPCRKvvSRn4XPGAoqxiGc0OBXaoW/cjW 2cWT8Xzqz8F/PRi9DJ5h7nndlCK9kbSnjXmgjDEcPFkKBZD6L8CKzShENyrudC0MjE u26JAA4eftAPw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:16 +1000 Message-Id: <20190703034619.2410-8-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 07/10] sbefifo: Add hardware procedeure for thread control 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 | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index cc94c6d..497e5d7 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -70,6 +70,7 @@ struct sbefifo { int (*istep)(struct sbefifo *, uint32_t major, uint32_t minor); int (*mem_read)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); int (*mem_write)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); + int (*control)(struct sbefifo *, uint32_t core_id, uint32_t thread_id, uint32_t oper); uint32_t (*ffdc_get)(struct sbefifo *, const uint8_t **, uint32_t *); void (*ffdc_dump)(struct sbefifo *); int fd; diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 54dc90d..42b33ef 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -436,6 +436,40 @@ static int sbefifo_op_putmem(struct sbefifo *sbefifo, return 0; } +/** + * operation = 0x0 start + * 0x1 stop + * 0x2 step + * 0x3 sreset + */ +static int sbefifo_op_control(struct sbefifo *sbefifo, + uint32_t core_id, uint32_t thread_id, + uint32_t oper) +{ + uint8_t *out; + uint32_t msg[3]; + uint32_t cmd, op, out_len, status; + int rc; + + PR_NOTICE("sbefifo: control c:0x%x, t=%u\n, op=%u\n", core_id, thread_id, oper); + + op = ((core_id & 0xff) << 8) | ((thread_id & 0x0f) << 4) | (oper & 0x0f); + cmd = 0xa701; + + msg[0] = htobe32(3); // number of words + msg[1] = htobe32(cmd); + msg[2] = htobe32(op); + + rc = sbefifo_op(sbefifo, msg, sizeof(msg), cmd, &out, &out_len, &status); + if (rc) + return rc; + + if (out_len > 0) + free(out); + + return 0; +} + static int sbefifo_probe(struct pdbg_target *target) { struct sbefifo *sf = target_to_sbefifo(target); @@ -463,6 +497,7 @@ struct sbefifo kernel_sbefifo = { .istep = sbefifo_op_istep, .mem_read = sbefifo_op_getmem, .mem_write = sbefifo_op_putmem, + .control = sbefifo_op_control, .ffdc_get = sbefifo_ffdc_get, .ffdc_dump = sbefifo_ffdc_dump, .fd = -1, From patchwork Wed Jul 3 03:46:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126609 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 45dn9G2c9Jz9s4V for ; Wed, 3 Jul 2019 13:46:58 +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="Hq4Dre2q"; 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 45dn9G1LKFzDqRt for ; Wed, 3 Jul 2019 13:46:58 +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 45dn8h6rV7zDqQl for ; Wed, 3 Jul 2019 13:46:28 +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="Hq4Dre2q"; 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 45dn8h4Gtgz9s3Z; Wed, 3 Jul 2019 13:46:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125588; bh=HPM1A9R/yig/kEfSQYLiCL3yELYHEs+imgW3gtPlYMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hq4Dre2q+nUwEMz4oKXDI1d4HWpGc9TFxCbropIGW7/6VVf0LEUAskwgVXA+sgPEO dHkBEE85VEh2L7o8b67CkCSRjgvCxvUBi3gwm77D3/yUD5ufCZMtlZL1Aq76IVq0Tz j37gvg2TMA6CxdPkWRD7s1H6g0rygBTopHZKNycwhMV+uFYWVTGvqrV1hBVakvj4o1 GCdyL3NCyR6CJxFUoG3L91lNcO3oVtO9tFM6MpqYFgxwBqc/IX7wg6VqBZy0k7WdFx DiJ8h2NdxwoFSq1BfVXjZFvyCx9JCfg6s+fR7R5yweP6JN2NdoXqEc2hT+rHZTCOZ9 VayPr3iDIcYLQ== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:17 +1000 Message-Id: <20190703034619.2410-9-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 08/10] libpdbg: Add api to control threads via sbefifo 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/libpdbg.h | 4 ++++ libpdbg/target.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 8a6640e..a8deb34 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -230,6 +230,10 @@ int opb_read(struct pdbg_target *target, uint32_t addr, uint32_t *data); int opb_write(struct pdbg_target *target, uint32_t addr, uint32_t data); int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor); +int sbe_thread_start(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id); +int sbe_thread_stop(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id); +int sbe_thread_step(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id); +int sbe_thread_sreset(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id); uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len); void sbe_ffdc_dump(struct pdbg_target *target); diff --git a/libpdbg/target.c b/libpdbg/target.c index 6508c14..18e492c 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -274,6 +274,37 @@ int sbe_istep(struct pdbg_target *target, uint32_t major, uint32_t minor) return sbefifo->istep(sbefifo, major, minor); } +static int sbe_thread_control(struct pdbg_target *target, + uint32_t core_id, uint32_t thread_id, uint32_t oper) +{ + struct sbefifo *sbefifo; + + assert(pdbg_target_is_class(target, "sbefifo")); + + sbefifo = target_to_sbefifo(target); + return sbefifo->control(sbefifo, core_id, thread_id, oper); +} + +int sbe_thread_start(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id) +{ + return sbe_thread_control(target, core_id, thread_id, 0); +} + +int sbe_thread_stop(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id) +{ + return sbe_thread_control(target, core_id, thread_id, 1); +} + +int sbe_thread_step(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id) +{ + return sbe_thread_control(target, core_id, thread_id, 2); +} + +int sbe_thread_sreset(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id) +{ + return sbe_thread_control(target, core_id, thread_id, 3); +} + uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len) { struct sbefifo *sbefifo; From patchwork Wed Jul 3 03:46:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126610 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 45dn9J5mVwz9s8m for ; Wed, 3 Jul 2019 13:47:00 +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="u4XLVsyZ"; 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 45dn9J2myWzDqRX for ; Wed, 3 Jul 2019 13:47:00 +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 45dn8j2Y6PzDqRR for ; Wed, 3 Jul 2019 13:46:29 +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="u4XLVsyZ"; 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 45dn8h6V4tz9s4V; Wed, 3 Jul 2019 13:46:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125588; bh=LbqEpD9tl1V3d9Pmayofa20Wl4B8Pd65gWGrVS/5wHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4XLVsyZyymPtVfni+K6TtEvouKYNyo4GwKISmhkFp7KIj9AlGx+nMHxp0fWSOwdk 9mb1h8W3EgpTfCYQBViBPy3V6Ym0DUNDs461o1VVGEXiVVql8pPl3KXGkqC/vJgDSt JSaWEGunSIxN6Gw5PWCT8dBanIZN88nccjdYYSYT6GGpoL8MxTVBar47d3zsGU0I8T l6SidNE8UpjbN1m6hOp70HwnCMbyzAGNcR9KVsvdSwANXNwYmh8hcH3zRrunFbb15o MpnCWnU1SOYZCN6JJ0muZEDF9zc0pM7YgfAhd77ek7VCWbVx5QE9mGa2O+bJugB2vH aPG4XgCkonumw== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:18 +1000 Message-Id: <20190703034619.2410-10-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 09/10] 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 | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/libpdbg/hwunit.h b/libpdbg/hwunit.h index 497e5d7..19b8a5c 100644 --- a/libpdbg/hwunit.h +++ b/libpdbg/hwunit.h @@ -71,6 +71,7 @@ struct sbefifo { int (*mem_read)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); int (*mem_write)(struct sbefifo *, uint64_t, uint8_t *, uint64_t, bool); int (*control)(struct sbefifo *, uint32_t core_id, uint32_t thread_id, uint32_t oper); + int (*custom)(struct sbefifo *, uint32_t *, uint32_t, uint8_t **, uint32_t *, uint32_t *); uint32_t (*ffdc_get)(struct sbefifo *, const uint8_t **, uint32_t *); void (*ffdc_dump)(struct sbefifo *); int fd; diff --git a/libpdbg/sbefifo.c b/libpdbg/sbefifo.c index 42b33ef..efb1cc9 100644 --- a/libpdbg/sbefifo.c +++ b/libpdbg/sbefifo.c @@ -470,6 +470,34 @@ static int sbefifo_op_control(struct sbefifo *sbefifo, return 0; } +static int sbefifo_op_custom(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: custom command=%u, op=%u\n", cmd, op); + + if (len != msg_len) { + PR_ERROR("sbefifo: custom: Invalid msg length, expected %u, got %u\n", + len, msg_len); + return -1; + } + + 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); @@ -498,6 +526,7 @@ struct sbefifo kernel_sbefifo = { .mem_read = sbefifo_op_getmem, .mem_write = sbefifo_op_putmem, .control = sbefifo_op_control, + .custom = sbefifo_op_custom, .ffdc_get = sbefifo_ffdc_get, .ffdc_dump = sbefifo_ffdc_dump, .fd = -1, From patchwork Wed Jul 3 03:46:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1126611 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 45dn9M4w1yz9s8m for ; Wed, 3 Jul 2019 13:47:03 +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="lRVLF6z+"; 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 45dn9M2vZyzDqRZ for ; Wed, 3 Jul 2019 13:47:03 +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 45dn8j4bZfzDqP9 for ; Wed, 3 Jul 2019 13:46:29 +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="lRVLF6z+"; 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 45dn8j2Lhrz9s8m; Wed, 3 Jul 2019 13:46:29 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ozlabs.org; s=201707; t=1562125589; bh=/W8moJNvMJv9sK44/AmINn7BEb/rh6w9H6YlZ6gZVRo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lRVLF6z+FrnXEHbhD0AlaaRwkxn815Mz3YKeENrQoLf/8p/ehiaB41eB1E7Ll78jl Raj5vo0ylo98LIfnPiJHysmH+KG4leFN0F76V34ZPGLIfuHhsClZuxhhLWabBJKqxL lZuJrDVUCNwnnNSbM/bLA/OVKUVFhcyqV3x1sU9Gv71oQuCDL1Vxy6Gx0+tOJzhvWG rLLRhK6horyQ8o4ERkfCe/Udja4SHAqKBHrDlQDDmgRECRLKN3Rz4uHAFiFIrebLes a7cUtHWuIZvlq87w4ZOjqYPzbMoau5bNtu3Xl30nLmFk7SheJFfSKrkm3PDkY0K+dk NklDDy4/q6Jcg== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Wed, 3 Jul 2019 13:46:19 +1000 Message-Id: <20190703034619.2410-11-amitay@ozlabs.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703034619.2410-1-amitay@ozlabs.org> References: <20190703034619.2410-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 10/10] libpdbg: Add api for custom sbe chip-op 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/libpdbg.h | 1 + libpdbg/target.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index a8deb34..03a77a3 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -234,6 +234,7 @@ int sbe_thread_start(struct pdbg_target *target, uint32_t core_id, uint32_t thre int sbe_thread_stop(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id); int sbe_thread_step(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id); int sbe_thread_sreset(struct pdbg_target *target, uint32_t core_id, uint32_t thread_id); +int sbe_custom(struct pdbg_target *target, uint32_t *msg, uint32_t msg_len, uint8_t **out, uint32_t *out_len, uint32_t *status); uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len); void sbe_ffdc_dump(struct pdbg_target *target); diff --git a/libpdbg/target.c b/libpdbg/target.c index 18e492c..cf6bcdd 100644 --- a/libpdbg/target.c +++ b/libpdbg/target.c @@ -305,6 +305,16 @@ int sbe_thread_sreset(struct pdbg_target *target, uint32_t core_id, uint32_t thr return sbe_thread_control(target, core_id, thread_id, 3); } +int sbe_custom(struct pdbg_target *target, uint32_t *msg, uint32_t msg_len, uint8_t **out, uint32_t *out_len, uint32_t *status) +{ + struct sbefifo *sbefifo; + + assert(pdbg_target_is_class(target, "sbefifo")); + + sbefifo = target_to_sbefifo(target); + return sbefifo->custom(sbefifo, msg, msg_len, out, out_len, status); +} + uint32_t sbe_ffdc_get(struct pdbg_target *target, const uint8_t **ffdc, uint32_t *ffdc_len) { struct sbefifo *sbefifo;