[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 25/29] ide: add qom property for isa-ide state
From: |
Michael Roth |
Subject: |
[Qemu-devel] [PATCH 25/29] ide: add qom property for isa-ide state |
Date: |
Thu, 1 Nov 2012 08:04:27 -0500 |
Signed-off-by: Michael Roth <address@hidden>
---
hw/ide/core.c | 12 ++++++++++--
hw/ide/internal.h | 3 +++
hw/ide/isa.c | 32 ++++++++++++++++++++++++++++++++
hw/ide/qdev.c | 2 ++
4 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index d683a8c..454df35 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -32,9 +32,16 @@
#include "dma.h"
#include "hw/block-common.h"
#include "blockdev.h"
+#include "qidl.h"
#include <hw/ide/internal.h>
+QIDL_ENABLE()
+QIDL_IMPLEMENT_PUBLIC(IDEDevice)
+QIDL_IMPLEMENT_PUBLIC(IDEUnreportedEvents)
+QIDL_IMPLEMENT_PUBLIC(IDEState)
+QIDL_IMPLEMENT_PUBLIC(IDEBus)
+
/* These values were based on a Seagate ST3500418AS but have been modified
to make more sense in QEMU */
static const int smart_attributes[][12] = {
@@ -2159,7 +2166,7 @@ static int ide_drive_post_load(void *opaque, int
version_id)
return 0;
}
-static int ide_drive_pio_post_load(void *opaque, int version_id)
+int ide_drive_pio_post_load(void *opaque, int version_id)
{
IDEState *s = opaque;
@@ -2173,7 +2180,7 @@ static int ide_drive_pio_post_load(void *opaque, int
version_id)
return 0;
}
-static void ide_drive_pio_pre_save(void *opaque)
+void ide_drive_pio_pre_save(void *opaque)
{
IDEState *s = opaque;
int idx;
@@ -2189,6 +2196,7 @@ static void ide_drive_pio_pre_save(void *opaque)
} else {
s->end_transfer_fn_idx = idx;
}
+ s->has_identify_data = s->identify_set;
}
static bool ide_drive_pio_state_needed(void *opaque)
diff --git a/hw/ide/internal.h b/hw/ide/internal.h
index e8e0666..7958fd3 100644
--- a/hw/ide/internal.h
+++ b/hw/ide/internal.h
@@ -328,6 +328,9 @@ typedef void DMARestartFunc(void *, int, RunState);
typedef struct IDEUnreportedEvents IDEUnreportedEvents;
+void ide_drive_pio_pre_save(void *opaque);
+int ide_drive_pio_post_load(void *opaque, int version_id);
+
QIDL_DECLARE_PUBLIC(IDEUnreportedEvents) {
bool eject_request;
bool new_media;
diff --git a/hw/ide/isa.c b/hw/ide/isa.c
index 992c553..8b16f7b 100644
--- a/hw/ide/isa.c
+++ b/hw/ide/isa.c
@@ -31,6 +31,8 @@
#include <hw/ide/internal.h>
+QIDL_ENABLE()
+
/***********************************************************/
/* ISA IDE definitions */
@@ -64,6 +66,32 @@ static const VMStateDescription vmstate_ide_isa = {
}
};
+static void isa_ide_get_state(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ ISADevice *isa = ISA_DEVICE(obj);
+ ISAIDEState *s = DO_UPCAST(ISAIDEState, dev, isa);
+ int i;
+
+ for (i = 0; i < 2; i++) {
+ ide_drive_pio_pre_save(&s->bus.ifs[i]);
+ }
+ QIDL_VISIT_TYPE(ISAIDEState, v, &s, name, errp);
+}
+
+static void isa_ide_set_state(Object *obj, Visitor *v, void *opaque,
+ const char *name, Error **errp)
+{
+ ISADevice *isa = ISA_DEVICE(obj);
+ ISAIDEState *s = DO_UPCAST(ISAIDEState, dev, isa);
+ int i;
+
+ QIDL_VISIT_TYPE(ISAIDEState, v, &s, name, errp);
+ for (i = 0; i < 2; i++) {
+ ide_drive_pio_post_load(&s->bus.ifs[i], -1);
+ }
+}
+
static int isa_ide_initfn(ISADevice *dev)
{
ISAIDEState *s = DO_UPCAST(ISAIDEState, dev, dev);
@@ -73,6 +101,10 @@ static int isa_ide_initfn(ISADevice *dev)
isa_init_irq(dev, &s->irq, s->isairq);
ide_init2(&s->bus, s->irq);
vmstate_register(&dev->qdev, 0, &vmstate_ide_isa, s);
+ object_property_add(OBJECT(s), "state", "ISAIDEState",
+ isa_ide_get_state, isa_ide_set_state,
+ NULL, NULL, NULL);
+ QIDL_SCHEMA_ADD_LINK(ISAIDEState, OBJECT(s), "state_schema", NULL);
return 0;
};
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index f2e4ea4..a2b6ea3 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -83,6 +83,7 @@ static int ide_qdev_init(DeviceState *qdev)
goto err;
}
bus->master = dev;
+ bus->has_master = true;
break;
case 1:
if (bus->slave) {
@@ -90,6 +91,7 @@ static int ide_qdev_init(DeviceState *qdev)
goto err;
}
bus->slave = dev;
+ bus->has_slave = true;
break;
default:
error_report("Invalid IDE unit %d", dev->unit);
--
1.7.9.5
- [Qemu-devel] [PATCH 14/29] cirrus: add qom property for isa-cirrus-vga, (continued)
- [Qemu-devel] [PATCH 14/29] cirrus: add qom property for isa-cirrus-vga, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 29/29] hpet: add qom property for hpet state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 27/29] ide: add qom property for piix3/piix4-ide state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 22/29] pci_bridge_dev: add qom property for pci-bridge state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 23/29] ide: qidl_declare IDEBus + IDEState + IDEDevice, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 09/29] pci: add qom property for PCIBus instances, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 07/29] pci: qidl_declare PCIDevice + PCIBus, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 05/29] rtc: use qidl-generated properties, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 21/29] pci_bridge_dev: qidl_declare PCIBridgeDev, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 17/29] piix3: qidl_declare PIIX3State, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 25/29] ide: add qom property for isa-ide state,
Michael Roth <=
- [Qemu-devel] [PATCH 18/29] piix3: add qom property for PIIX3 state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 19/29] shpc: qidl_declare SHPCDevice, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 26/29] ide: qidl_declare BMDMAState + PCIIDEState, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 24/29] ide: qidl_declare ISAIDEState, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 16/29] i440fx: a qom property for i440FX state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 12/29] cirrus: add qom property for cirrus-vga state, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 20/29] pci_bridge: qidl_declare PCIBridge, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 11/29] cirrus: qidl_declare PCICirrusVGAState + CirrusVGAState, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 28/29] hpet: qidl_declare HPETState + HPETTimer, Michael Roth, 2012/11/01
- [Qemu-devel] [PATCH 03/29] isa: qidl_declare ISADevice, Michael Roth, 2012/11/01