Am 09.06.2011 um 16:53 schrieb Markus Armbruster:
Andreas Färber <andreas.faer...@web.de> writes:
To allow enabling/disabling present ISA devices without hotplug,
keep track of state and add a helper to avoid enabling twice.
Since the properties to be configured are defined at device level,
delegate the actual work to a callback function.
If no callback is supplied, the device can't be disabled.
Prepare VMSTATE_ISA_DEVICE for devices that support disabling.
Legacy devices never change their state and won't need this yet.
Cc: Gerd Hoffmann <kra...@redhat.com>
Signed-off-by: Andreas Färber <andreas.faer...@web.de>
---
hw/hw.h | 15 +++++++++++++++
hw/isa-bus.c | 29 +++++++++++++++++++++++++++++
hw/isa.h | 4 ++++
3 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 2765543..d258932 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
+int isa_set_state(ISADevice *dev, bool enabled)
+{
+ ISADeviceInfo *info = DO_UPCAST(ISADeviceInfo, qdev, dev-
>qdev.info);
+ int err;
+
+ if (dev->enabled == enabled) {
+ return 42;
Sorry, too clever. Make it return 0 for the benefit of future
maintenance programmers.
Done.