From patchwork Sat Dec 26 21:11:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Baum X-Patchwork-Id: 41836 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B4876B7BFF for ; Sun, 27 Dec 2009 08:57:13 +1100 (EST) Received: from localhost ([127.0.0.1]:43064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NOedK-0001Y5-Um for incoming@patchwork.ozlabs.org; Sat, 26 Dec 2009 16:57:11 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NOe3E-0004Kx-RO for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NOe33-0004EN-Up for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:47 -0500 Received: from [199.232.76.173] (port=43628 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NOe32-0004EE-N0 for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:40 -0500 Received: from smarthost.c4l.co.uk ([82.197.83.77]:53798) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NOe32-0005FB-AW for qemu-devel@nongnu.org; Sat, 26 Dec 2009 16:19:40 -0500 Received: from [93.97.162.229] (helo=mx.parenthephobia.org.uk) by smarthost.c4l.co.uk with esmtp (Exim 4.69) (envelope-from ) id 1NOe2x-0007ub-3n for qemu-devel@nongnu.org; Sat, 26 Dec 2009 21:19:36 +0000 Received: from athens (93-97-162-231.zone5.bethere.co.uk [93.97.162.231]) by mx.parenthephobia.org.uk (Postfix) with ESMTP id 6A3F6536F0 for ; Sat, 26 Dec 2009 21:26:54 +0000 (GMT) Received: by athens (Postfix, from userid 1000) id EC4825EAAE; Sat, 26 Dec 2009 21:11:41 +0000 (GMT) From: Nathan Baum To: qemu-devel@nongnu.org Date: Sat, 26 Dec 2009 21:11:34 +0000 Message-Id: <1261861899-1984-7-git-send-email-nathan@parenthephobia.org.uk> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1261861899-1984-1-git-send-email-nathan@parenthephobia.org.uk> References: <1261861899-1984-1-git-send-email-nathan@parenthephobia.org.uk> X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [RFC,PATCH 06/11] qdev: sysbus_dev_info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Returns information about the system bus as a QObject. Signed-off-by: Nathan Baum --- hw/sysbus.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/hw/sysbus.c b/hw/sysbus.c index 1f7f138..2092d9f 100644 --- a/hw/sysbus.c +++ b/hw/sysbus.c @@ -20,6 +20,7 @@ #include "sysbus.h" #include "sysemu.h" #include "monitor.h" +#include "qjson.h" static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent); @@ -170,3 +171,20 @@ static void sysbus_dev_print(Monitor *mon, DeviceState *dev, int indent) indent, "", s->mmio[i].addr, s->mmio[i].size); } } + +static QObject *sysbus_dev_info(Monitor *mon, DeviceState *dev) +{ + SysBusDevice *s = sysbus_from_qdev(dev); + QDict *dict = qdict_new(); + QList *list = qlist_new(); + int i; + + for (i = 0; i < s->num_mmio; i++) { + qlist_append_obj(list, qobject_from_jsonf("{ 'addr': " TARGET_FMT_plx ", 'size': " TARGET_FMT_plx " }", + s->mmio[i].addr, s->mmio[i].size)); + } + + qdict_put(dict, "mmio", list); + return (QObject *) dict; + +}