From patchwork Mon Dec 3 03:27:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amitay Isaacs X-Patchwork-Id: 1006639 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 437Vnd6xWrz9s9G for ; Mon, 3 Dec 2018 14:28:21 +1100 (AEDT) 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="vXabNJPg"; 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 437Vnd51NBzDqYP for ; Mon, 3 Dec 2018 14:28:21 +1100 (AEDT) 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="vXabNJPg"; dkim-atps=neutral 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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 437VnP4hV3zDqXt for ; Mon, 3 Dec 2018 14:28:09 +1100 (AEDT) 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="vXabNJPg"; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPSA id 437VnN3cW3z9sCX; Mon, 3 Dec 2018 14:28:08 +1100 (AEDT) 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=1543807688; bh=I/fl/h32mapoCvF1D0JOwqMCb1JtJOcuVCS1lWU8X1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vXabNJPgxOpRpabr7SUytNMHX71W+VG3+Cp6W9yLKxQl4vpY3yKjpFABKTOMkyva6 bDoIt5R3sfaJuw2HHBpWMpKdxKVZZ5L4bFJE+9dw6/wgfixVTiBLzaOzvyTMUPDiH+ gDMPiJeeSdA8uwbHozsvGWXaLlZJKSgfZIbYf+6lHZm0FfcVFCLAFowzG24hoibcdK 0QVEoZ4/EbcLeh54wrrfp8FWieuYGHqjMZsaZ8eIG9xLLA9k2Wl0px9FtCc6nNjAIJ X1ocpKviOhDmwut1cmuOR+3Xi2uSCgX3bxOVXUgv2TIxVmN4wVVHKCd9F5VQwUNEE4 G9j7Bz4ekBu2w== From: Amitay Isaacs To: pdbg@lists.ozlabs.org Date: Mon, 3 Dec 2018 14:27:56 +1100 Message-Id: <20181203032758.1111333-3-amitay@ozlabs.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181203032758.1111333-1-amitay@ozlabs.org> References: <20181203032758.1111333-1-amitay@ozlabs.org> MIME-Version: 1.0 Subject: [Pdbg] [PATCH 2/4] libpdbg: Use index instead of chip-id for id 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 using two different ways to id various chiplets, consistently use "index" property. Signed-off-by: Amitay Isaacs --- libpdbg/host.c | 6 +++--- libpdbg/htm.c | 11 +++++++---- p9-host.dts.m4 | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libpdbg/host.c b/libpdbg/host.c index 1cc1b48..163b991 100644 --- a/libpdbg/host.c +++ b/libpdbg/host.c @@ -85,13 +85,13 @@ static int host_pib_probe(struct pdbg_target *target) struct pib *pib = target_to_pib(target); int *fd; char *access_fn; - uint32_t chip_id; + uint32_t index; fd = malloc(sizeof(fd)); if (!fd) return -1; - chip_id = pdbg_target_chip_id(target); + index = pdbg_target_index(target); /* This check should probably be done earlier */ if (access(XSCOM_BASE_PATH, F_OK) == -1) @@ -101,7 +101,7 @@ static int host_pib_probe(struct pdbg_target *target) PR_ERROR("You may need to re-run the command as root.\n"); } - if (asprintf(&access_fn, "%s/%08x/access", XSCOM_BASE_PATH, chip_id) < 0) + if (asprintf(&access_fn, "%s/%08x/access", XSCOM_BASE_PATH, index) < 0) goto out; *fd = open(access_fn, O_RDWR); diff --git a/libpdbg/htm.c b/libpdbg/htm.c index 1ca176d..dd25b24 100644 --- a/libpdbg/htm.c +++ b/libpdbg/htm.c @@ -548,13 +548,16 @@ static int is_startable(struct htm_status *status) static char *get_debugfs_file(struct htm *htm, const char *file) { - uint32_t chip_id; + struct pdbg_target *pib; + uint32_t index; char *filename; - chip_id = pdbg_target_chip_id(&htm->target); - if (asprintf(&filename, "%s/%08x/%s", DEBUGFS_MEMTRACE, chip_id, file) == -1) { + pib = pdbg_target_parent("pib", &htm->target); + assert(pib); + index = pdbg_target_index(pib); + if (asprintf(&filename, "%s/%08x/%s", DEBUGFS_MEMTRACE, index, file) == -1) { PR_ERROR("Couldn't asprintf() '%s/%08x/size': %m\n", - DEBUGFS_MEMTRACE, chip_id); + DEBUGFS_MEMTRACE, index); return NULL; } diff --git a/p9-host.dts.m4 b/p9-host.dts.m4 index e1ec779..c6f5090 100644 --- a/p9-host.dts.m4 +++ b/p9-host.dts.m4 @@ -21,7 +21,7 @@ compatible = "ibm,host-pib"; reg = <0x8>; chip-id = <0x8>; - index = <0x1>; + index = <0x8>; include(p9-pib.dts.m4)dnl }; };