[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 10/13] piix4: create PIIX4State
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 10/13] piix4: create PIIX4State |
Date: |
Thu, 10 Mar 2011 12:54:27 +0100 |
It only contains a PCIDevice by know, but it makes easy to use migration code
Signed-off-by: Juan Quintela <address@hidden>
---
hw/piix4.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/hw/piix4.c b/hw/piix4.c
index 72073cd..40cd91a 100644
--- a/hw/piix4.c
+++ b/hw/piix4.c
@@ -30,10 +30,14 @@
PCIDevice *piix4_dev;
+typedef struct PIIX4State {
+ PCIDevice dev;
+} PIIX4State;
+
static void piix4_reset(void *opaque)
{
- PCIDevice *d = opaque;
- uint8_t *pci_conf = d->config;
+ PIIX4State *d = opaque;
+ uint8_t *pci_conf = d->dev.config;
pci_conf[0x04] = 0x07; // master, memory and I/O
pci_conf[0x05] = 0x00;
@@ -70,31 +74,32 @@ static void piix4_reset(void *opaque)
static void piix_save(QEMUFile* f, void *opaque)
{
- PCIDevice *d = opaque;
- pci_device_save(d, f);
+ PIIX4State *d = opaque;
+ pci_device_save(&d->dev, f);
}
static int piix_load(QEMUFile* f, void *opaque, int version_id)
{
- PCIDevice *d = opaque;
+ PIIX4State *d = opaque;
if (version_id != 2)
return -EINVAL;
- return pci_device_load(d, f);
+ return pci_device_load(&d->dev, f);
}
-static int piix4_initfn(PCIDevice *d)
+static int piix4_initfn(PCIDevice *dev)
{
+ PIIX4State *d = DO_UPCAST(PIIX4State, dev, dev);
uint8_t *pci_conf;
- isa_bus_new(&d->qdev);
- register_savevm(&d->qdev, "PIIX4", 0, 2, piix_save, piix_load, d);
+ isa_bus_new(&d->dev.qdev);
+ register_savevm(&d->dev.qdev, "PIIX4", 0, 2, piix_save, piix_load, d);
- pci_conf = d->config;
+ pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
pci_config_set_device_id(pci_conf, PCI_DEVICE_ID_INTEL_82371AB_0); //
82371AB/EB/MB PIIX4 PCI-to-ISA bridge
pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
- piix4_dev = d;
+ piix4_dev = &d->dev;
qemu_register_reset(piix4_reset, d);
return 0;
}
@@ -111,7 +116,7 @@ static PCIDeviceInfo piix4_info[] = {
{
.qdev.name = "PIIX4",
.qdev.desc = "ISA bridge",
- .qdev.size = sizeof(PCIDevice),
+ .qdev.size = sizeof(PIIX4State),
.qdev.no_user = 1,
.no_hotplug = 1,
.init = piix4_initfn,
--
1.7.4
- [Qemu-devel] [PATCH 00/13] VMState port more devices, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 01/13] pxa2xx_lcd: name anonymous struct, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 02/13] pxa2xx_lcd: up field is used as a bool and migrated as an uint8_t, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 03/13] vmstate: port pxa2xx_lcd, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 05/13] vmstate: port max111x, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 04/13] max111x: input field is only used as uint8_t, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 07/13] vmstate: port nand, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 09/13] vmstate: port mac_nvram, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 10/13] piix4: create PIIX4State,
Juan Quintela <=
- [Qemu-devel] [PATCH 06/13] nand: pin values are uint8_t, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 08/13] mac_nvram: size is a size, no need to be a target dependent type, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 13/13] vmstate: port mac_dbdma, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 12/13] mac_dbdma: create DBDMAState instead of passing one array around, Juan Quintela, 2011/03/10
- [Qemu-devel] [PATCH 11/13] vmstate: port piix4, Juan Quintela, 2011/03/10