qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC, PATCH 02/11] qdev: isabus_dev_info returns a QObject


From: Nathan Baum
Subject: [Qemu-devel] [RFC, PATCH 02/11] qdev: isabus_dev_info returns a QObject detailing the IRQ lines used by the device.
Date: Sat, 26 Dec 2009 21:11:30 +0000

Signed-off-by: Nathan Baum <address@hidden>
---
 hw/isa-bus.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 4d489d2..b3d599f 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -21,6 +21,8 @@
 #include "monitor.h"
 #include "sysbus.h"
 #include "isa.h"
+#include "qjson.h"
+#include "qint.h"
 
 struct ISABus {
     BusState qbus;
@@ -143,6 +145,21 @@ static void isabus_dev_print(Monitor *mon, DeviceState 
*dev, int indent)
     }
 }
 
+static QObject *isabus_dev_info(Monitor *mon, DeviceState *dev)
+{
+    ISADevice *d = DO_UPCAST(ISADevice, qdev, dev);
+    
+    if (d->isairq[1] != -1) {
+        return qobject_from_jsonf("{'irq':[%d,%d]}",
+                                  d->isairq[0], d->isairq[1]);
+    } else if (d->isairq[0] != -1) {
+        return qobject_from_jsonf("{'irq':[%d]}",
+                                  d->isairq[0]);
+    } else {
+        return qobject_from_jsonf("{'irq':[]}");
+    }
+}
+
 static int isabus_bridge_init(SysBusDevice *dev)
 {
     /* nothing */
-- 
1.6.3.3





reply via email to

[Prev in Thread] Current Thread [Next in Thread]