diff mbox

[02/11] qdev: isabus_dev_info returns a QObject detailing the IRQ lines used by the device.

Message ID 1261862362-2530-3-git-send-email-nathan@parenthephobia.org.uk
State New
Headers show

Commit Message

Nathan Baum Dec. 26, 2009, 9:19 p.m. UTC
Signed-off-by: Nathan Baum <nathan@parenthephobia.org.uk>
---
 hw/isa-bus.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
diff mbox

Patch

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 */