From patchwork Wed Nov 7 05:39:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Popple X-Patchwork-Id: 994106 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42qZyj1fNqz9sCX for ; Wed, 7 Nov 2018 16:41:01 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 42qZyg3tPHzF3GD for ; Wed, 7 Nov 2018 16:40:59 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au 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)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 42qZxT0MkjzF3GW for ; Wed, 7 Nov 2018 16:39:57 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au 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 42qZxS5CKcz9s8T; Wed, 7 Nov 2018 16:39:56 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=popple.id.au From: Alistair Popple To: pdbg@lists.ozlabs.org Date: Wed, 7 Nov 2018 16:39:28 +1100 Message-Id: <20181107053943.4307-2-alistair@popple.id.au> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20181107053943.4307-1-alistair@popple.id.au> References: <20181107053943.4307-1-alistair@popple.id.au> Subject: [Pdbg] [PATCH v2 01/16] libpdbg: Add api to get 32-bit device tree property 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@ozlabs.org MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" --- libpdbg/libpdbg.c | 12 ++++++++++++ libpdbg/libpdbg.h | 1 + 2 files changed, 13 insertions(+) diff --git a/libpdbg/libpdbg.c b/libpdbg/libpdbg.c index 810e045..ccaad3e 100644 --- a/libpdbg/libpdbg.c +++ b/libpdbg/libpdbg.c @@ -186,6 +186,18 @@ static int pdbg_get_target_u64_property(struct pdbg_target *target, const char * return 0; } +int pdbg_get_target_u32_property(struct pdbg_target *target, const char *name, uint32_t *val) +{ + struct dt_property *p; + + p = dt_find_property(target, name); + if (!p) + return -1; + + *val = dt_get_number(p->prop, 1); + return 0; +} + int pdbg_get_u64_property(struct pdbg_target *target, const char *name, uint64_t *val) { struct pdbg_target *dn; diff --git a/libpdbg/libpdbg.h b/libpdbg/libpdbg.h index 1977c75..138521c 100644 --- a/libpdbg/libpdbg.h +++ b/libpdbg/libpdbg.h @@ -72,6 +72,7 @@ void pdbg_set_target_property(struct pdbg_target *target, const char *name, cons /* Get the given property and return the size */ void *pdbg_get_target_property(struct pdbg_target *target, const char *name, size_t *size); +int pdbg_get_target_u32_property(struct pdbg_target *target, const char *name, uint32_t *val); int pdbg_get_u64_property(struct pdbg_target *target, const char *name, uint64_t *val); uint64_t pdbg_get_address(struct pdbg_target *target, uint64_t *size);