Patchwork [RFC,v2,01/10] isa: Provide set_state callback

login
register
mail settings
Submitter Andreas Färber
Date June 7, 2011, 3:02 p.m.
Message ID <1307458978-51287-2-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/99262/
State New
Headers show

Comments

Andreas Färber - June 7, 2011, 3:02 p.m.
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 hw/isa-bus.c |    9 +++++++++
 hw/isa.h     |    3 +++
 2 files changed, 12 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 2765543..6f296bd 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -156,6 +156,15 @@  ISADevice *isa_create_simple(const char *name)
     return dev;
 }
 
+void isa_set_state(ISADevice *dev, bool enabled)
+{
+    ISADeviceInfo *info = DO_UPCAST(ISADeviceInfo, qdev, dev->qdev.info);
+
+    if (info->set_state != NULL) {
+        info->set_state(dev, enabled);
+    }
+}
+
 static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent)
 {
     ISADevice *d = DO_UPCAST(ISADevice, qdev, dev);
diff --git a/hw/isa.h b/hw/isa.h
index d2b6126..0e944b9 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -19,9 +19,11 @@  struct ISADevice {
 };
 
 typedef int (*isa_qdev_initfn)(ISADevice *dev);
+typedef void (*isa_qdev_statefn)(ISADevice *dev, bool enabled);
 struct ISADeviceInfo {
     DeviceInfo qdev;
     isa_qdev_initfn init;
+    isa_qdev_statefn set_state;
 };
 
 ISABus *isa_bus_new(DeviceState *dev);
@@ -34,6 +36,7 @@  void isa_qdev_register(ISADeviceInfo *info);
 ISADevice *isa_create(const char *name);
 ISADevice *isa_try_create(const char *name);
 ISADevice *isa_create_simple(const char *name);
+void isa_set_state(ISADevice *dev, bool enabled);
 
 extern target_phys_addr_t isa_mem_base;