* [Qemu-devel] [PATCH 01/16] piix4 don't use pci_irq_levels at all
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 02/16] Split piix4 support from piix_pci.c Juan Quintela
` (15 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index c9fef92..ad85eba 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -323,8 +323,6 @@ static void piix4_reset(void *opaque)
pci_conf[0xab] = 0x00;
pci_conf[0xac] = 0x00;
pci_conf[0xae] = 0x00;
-
- memset(pci_irq_levels, 0, sizeof(pci_irq_levels));
}
static void piix_save(QEMUFile* f, void *opaque)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 02/16] Split piix4 support from piix_pci.c
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 01/16] piix4 don't use pci_irq_levels at all Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 03/16] low_set_irq is not used anywhere Juan Quintela
` (14 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Now mips_malta uses piix4 and pc's use piix_pci definitions
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
Makefile.target | 2 +-
hw/pc.h | 1 +
hw/piix4.c | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
hw/piix_pci.c | 72 -------------------------------
4 files changed, 130 insertions(+), 73 deletions(-)
create mode 100644 hw/piix4.c
diff --git a/Makefile.target b/Makefile.target
index f7d1919..67bd4d7 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -214,7 +214,7 @@ obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc403
obj-mips-y += g364fb.o jazz_led.o dp8393x.o
obj-mips-y += ide/core.o ide/isa.o ide/pci.o
obj-mips-y += gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
-obj-mips-y += piix_pci.o parallel.o cirrus_vga.o isa-bus.o pcspk.o $(sound-obj-y)
+obj-mips-y += piix4.o parallel.o cirrus_vga.o isa-bus.o pcspk.o $(sound-obj-y)
obj-mips-y += mipsnet.o
obj-mips-y += pflash_cfi01.o
obj-mips-y += vmware_vga.o
diff --git a/hw/pc.h b/hw/pc.h
index 7ac2849..3c46290 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -122,6 +122,7 @@ void i440fx_set_smm(PCIDevice *d, int val);
int piix3_init(PCIBus *bus, int devfn);
void i440fx_init_memory_mappings(PCIDevice *d);
+/* piix4.c */
extern PCIDevice *piix4_dev;
int piix4_init(PCIBus *bus, int devfn);
diff --git a/hw/piix4.c b/hw/piix4.c
new file mode 100644
index 0000000..a9849ee
--- /dev/null
+++ b/hw/piix4.c
@@ -0,0 +1,128 @@
+/*
+ * QEMU PIIX4 PCI Bridge Emulation
+ *
+ * Copyright (c) 2006 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "hw.h"
+#include "pc.h"
+#include "pci.h"
+#include "isa.h"
+#include "sysbus.h"
+
+PCIDevice *piix4_dev;
+
+static void piix4_reset(void *opaque)
+{
+ PCIDevice *d = opaque;
+ uint8_t *pci_conf = d->config;
+
+ pci_conf[0x04] = 0x07; // master, memory and I/O
+ pci_conf[0x05] = 0x00;
+ pci_conf[0x06] = 0x00;
+ pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
+ pci_conf[0x4c] = 0x4d;
+ pci_conf[0x4e] = 0x03;
+ pci_conf[0x4f] = 0x00;
+ pci_conf[0x60] = 0x0a; // PCI A -> IRQ 10
+ pci_conf[0x61] = 0x0a; // PCI B -> IRQ 10
+ pci_conf[0x62] = 0x0b; // PCI C -> IRQ 11
+ pci_conf[0x63] = 0x0b; // PCI D -> IRQ 11
+ pci_conf[0x69] = 0x02;
+ pci_conf[0x70] = 0x80;
+ pci_conf[0x76] = 0x0c;
+ pci_conf[0x77] = 0x0c;
+ pci_conf[0x78] = 0x02;
+ pci_conf[0x79] = 0x00;
+ pci_conf[0x80] = 0x00;
+ pci_conf[0x82] = 0x00;
+ pci_conf[0xa0] = 0x08;
+ pci_conf[0xa2] = 0x00;
+ pci_conf[0xa3] = 0x00;
+ pci_conf[0xa4] = 0x00;
+ pci_conf[0xa5] = 0x00;
+ pci_conf[0xa6] = 0x00;
+ pci_conf[0xa7] = 0x00;
+ pci_conf[0xa8] = 0x0f;
+ pci_conf[0xaa] = 0x00;
+ pci_conf[0xab] = 0x00;
+ pci_conf[0xac] = 0x00;
+ pci_conf[0xae] = 0x00;
+}
+
+static void piix_save(QEMUFile* f, void *opaque)
+{
+ PCIDevice *d = opaque;
+ pci_device_save(d, f);
+}
+
+static int piix_load(QEMUFile* f, void *opaque, int version_id)
+{
+ PCIDevice *d = opaque;
+ if (version_id != 2)
+ return -EINVAL;
+ return pci_device_load(d, f);
+}
+
+static int piix4_initfn(PCIDevice *d)
+{
+ uint8_t *pci_conf;
+
+ register_savevm("PIIX4", 0, 2, piix_save, piix_load, d);
+
+ pci_conf = d->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);
+ pci_conf[PCI_HEADER_TYPE] =
+ PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION; // header_type = PCI_multifunction, generic
+
+ piix4_dev = d;
+ piix4_reset(d);
+ qemu_register_reset(piix4_reset, d);
+ return 0;
+}
+
+int piix4_init(PCIBus *bus, int devfn)
+{
+ PCIDevice *d;
+
+ d = pci_create_simple(bus, devfn, "PIIX4");
+ return d->devfn;
+}
+
+static PCIDeviceInfo piix4_info[] = {
+ {
+ .qdev.name = "PIIX4",
+ .qdev.desc = "ISA bridge",
+ .qdev.size = sizeof(PCIDevice),
+ .qdev.no_user = 1,
+ .init = piix4_initfn,
+ },{
+ /* end of list */
+ }
+};
+
+static void piix4_register(void)
+{
+ pci_qdev_register_many(piix4_info);
+}
+device_init(piix4_register);
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index ad85eba..c78007a 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -224,7 +224,6 @@ PCIBus *i440fx_init(PCIDevice **pi440fx_state, qemu_irq *pic)
/* PIIX3 PCI to ISA bridge */
static PCIDevice *piix3_dev;
-PCIDevice *piix4_dev;
static void piix3_set_irq(qemu_irq *pic, int irq_num, int level)
{
@@ -287,44 +286,6 @@ static void piix3_reset(void *opaque)
memset(pci_irq_levels, 0, sizeof(pci_irq_levels));
}
-static void piix4_reset(void *opaque)
-{
- PCIDevice *d = opaque;
- uint8_t *pci_conf = d->config;
-
- pci_conf[0x04] = 0x07; // master, memory and I/O
- pci_conf[0x05] = 0x00;
- pci_conf[0x06] = 0x00;
- pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
- pci_conf[0x4c] = 0x4d;
- pci_conf[0x4e] = 0x03;
- pci_conf[0x4f] = 0x00;
- pci_conf[0x60] = 0x0a; // PCI A -> IRQ 10
- pci_conf[0x61] = 0x0a; // PCI B -> IRQ 10
- pci_conf[0x62] = 0x0b; // PCI C -> IRQ 11
- pci_conf[0x63] = 0x0b; // PCI D -> IRQ 11
- pci_conf[0x69] = 0x02;
- pci_conf[0x70] = 0x80;
- pci_conf[0x76] = 0x0c;
- pci_conf[0x77] = 0x0c;
- pci_conf[0x78] = 0x02;
- pci_conf[0x79] = 0x00;
- pci_conf[0x80] = 0x00;
- pci_conf[0x82] = 0x00;
- pci_conf[0xa0] = 0x08;
- pci_conf[0xa2] = 0x00;
- pci_conf[0xa3] = 0x00;
- pci_conf[0xa4] = 0x00;
- pci_conf[0xa5] = 0x00;
- pci_conf[0xa6] = 0x00;
- pci_conf[0xa7] = 0x00;
- pci_conf[0xa8] = 0x0f;
- pci_conf[0xaa] = 0x00;
- pci_conf[0xab] = 0x00;
- pci_conf[0xac] = 0x00;
- pci_conf[0xae] = 0x00;
-}
-
static void piix_save(QEMUFile* f, void *opaque)
{
PCIDevice *d = opaque;
@@ -359,25 +320,6 @@ static int piix3_initfn(PCIDevice *d)
return 0;
}
-static int piix4_initfn(PCIDevice *d)
-{
- uint8_t *pci_conf;
-
- register_savevm("PIIX4", 0, 2, piix_save, piix_load, d);
-
- pci_conf = d->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);
- pci_conf[PCI_HEADER_TYPE] =
- PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION; // header_type = PCI_multifunction, generic
-
- piix4_dev = d;
- piix4_reset(d);
- qemu_register_reset(piix4_reset, d);
- return 0;
-}
-
int piix3_init(PCIBus *bus, int devfn)
{
PCIDevice *d;
@@ -386,14 +328,6 @@ int piix3_init(PCIBus *bus, int devfn)
return d->devfn;
}
-int piix4_init(PCIBus *bus, int devfn)
-{
- PCIDevice *d;
-
- d = pci_create_simple(bus, devfn, "PIIX4");
- return d->devfn;
-}
-
static PCIDeviceInfo i440fx_info[] = {
{
.qdev.name = "i440FX",
@@ -409,12 +343,6 @@ static PCIDeviceInfo i440fx_info[] = {
.qdev.no_user = 1,
.init = piix3_initfn,
},{
- .qdev.name = "PIIX4",
- .qdev.desc = "ISA bridge",
- .qdev.size = sizeof(PCIDevice),
- .qdev.no_user = 1,
- .init = piix4_initfn,
- },{
/* end of list */
}
};
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 03/16] low_set_irq is not used anywhere
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 01/16] piix4 don't use pci_irq_levels at all Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 02/16] Split piix4 support from piix_pci.c Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 04/16] Use PCII440FXState instead of generic PCIDevice Juan Quintela
` (13 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/pci.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 41e99a9..a9034a7 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -41,8 +41,6 @@ struct PCIBus {
pci_set_irq_fn set_irq;
pci_map_irq_fn map_irq;
uint32_t config_reg; /* XXX: suppress */
- /* low level pic */
- SetIRQFunc *low_set_irq;
qemu_irq *irq_opaque;
PCIDevice *devices[256];
PCIDevice *parent_dev;
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 04/16] Use PCII440FXState instead of generic PCIDevice
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (2 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 03/16] low_set_irq is not used anywhere Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 05/16] Move smm_enabled and isa_memory_mappings to PCII440FXState Juan Quintela
` (12 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/pc.c | 2 +-
hw/pc.h | 9 ++++++---
hw/piix_pci.c | 54 +++++++++++++++++++++++++++++++-----------------------
3 files changed, 38 insertions(+), 27 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 32713b4..6477b41 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -62,7 +62,7 @@
static fdctrl_t *floppy_controller;
static RTCState *rtc_state;
static PITState *pit;
-static PCIDevice *i440fx_state;
+static PCII440FXState *i440fx_state;
typedef struct rom_reset_data {
uint8_t *data;
diff --git a/hw/pc.h b/hw/pc.h
index 3c46290..3572165 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -117,10 +117,13 @@ void pcspk_init(PITState *);
int pcspk_audio_init(qemu_irq *pic);
/* piix_pci.c */
-PCIBus *i440fx_init(PCIDevice **pi440fx_state, qemu_irq *pic);
-void i440fx_set_smm(PCIDevice *d, int val);
+struct PCII440FXState;
+typedef struct PCII440FXState PCII440FXState;
+
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic);
+void i440fx_set_smm(PCII440FXState *d, int val);
int piix3_init(PCIBus *bus, int devfn);
-void i440fx_init_memory_mappings(PCIDevice *d);
+void i440fx_init_memory_mappings(PCII440FXState *d);
/* piix4.c */
extern PCIDevice *piix4_dev;
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index c78007a..e4409d8 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -33,6 +33,10 @@ typedef uint32_t pci_addr_t;
typedef PCIHostState I440FXState;
+struct PCII440FXState {
+ PCIDevice dev;
+};
+
static void i440fx_addr_writel(void* opaque, uint32_t addr, uint32_t val)
{
I440FXState *s = opaque;
@@ -61,7 +65,7 @@ static target_phys_addr_t isa_page_descs[384 / 4];
static uint8_t smm_enabled;
static int pci_irq_levels[4];
-static void update_pam(PCIDevice *d, uint32_t start, uint32_t end, int r)
+static void update_pam(PCII440FXState *d, uint32_t start, uint32_t end, int r)
{
uint32_t addr;
@@ -88,17 +92,17 @@ static void update_pam(PCIDevice *d, uint32_t start, uint32_t end, int r)
}
}
-static void i440fx_update_memory_mappings(PCIDevice *d)
+static void i440fx_update_memory_mappings(PCII440FXState *d)
{
int i, r;
uint32_t smram, addr;
- update_pam(d, 0xf0000, 0x100000, (d->config[0x59] >> 4) & 3);
+ update_pam(d, 0xf0000, 0x100000, (d->dev.config[0x59] >> 4) & 3);
for(i = 0; i < 12; i++) {
- r = (d->config[(i >> 1) + 0x5a] >> ((i & 1) * 4)) & 3;
+ r = (d->dev.config[(i >> 1) + 0x5a] >> ((i & 1) * 4)) & 3;
update_pam(d, 0xc0000 + 0x4000 * i, 0xc0000 + 0x4000 * (i + 1), r);
}
- smram = d->config[0x72];
+ smram = d->dev.config[0x72];
if ((smm_enabled && (smram & 0x08)) || (smram & 0x40)) {
cpu_register_physical_memory(0xa0000, 0x20000, 0xa0000);
} else {
@@ -109,7 +113,7 @@ static void i440fx_update_memory_mappings(PCIDevice *d)
}
}
-void i440fx_set_smm(PCIDevice *d, int val)
+void i440fx_set_smm(PCII440FXState *d, int val)
{
val = (val != 0);
if (smm_enabled != val) {
@@ -122,7 +126,7 @@ void i440fx_set_smm(PCIDevice *d, int val)
/* XXX: suppress when better memory API. We make the assumption that
no device (in particular the VGA) changes the memory mappings in
the 0xa0000-0x100000 range */
-void i440fx_init_memory_mappings(PCIDevice *d)
+void i440fx_init_memory_mappings(PCII440FXState *d)
{
int i;
for(i = 0; i < 96; i++) {
@@ -130,21 +134,23 @@ void i440fx_init_memory_mappings(PCIDevice *d)
}
}
-static void i440fx_write_config(PCIDevice *d,
+static void i440fx_write_config(PCIDevice *dev,
uint32_t address, uint32_t val, int len)
{
+ PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
+
/* XXX: implement SMRAM.D_LOCK */
- pci_default_write_config(d, address, val, len);
+ pci_default_write_config(dev, address, val, len);
if ((address >= 0x59 && address <= 0x5f) || address == 0x72)
i440fx_update_memory_mappings(d);
}
static void i440fx_save(QEMUFile* f, void *opaque)
{
- PCIDevice *d = opaque;
+ PCII440FXState *d = opaque;
int i;
- pci_device_save(d, f);
+ pci_device_save(&d->dev, f);
qemu_put_8s(f, &smm_enabled);
for (i = 0; i < 4; i++)
@@ -153,12 +159,12 @@ static void i440fx_save(QEMUFile* f, void *opaque)
static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
{
- PCIDevice *d = opaque;
+ PCII440FXState *d = opaque;
int ret, i;
if (version_id > 2)
return -EINVAL;
- ret = pci_device_load(d, f);
+ ret = pci_device_load(&d->dev, f);
if (ret < 0)
return ret;
i440fx_update_memory_mappings(d);
@@ -187,21 +193,23 @@ static int i440fx_pcihost_initfn(SysBusDevice *dev)
return 0;
}
-static int i440fx_initfn(PCIDevice *d)
+static int i440fx_initfn(PCIDevice *dev)
{
- pci_config_set_vendor_id(d->config, PCI_VENDOR_ID_INTEL);
- pci_config_set_device_id(d->config, PCI_DEVICE_ID_INTEL_82441);
- d->config[0x08] = 0x02; // revision
- pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST);
- d->config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
+ PCII440FXState *d = DO_UPCAST(PCII440FXState, dev, dev);
- d->config[0x72] = 0x02; /* SMRAM */
+ pci_config_set_vendor_id(d->dev.config, PCI_VENDOR_ID_INTEL);
+ pci_config_set_device_id(d->dev.config, PCI_DEVICE_ID_INTEL_82441);
+ d->dev.config[0x08] = 0x02; // revision
+ pci_config_set_class(d->dev.config, PCI_CLASS_BRIDGE_HOST);
+ d->dev.config[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL; // header_type
+
+ d->dev.config[0x72] = 0x02; /* SMRAM */
register_savevm("I440FX", 0, 2, i440fx_save, i440fx_load, d);
return 0;
}
-PCIBus *i440fx_init(PCIDevice **pi440fx_state, qemu_irq *pic)
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)
{
DeviceState *dev;
PCIBus *b;
@@ -216,7 +224,7 @@ PCIBus *i440fx_init(PCIDevice **pi440fx_state, qemu_irq *pic)
qdev_init(dev);
d = pci_create_simple(b, 0, "i440FX");
- *pi440fx_state = d;
+ *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
return b;
}
@@ -332,7 +340,7 @@ static PCIDeviceInfo i440fx_info[] = {
{
.qdev.name = "i440FX",
.qdev.desc = "Host bridge",
- .qdev.size = sizeof(PCIDevice),
+ .qdev.size = sizeof(PCII440FXState),
.qdev.no_user = 1,
.init = i440fx_initfn,
.config_write = i440fx_write_config,
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 05/16] Move smm_enabled and isa_memory_mappings to PCII440FXState
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (3 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 04/16] Use PCII440FXState instead of generic PCIDevice Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 06/16] We want the argument pass to set_irq to be opaque Juan Quintela
` (11 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index e4409d8..378b7bf 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -35,6 +35,8 @@ typedef PCIHostState I440FXState;
struct PCII440FXState {
PCIDevice dev;
+ target_phys_addr_t isa_page_descs[384 / 4];
+ uint8_t smm_enabled;
};
static void i440fx_addr_writel(void* opaque, uint32_t addr, uint32_t val)
@@ -61,8 +63,6 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
return (irq_num + slot_addend) & 3;
}
-static target_phys_addr_t isa_page_descs[384 / 4];
-static uint8_t smm_enabled;
static int pci_irq_levels[4];
static void update_pam(PCII440FXState *d, uint32_t start, uint32_t end, int r)
@@ -86,7 +86,7 @@ static void update_pam(PCII440FXState *d, uint32_t start, uint32_t end, int r)
/* XXX: should distinguish read/write cases */
for(addr = start; addr < end; addr += 4096) {
cpu_register_physical_memory(addr, 4096,
- isa_page_descs[(addr - 0xa0000) >> 12]);
+ d->isa_page_descs[(addr - 0xa0000) >> 12]);
}
break;
}
@@ -103,12 +103,12 @@ static void i440fx_update_memory_mappings(PCII440FXState *d)
update_pam(d, 0xc0000 + 0x4000 * i, 0xc0000 + 0x4000 * (i + 1), r);
}
smram = d->dev.config[0x72];
- if ((smm_enabled && (smram & 0x08)) || (smram & 0x40)) {
+ if ((d->smm_enabled && (smram & 0x08)) || (smram & 0x40)) {
cpu_register_physical_memory(0xa0000, 0x20000, 0xa0000);
} else {
for(addr = 0xa0000; addr < 0xc0000; addr += 4096) {
cpu_register_physical_memory(addr, 4096,
- isa_page_descs[(addr - 0xa0000) >> 12]);
+ d->isa_page_descs[(addr - 0xa0000) >> 12]);
}
}
}
@@ -116,8 +116,8 @@ static void i440fx_update_memory_mappings(PCII440FXState *d)
void i440fx_set_smm(PCII440FXState *d, int val)
{
val = (val != 0);
- if (smm_enabled != val) {
- smm_enabled = val;
+ if (d->smm_enabled != val) {
+ d->smm_enabled = val;
i440fx_update_memory_mappings(d);
}
}
@@ -130,7 +130,7 @@ void i440fx_init_memory_mappings(PCII440FXState *d)
{
int i;
for(i = 0; i < 96; i++) {
- isa_page_descs[i] = cpu_get_physical_page_desc(0xa0000 + i * 0x1000);
+ d->isa_page_descs[i] = cpu_get_physical_page_desc(0xa0000 + i * 0x1000);
}
}
@@ -151,7 +151,7 @@ static void i440fx_save(QEMUFile* f, void *opaque)
int i;
pci_device_save(&d->dev, f);
- qemu_put_8s(f, &smm_enabled);
+ qemu_put_8s(f, &d->smm_enabled);
for (i = 0; i < 4; i++)
qemu_put_be32(f, pci_irq_levels[i]);
@@ -168,7 +168,7 @@ static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
if (ret < 0)
return ret;
i440fx_update_memory_mappings(d);
- qemu_get_8s(f, &smm_enabled);
+ qemu_get_8s(f, &d->smm_enabled);
if (version_id >= 2)
for (i = 0; i < 4; i++)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 06/16] We want the argument pass to set_irq to be opaque
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (4 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 05/16] Move smm_enabled and isa_memory_mappings to PCII440FXState Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 07/16] Create PIIX3State instead of using PCIDevice for PIIX3 Juan Quintela
` (10 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
piix_pci want to pass more things that the pic
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/apb_pci.c | 4 +++-
hw/grackle_pci.c | 4 +++-
hw/gt64xxx.c | 3 ++-
hw/pci.c | 6 +++---
hw/pci.h | 6 +++---
hw/piix_pci.c | 5 +++--
hw/ppc4xx_pci.c | 4 +++-
hw/ppce500_pci.c | 4 +++-
hw/prep_pci.c | 4 +++-
hw/r2d.c | 4 +++-
hw/sh_pci.c | 4 ++--
hw/unin_pci.c | 4 +++-
hw/versatile_pci.c | 4 +++-
13 files changed, 37 insertions(+), 19 deletions(-)
diff --git a/hw/apb_pci.c b/hw/apb_pci.c
index d114e55..f1088aa 100644
--- a/hw/apb_pci.c
+++ b/hw/apb_pci.c
@@ -218,8 +218,10 @@ static int pci_pbm_map_irq(PCIDevice *pci_dev, int irq_num)
return bus_offset + irq_num;
}
-static void pci_apb_set_irq(qemu_irq *pic, int irq_num, int level)
+static void pci_apb_set_irq(void *opaque, int irq_num, int level)
{
+ qemu_irq *pic = opaque;
+
/* PCI IRQ map onto the first 32 INO. */
qemu_set_irq(pic[irq_num], level);
}
diff --git a/hw/grackle_pci.c b/hw/grackle_pci.c
index 38e2fe4..177c888 100644
--- a/hw/grackle_pci.c
+++ b/hw/grackle_pci.c
@@ -102,8 +102,10 @@ static int pci_grackle_map_irq(PCIDevice *pci_dev, int irq_num)
return (irq_num + (pci_dev->devfn >> 3)) & 3;
}
-static void pci_grackle_set_irq(qemu_irq *pic, int irq_num, int level)
+static void pci_grackle_set_irq(void *opaque, int irq_num, int level)
{
+ qemu_irq *pic = opaque;
+
GRACKLE_DPRINTF("set_irq num %d level %d\n", irq_num, level);
qemu_set_irq(pic[irq_num + 0x15], level);
}
diff --git a/hw/gt64xxx.c b/hw/gt64xxx.c
index 2115130..8f9ae4a 100644
--- a/hw/gt64xxx.c
+++ b/hw/gt64xxx.c
@@ -893,9 +893,10 @@ static int pci_gt64120_map_irq(PCIDevice *pci_dev, int irq_num)
static int pci_irq_levels[4];
-static void pci_gt64120_set_irq(qemu_irq *pic, int irq_num, int level)
+static void pci_gt64120_set_irq(void *opaque, int irq_num, int level)
{
int i, pic_irq, pic_level;
+ qemu_irq *pic = opaque;
pci_irq_levels[irq_num] = level;
diff --git a/hw/pci.c b/hw/pci.c
index a9034a7..c12b0be 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -41,7 +41,7 @@ struct PCIBus {
pci_set_irq_fn set_irq;
pci_map_irq_fn map_irq;
uint32_t config_reg; /* XXX: suppress */
- qemu_irq *irq_opaque;
+ void *irq_opaque;
PCIDevice *devices[256];
PCIDevice *parent_dev;
PCIBus *next;
@@ -100,7 +100,7 @@ static void pci_bus_reset(void *opaque)
PCIBus *pci_register_bus(DeviceState *parent, const char *name,
pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
- qemu_irq *pic, int devfn_min, int nirq)
+ void *irq_opaque, int devfn_min, int nirq)
{
PCIBus *bus;
static int nbus = 0;
@@ -108,7 +108,7 @@ PCIBus *pci_register_bus(DeviceState *parent, const char *name,
bus = FROM_QBUS(PCIBus, qbus_create(&pci_bus_info, parent, name));
bus->set_irq = set_irq;
bus->map_irq = map_irq;
- bus->irq_opaque = pic;
+ bus->irq_opaque = irq_opaque;
bus->devfn_min = devfn_min;
bus->nirq = nirq;
bus->irq_count = qemu_mallocz(nirq * sizeof(bus->irq_count[0]));
diff --git a/hw/pci.h b/hw/pci.h
index fd1d35c..5340bbb 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -239,11 +239,11 @@ void pci_default_write_config(PCIDevice *d,
void pci_device_save(PCIDevice *s, QEMUFile *f);
int pci_device_load(PCIDevice *s, QEMUFile *f);
-typedef void (*pci_set_irq_fn)(qemu_irq *pic, int irq_num, int level);
+typedef void (*pci_set_irq_fn)(void *opaque, int irq_num, int level);
typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num);
PCIBus *pci_register_bus(DeviceState *parent, const char *name,
pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
- qemu_irq *pic, int devfn_min, int nirq);
+ void *irq_opaque, int devfn_min, int nirq);
PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
const char *default_devaddr);
@@ -353,6 +353,6 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
/* sh_pci.c */
PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
- qemu_irq *pic, int devfn_min, int nirq);
+ void *pic, int devfn_min, int nirq);
#endif
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 378b7bf..1a51ec5 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -51,7 +51,7 @@ static uint32_t i440fx_addr_readl(void* opaque, uint32_t addr)
return s->config_reg;
}
-static void piix3_set_irq(qemu_irq *pic, int irq_num, int level);
+static void piix3_set_irq(void *opaque, int irq_num, int level);
/* return the global irq number corresponding to a given device irq
pin. We could also use the bus number to have a more precise
@@ -233,9 +233,10 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)
static PCIDevice *piix3_dev;
-static void piix3_set_irq(qemu_irq *pic, int irq_num, int level)
+static void piix3_set_irq(void *opaque, int irq_num, int level)
{
int i, pic_irq, pic_level;
+ qemu_irq *pic = opaque;
pci_irq_levels[irq_num] = level;
diff --git a/hw/ppc4xx_pci.c b/hw/ppc4xx_pci.c
index 98877cf..655fe86 100644
--- a/hw/ppc4xx_pci.c
+++ b/hw/ppc4xx_pci.c
@@ -304,8 +304,10 @@ static int ppc4xx_pci_map_irq(PCIDevice *pci_dev, int irq_num)
return slot - 1;
}
-static void ppc4xx_pci_set_irq(qemu_irq *pci_irqs, int irq_num, int level)
+static void ppc4xx_pci_set_irq(void *opaque, int irq_num, int level)
{
+ qemu_irq *pci_irqs = opaque;
+
DPRINTF("%s: PCI irq %d\n", __func__, irq_num);
qemu_set_irq(pci_irqs[irq_num], level);
}
diff --git a/hw/ppce500_pci.c b/hw/ppce500_pci.c
index 6328f73..64fccfd 100644
--- a/hw/ppce500_pci.c
+++ b/hw/ppce500_pci.c
@@ -253,8 +253,10 @@ static int mpc85xx_pci_map_irq(PCIDevice *pci_dev, int irq_num)
return ret;
}
-static void mpc85xx_pci_set_irq(qemu_irq *pic, int irq_num, int level)
+static void mpc85xx_pci_set_irq(void *opaque, int irq_num, int level)
{
+ qemu_irq *pic = opaque;
+
pci_debug("%s: PCI irq %d, level:%d\n", __func__, irq_num, level);
qemu_set_irq(pic[irq_num], level);
diff --git a/hw/prep_pci.c b/hw/prep_pci.c
index 2a1d0f9..2d8a0fa 100644
--- a/hw/prep_pci.c
+++ b/hw/prep_pci.c
@@ -124,8 +124,10 @@ static int prep_map_irq(PCIDevice *pci_dev, int irq_num)
return (irq_num + (pci_dev->devfn >> 3)) & 1;
}
-static void prep_set_irq(qemu_irq *pic, int irq_num, int level)
+static void prep_set_irq(void *opaque, int irq_num, int level)
{
+ qemu_irq *pic = opaque;
+
qemu_set_irq(pic[(irq_num & 1) ? 11 : 9] , level);
}
diff --git a/hw/r2d.c b/hw/r2d.c
index 4667a5d..6ce556e 100644
--- a/hw/r2d.c
+++ b/hw/r2d.c
@@ -183,8 +183,10 @@ static qemu_irq *r2d_fpga_init(target_phys_addr_t base, qemu_irq irl)
return qemu_allocate_irqs(r2d_fpga_irq_set, s, NR_IRQS);
}
-static void r2d_pci_set_irq(qemu_irq *p, int n, int l)
+static void r2d_pci_set_irq(void *opaque, int n, int l)
{
+ qemu_irq *p = opaque;
+
qemu_set_irq(p[n], l);
}
diff --git a/hw/sh_pci.c b/hw/sh_pci.c
index 659935f..ea8635d 100644
--- a/hw/sh_pci.c
+++ b/hw/sh_pci.c
@@ -168,14 +168,14 @@ static MemOp sh_pci_iop = {
};
PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
- qemu_irq *pic, int devfn_min, int nirq)
+ void *opaque, int devfn_min, int nirq)
{
SHPCIC *p;
int mem, reg, iop;
p = qemu_mallocz(sizeof(SHPCIC));
p->bus = pci_register_bus(NULL, "pci",
- set_irq, map_irq, pic, devfn_min, nirq);
+ set_irq, map_irq, opaque, devfn_min, nirq);
p->dev = pci_register_device(p->bus, "SH PCIC", sizeof(PCIDevice),
-1, NULL, NULL);
diff --git a/hw/unin_pci.c b/hw/unin_pci.c
index 9b5b8c8..e6d9a70 100644
--- a/hw/unin_pci.c
+++ b/hw/unin_pci.c
@@ -141,8 +141,10 @@ static int pci_unin_map_irq(PCIDevice *pci_dev, int irq_num)
return (irq_num + (pci_dev->devfn >> 3)) & 3;
}
-static void pci_unin_set_irq(qemu_irq *pic, int irq_num, int level)
+static void pci_unin_set_irq(void *opaque, int irq_num, int level)
{
+ qemu_irq *pic = opaque;
+
qemu_set_irq(pic[irq_num + 8], level);
}
diff --git a/hw/versatile_pci.c b/hw/versatile_pci.c
index 6f9151c..a0d7d07 100644
--- a/hw/versatile_pci.c
+++ b/hw/versatile_pci.c
@@ -90,8 +90,10 @@ static int pci_vpb_map_irq(PCIDevice *d, int irq_num)
return irq_num;
}
-static void pci_vpb_set_irq(qemu_irq *pic, int irq_num, int level)
+static void pci_vpb_set_irq(void *opaque, int irq_num, int level)
{
+ qemu_irq *pic = opaque;
+
qemu_set_irq(pic[irq_num], level);
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 07/16] Create PIIX3State instead of using PCIDevice for PIIX3
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (5 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 06/16] We want the argument pass to set_irq to be opaque Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 08/16] Introduce PIIX3IrqState for piix3 irq's state Juan Quintela
` (9 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 1a51ec5..b08b063 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -33,6 +33,10 @@ typedef uint32_t pci_addr_t;
typedef PCIHostState I440FXState;
+typedef struct PIIX3State {
+ PCIDevice dev;
+} PIIX3State;
+
struct PCII440FXState {
PCIDevice dev;
target_phys_addr_t isa_page_descs[384 / 4];
@@ -231,7 +235,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)
/* PIIX3 PCI to ISA bridge */
-static PCIDevice *piix3_dev;
+static PIIX3State *piix3_dev;
static void piix3_set_irq(void *opaque, int irq_num, int level)
{
@@ -242,13 +246,13 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)
/* now we change the pic irq level according to the piix irq mappings */
/* XXX: optimize */
- pic_irq = piix3_dev->config[0x60 + irq_num];
+ pic_irq = piix3_dev->dev.config[0x60 + irq_num];
if (pic_irq < 16) {
/* The pic level is the logical OR of all the PCI irqs mapped
to it */
pic_level = 0;
for (i = 0; i < 4; i++) {
- if (pic_irq == piix3_dev->config[0x60 + i])
+ if (pic_irq == piix3_dev->dev.config[0x60 + i])
pic_level |= pci_irq_levels[i];
}
qemu_set_irq(pic[pic_irq], pic_level);
@@ -257,8 +261,8 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)
static void piix3_reset(void *opaque)
{
- PCIDevice *d = opaque;
- uint8_t *pci_conf = d->config;
+ PIIX3State *d = opaque;
+ uint8_t *pci_conf = d->dev.config;
pci_conf[0x04] = 0x07; // master, memory and I/O
pci_conf[0x05] = 0x00;
@@ -309,14 +313,15 @@ static int piix_load(QEMUFile* f, void *opaque, int version_id)
return pci_device_load(d, f);
}
-static int piix3_initfn(PCIDevice *d)
+static int piix3_initfn(PCIDevice *dev)
{
+ PIIX3State *d = DO_UPCAST(PIIX3State, dev, dev);
uint8_t *pci_conf;
- isa_bus_new(&d->qdev);
+ isa_bus_new(&d->dev.qdev);
register_savevm("PIIX3", 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_82371SB_0); // 82371SB PIIX3 PCI-to-ISA bridge (Step A1)
pci_config_set_class(pci_conf, PCI_CLASS_BRIDGE_ISA);
@@ -348,7 +353,7 @@ static PCIDeviceInfo i440fx_info[] = {
},{
.qdev.name = "PIIX3",
.qdev.desc = "ISA bridge",
- .qdev.size = sizeof(PCIDevice),
+ .qdev.size = sizeof(PIIX3State),
.qdev.no_user = 1,
.init = piix3_initfn,
},{
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 08/16] Introduce PIIX3IrqState for piix3 irq's state
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (6 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 07/16] Create PIIX3State instead of using PCIDevice for PIIX3 Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 09/16] Fold piix3_init() intto i440fx_init Juan Quintela
` (8 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index b08b063..b931f84 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -37,6 +37,10 @@ typedef struct PIIX3State {
PCIDevice dev;
} PIIX3State;
+typedef struct PIIX3IrqState {
+ qemu_irq *pic;
+} PIIX3IrqState;
+
struct PCII440FXState {
PCIDevice dev;
target_phys_addr_t isa_page_descs[384 / 4];
@@ -219,11 +223,13 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)
PCIBus *b;
PCIDevice *d;
I440FXState *s;
+ PIIX3IrqState *irq_state = qemu_malloc(sizeof(*irq_state));
+ irq_state->pic = pic;
dev = qdev_create(NULL, "i440FX-pcihost");
s = FROM_SYSBUS(I440FXState, sysbus_from_qdev(dev));
b = pci_register_bus(&s->busdev.qdev, "pci.0",
- piix3_set_irq, pci_slot_get_pirq, pic, 0, 4);
+ piix3_set_irq, pci_slot_get_pirq, irq_state, 0, 4);
s->bus = b;
qdev_init(dev);
@@ -240,7 +246,7 @@ static PIIX3State *piix3_dev;
static void piix3_set_irq(void *opaque, int irq_num, int level)
{
int i, pic_irq, pic_level;
- qemu_irq *pic = opaque;
+ PIIX3IrqState *irq_state = opaque;
pci_irq_levels[irq_num] = level;
@@ -255,7 +261,7 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)
if (pic_irq == piix3_dev->dev.config[0x60 + i])
pic_level |= pci_irq_levels[i];
}
- qemu_set_irq(pic[pic_irq], pic_level);
+ qemu_set_irq(irq_state->pic[pic_irq], pic_level);
}
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 09/16] Fold piix3_init() intto i440fx_init
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (7 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 08/16] Introduce PIIX3IrqState for piix3 irq's state Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 10/16] We can add piix3_dev now to PIIX3IrqState Juan Quintela
` (7 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
i440fx_init will now work properly if we don't setup piix3
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/pc.c | 3 +--
hw/pc.h | 3 +--
hw/piix_pci.c | 18 ++++++------------
3 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 6477b41..e771170 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1279,8 +1279,7 @@ static void pc_init1(ram_addr_t ram_size,
isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24);
if (pci_enabled) {
- pci_bus = i440fx_init(&i440fx_state, isa_irq);
- piix3_devfn = piix3_init(pci_bus, -1);
+ pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq);
} else {
pci_bus = NULL;
isa_bus_new(NULL);
diff --git a/hw/pc.h b/hw/pc.h
index 3572165..ec5735b 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -120,9 +120,8 @@ int pcspk_audio_init(qemu_irq *pic);
struct PCII440FXState;
typedef struct PCII440FXState PCII440FXState;
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic);
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic);
void i440fx_set_smm(PCII440FXState *d, int val);
-int piix3_init(PCIBus *bus, int devfn);
void i440fx_init_memory_mappings(PCII440FXState *d);
/* piix4.c */
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index b931f84..86582fe 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -217,7 +217,9 @@ static int i440fx_initfn(PCIDevice *dev)
return 0;
}
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)
+static PIIX3State *piix3_dev;
+
+PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic)
{
DeviceState *dev;
PCIBus *b;
@@ -236,13 +238,14 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic)
d = pci_create_simple(b, 0, "i440FX");
*pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
+ piix3_dev = DO_UPCAST(PIIX3State, dev, pci_create_simple(b, -1, "PIIX3"));
+ *piix3_devfn = piix3_dev->dev.devfn;
+
return b;
}
/* PIIX3 PCI to ISA bridge */
-static PIIX3State *piix3_dev;
-
static void piix3_set_irq(void *opaque, int irq_num, int level)
{
int i, pic_irq, pic_level;
@@ -334,20 +337,11 @@ static int piix3_initfn(PCIDevice *dev)
pci_conf[PCI_HEADER_TYPE] =
PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION; // header_type = PCI_multifunction, generic
- piix3_dev = d;
piix3_reset(d);
qemu_register_reset(piix3_reset, d);
return 0;
}
-int piix3_init(PCIBus *bus, int devfn)
-{
- PCIDevice *d;
-
- d = pci_create_simple(bus, devfn, "PIIX3");
- return d->devfn;
-}
-
static PCIDeviceInfo i440fx_info[] = {
{
.qdev.name = "i440FX",
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 10/16] We can add piix3_dev now to PIIX3IrqState
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (8 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 09/16] Fold piix3_init() intto i440fx_init Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 11/16] Save irq_state into PCII440FXState Juan Quintela
` (6 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 86582fe..92884d9 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -38,6 +38,7 @@ typedef struct PIIX3State {
} PIIX3State;
typedef struct PIIX3IrqState {
+ PIIX3State *piix3;
qemu_irq *pic;
} PIIX3IrqState;
@@ -217,8 +218,6 @@ static int i440fx_initfn(PCIDevice *dev)
return 0;
}
-static PIIX3State *piix3_dev;
-
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic)
{
DeviceState *dev;
@@ -238,8 +237,9 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *
d = pci_create_simple(b, 0, "i440FX");
*pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
- piix3_dev = DO_UPCAST(PIIX3State, dev, pci_create_simple(b, -1, "PIIX3"));
- *piix3_devfn = piix3_dev->dev.devfn;
+ irq_state->piix3 = DO_UPCAST(PIIX3State, dev,
+ pci_create_simple(b, -1, "PIIX3"));
+ *piix3_devfn = irq_state->piix3->dev.devfn;
return b;
}
@@ -255,13 +255,13 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)
/* now we change the pic irq level according to the piix irq mappings */
/* XXX: optimize */
- pic_irq = piix3_dev->dev.config[0x60 + irq_num];
+ pic_irq = irq_state->piix3->dev.config[0x60 + irq_num];
if (pic_irq < 16) {
/* The pic level is the logical OR of all the PCI irqs mapped
to it */
pic_level = 0;
for (i = 0; i < 4; i++) {
- if (pic_irq == piix3_dev->dev.config[0x60 + i])
+ if (pic_irq == irq_state->piix3->dev.config[0x60 + i])
pic_level |= pci_irq_levels[i];
}
qemu_set_irq(irq_state->pic[pic_irq], pic_level);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 11/16] Save irq_state into PCII440FXState
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (9 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 10/16] We can add piix3_dev now to PIIX3IrqState Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 12/16] pci_irq_levels[] belong to PIIX3State Juan Quintela
` (5 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 92884d9..5f34678 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -46,6 +46,7 @@ struct PCII440FXState {
PCIDevice dev;
target_phys_addr_t isa_page_descs[384 / 4];
uint8_t smm_enabled;
+ PIIX3IrqState *irq_state;
};
static void i440fx_addr_writel(void* opaque, uint32_t addr, uint32_t val)
@@ -236,6 +237,7 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *
d = pci_create_simple(b, 0, "i440FX");
*pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
+ (*pi440fx_state)->irq_state = irq_state;
irq_state->piix3 = DO_UPCAST(PIIX3State, dev,
pci_create_simple(b, -1, "PIIX3"));
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 12/16] pci_irq_levels[] belong to PIIX3State
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (10 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 11/16] Save irq_state into PCII440FXState Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 13/16] Update SaveVM versions Juan Quintela
` (4 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
With previous cleanups, now it is possible to put it where it belongs
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 5f34678..80296ac 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -35,6 +35,7 @@ typedef PCIHostState I440FXState;
typedef struct PIIX3State {
PCIDevice dev;
+ int pci_irq_levels[4];
} PIIX3State;
typedef struct PIIX3IrqState {
@@ -73,8 +74,6 @@ static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
return (irq_num + slot_addend) & 3;
}
-static int pci_irq_levels[4];
-
static void update_pam(PCII440FXState *d, uint32_t start, uint32_t end, int r)
{
uint32_t addr;
@@ -164,7 +163,7 @@ static void i440fx_save(QEMUFile* f, void *opaque)
qemu_put_8s(f, &d->smm_enabled);
for (i = 0; i < 4; i++)
- qemu_put_be32(f, pci_irq_levels[i]);
+ qemu_put_be32(f, d->irq_state->piix3->pci_irq_levels[i]);
}
static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
@@ -182,7 +181,7 @@ static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
if (version_id >= 2)
for (i = 0; i < 4; i++)
- pci_irq_levels[i] = qemu_get_be32(f);
+ d->irq_state->piix3->pci_irq_levels[i] = qemu_get_be32(f);
return 0;
}
@@ -253,7 +252,7 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)
int i, pic_irq, pic_level;
PIIX3IrqState *irq_state = opaque;
- pci_irq_levels[irq_num] = level;
+ irq_state->piix3->pci_irq_levels[irq_num] = level;
/* now we change the pic irq level according to the piix irq mappings */
/* XXX: optimize */
@@ -264,7 +263,7 @@ static void piix3_set_irq(void *opaque, int irq_num, int level)
pic_level = 0;
for (i = 0; i < 4; i++) {
if (pic_irq == irq_state->piix3->dev.config[0x60 + i])
- pic_level |= pci_irq_levels[i];
+ pic_level |= irq_state->piix3->pci_irq_levels[i];
}
qemu_set_irq(irq_state->pic[pic_irq], pic_level);
}
@@ -307,7 +306,7 @@ static void piix3_reset(void *opaque)
pci_conf[0xac] = 0x00;
pci_conf[0xae] = 0x00;
- memset(pci_irq_levels, 0, sizeof(pci_irq_levels));
+ memset(d->pci_irq_levels, 0, sizeof(d->pci_irq_levels));
}
static void piix_save(QEMUFile* f, void *opaque)
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 13/16] Update SaveVM versions
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (11 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 12/16] pci_irq_levels[] belong to PIIX3State Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 14/16] VMState: Fix sub-structs versioning Juan Quintela
` (3 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Now that we have all fields belonging to a PCIDevice, save each field
on the device that it belongs. This means moving pci_irq_levels
from PCII440FXState to PIIX3State.
Old formats are loaded, but we only save on the new saner format.
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 40 +++++++++++++++++++++++++---------------
1 files changed, 25 insertions(+), 15 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 80296ac..a044883 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -157,13 +157,9 @@ static void i440fx_write_config(PCIDevice *dev,
static void i440fx_save(QEMUFile* f, void *opaque)
{
PCII440FXState *d = opaque;
- int i;
pci_device_save(&d->dev, f);
qemu_put_8s(f, &d->smm_enabled);
-
- for (i = 0; i < 4; i++)
- qemu_put_be32(f, d->irq_state->piix3->pci_irq_levels[i]);
}
static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
@@ -171,7 +167,7 @@ static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
PCII440FXState *d = opaque;
int ret, i;
- if (version_id > 2)
+ if (version_id > 3)
return -EINVAL;
ret = pci_device_load(&d->dev, f);
if (ret < 0)
@@ -179,7 +175,7 @@ static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
i440fx_update_memory_mappings(d);
qemu_get_8s(f, &d->smm_enabled);
- if (version_id >= 2)
+ if (version_id == 2)
for (i = 0; i < 4; i++)
d->irq_state->piix3->pci_irq_levels[i] = qemu_get_be32(f);
@@ -214,7 +210,7 @@ static int i440fx_initfn(PCIDevice *dev)
d->dev.config[0x72] = 0x02; /* SMRAM */
- register_savevm("I440FX", 0, 2, i440fx_save, i440fx_load, d);
+ register_savevm("I440FX", 0, 3, i440fx_save, i440fx_load, d);
return 0;
}
@@ -309,18 +305,32 @@ static void piix3_reset(void *opaque)
memset(d->pci_irq_levels, 0, sizeof(d->pci_irq_levels));
}
-static void piix_save(QEMUFile* f, void *opaque)
+static void piix3_save(QEMUFile* f, void *opaque)
{
- PCIDevice *d = opaque;
- pci_device_save(d, f);
+ PIIX3State *d = opaque;
+ int i;
+
+ pci_device_save(&d->dev, f);
+
+ for (i = 0; i < 4; i++)
+ qemu_put_be32(f, d->pci_irq_levels[i]);
}
-static int piix_load(QEMUFile* f, void *opaque, int version_id)
+static int piix3_load(QEMUFile* f, void *opaque, int version_id)
{
- PCIDevice *d = opaque;
- if (version_id != 2)
+ PIIX3State *d = opaque;
+ int i, ret;
+
+ if (version_id > 3 || version_id < 2)
return -EINVAL;
- return pci_device_load(d, f);
+ ret = pci_device_load(&d->dev, f);
+ if (ret < 0)
+ return ret;
+ if (version_id >= 3) {
+ for (i = 0; i < 4; i++)
+ d->pci_irq_levels[i] = qemu_get_be32(f);
+ }
+ return 0;
}
static int piix3_initfn(PCIDevice *dev)
@@ -329,7 +339,7 @@ static int piix3_initfn(PCIDevice *dev)
uint8_t *pci_conf;
isa_bus_new(&d->dev.qdev);
- register_savevm("PIIX3", 0, 2, piix_save, piix_load, d);
+ register_savevm("PIIX3", 0, 3, piix3_save, piix3_load, d);
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 14/16] VMState: Fix sub-structs versioning
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (12 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 13/16] Update SaveVM versions Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 15/16] i440fx: use new vmstate infrastructure Juan Quintela
` (2 subsequent siblings)
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
We can't check the version in a substruct, it is not stored anywhere
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
savevm.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/savevm.c b/savevm.c
index 2b4054a..99fad79 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1048,7 +1048,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
void *addr = base_addr + field->size * i;
if (field->flags & VMS_STRUCT) {
- ret = vmstate_load_state(f, field->vmsd, addr, version_id);
+ ret = vmstate_load_state(f, field->vmsd, addr, field->vmsd->version_id);
} else {
ret = field->info->get(f, addr, field->size);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 15/16] i440fx: use new vmstate infrastructure
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (13 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 14/16] VMState: Fix sub-structs versioning Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:28 ` [Qemu-devel] [PATCH 16/16] piix3: " Juan Quintela
2009-08-28 13:32 ` [Qemu-devel] Re: [PATCH 00/16] *** SUBJECT HERE *** Juan Quintela
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 36 ++++++++++++++++++++++++------------
1 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index a044883..5c33741 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -154,21 +154,11 @@ static void i440fx_write_config(PCIDevice *dev,
i440fx_update_memory_mappings(d);
}
-static void i440fx_save(QEMUFile* f, void *opaque)
-{
- PCII440FXState *d = opaque;
-
- pci_device_save(&d->dev, f);
- qemu_put_8s(f, &d->smm_enabled);
-}
-
-static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
+static int i440fx_load_old(QEMUFile* f, void *opaque, int version_id)
{
PCII440FXState *d = opaque;
int ret, i;
- if (version_id > 3)
- return -EINVAL;
ret = pci_device_load(&d->dev, f);
if (ret < 0)
return ret;
@@ -182,6 +172,28 @@ static int i440fx_load(QEMUFile* f, void *opaque, int version_id)
return 0;
}
+static int i440fx_after_load(void *opaque)
+{
+ PCII440FXState *d = opaque;
+
+ i440fx_update_memory_mappings(d);
+ return 0;
+}
+
+static const VMStateDescription vmstate_i440fx = {
+ .name = "I440FX",
+ .version_id = 3,
+ .minimum_version_id = 3,
+ .minimum_version_id_old = 1,
+ .load_state_old = i440fx_load_old,
+ .run_after_load = i440fx_after_load,
+ .fields = (VMStateField []) {
+ VMSTATE_PCI_DEVICE(dev, PCII440FXState),
+ VMSTATE_UINT8(smm_enabled, PCII440FXState),
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static int i440fx_pcihost_initfn(SysBusDevice *dev)
{
I440FXState *s = FROM_SYSBUS(I440FXState, dev);
@@ -210,7 +222,7 @@ static int i440fx_initfn(PCIDevice *dev)
d->dev.config[0x72] = 0x02; /* SMRAM */
- register_savevm("I440FX", 0, 3, i440fx_save, i440fx_load, d);
+ vmstate_register(0, &vmstate_i440fx, d);
return 0;
}
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] [PATCH 16/16] piix3: use new vmstate infrastructure
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (14 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 15/16] i440fx: use new vmstate infrastructure Juan Quintela
@ 2009-08-28 13:28 ` Juan Quintela
2009-08-28 13:32 ` [Qemu-devel] Re: [PATCH 00/16] *** SUBJECT HERE *** Juan Quintela
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:28 UTC (permalink / raw)
To: qemu-devel
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
hw/piix_pci.c | 38 +++++++++++---------------------------
1 files changed, 11 insertions(+), 27 deletions(-)
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 5c33741..ef3463b 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -317,33 +317,17 @@ static void piix3_reset(void *opaque)
memset(d->pci_irq_levels, 0, sizeof(d->pci_irq_levels));
}
-static void piix3_save(QEMUFile* f, void *opaque)
-{
- PIIX3State *d = opaque;
- int i;
-
- pci_device_save(&d->dev, f);
-
- for (i = 0; i < 4; i++)
- qemu_put_be32(f, d->pci_irq_levels[i]);
-}
-
-static int piix3_load(QEMUFile* f, void *opaque, int version_id)
-{
- PIIX3State *d = opaque;
- int i, ret;
-
- if (version_id > 3 || version_id < 2)
- return -EINVAL;
- ret = pci_device_load(&d->dev, f);
- if (ret < 0)
- return ret;
- if (version_id >= 3) {
- for (i = 0; i < 4; i++)
- d->pci_irq_levels[i] = qemu_get_be32(f);
+static const VMStateDescription vmstate_piix3 = {
+ .name = "PIIX3",
+ .version_id = 3,
+ .minimum_version_id = 2,
+ .minimum_version_id_old = 2,
+ .fields = (VMStateField []) {
+ VMSTATE_PCI_DEVICE(dev, PIIX3State),
+ VMSTATE_INT32_ARRAY_V(pci_irq_levels, PIIX3State, 4, 3),
+ VMSTATE_END_OF_LIST()
}
- return 0;
-}
+};
static int piix3_initfn(PCIDevice *dev)
{
@@ -351,7 +335,7 @@ static int piix3_initfn(PCIDevice *dev)
uint8_t *pci_conf;
isa_bus_new(&d->dev.qdev);
- register_savevm("PIIX3", 0, 3, piix3_save, piix3_load, d);
+ vmstate_register(0, &vmstate_piix3, d);
pci_conf = d->dev.config;
pci_config_set_vendor_id(pci_conf, PCI_VENDOR_ID_INTEL);
--
1.6.2.5
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [Qemu-devel] Re: [PATCH 00/16] *** SUBJECT HERE ***
2009-08-28 13:28 [Qemu-devel] [PATCH v4 00/16] piix_pci cleanup Juan Quintela
` (15 preceding siblings ...)
2009-08-28 13:28 ` [Qemu-devel] [PATCH 16/16] piix3: " Juan Quintela
@ 2009-08-28 13:32 ` Juan Quintela
16 siblings, 0 replies; 18+ messages in thread
From: Juan Quintela @ 2009-08-28 13:32 UTC (permalink / raw)
To: qemu-devel
Juan Quintela <quintela@redhat.com> wrote:
> *** BLURB HERE ***
for (i=0; i < 100000; i++)
I will rememeber to remove *~ flags before using the git-send-mail command
Sorry, Juan.
> Juan Quintela (16):
> piix4 don't use pci_irq_levels at all
> Split piix4 support from piix_pci.c
> low_set_irq is not used anywhere
> Use PCII440FXState instead of generic PCIDevice
> Move smm_enabled and isa_memory_mappings to PCII440FXState
> We want the argument pass to set_irq to be opaque
> Create PIIX3State instead of using PCIDevice for PIIX3
> Introduce PIIX3IrqState for piix3 irq's state
> Fold piix3_init() intto i440fx_init
> We can add piix3_dev now to PIIX3IrqState
> Save irq_state into PCII440FXState
> pci_irq_levels[] belong to PIIX3State
> Update SaveVM versions
> VMState: Fix sub-structs versioning
> i440fx: use new vmstate infrastructure
> piix3: use new vmstate infrastructure
>
> Makefile.target | 2 +-
> hw/apb_pci.c | 4 +-
> hw/grackle_pci.c | 4 +-
> hw/gt64xxx.c | 3 +-
> hw/pc.c | 5 +-
> hw/pc.h | 11 ++-
> hw/pci.c | 8 +-
> hw/pci.h | 6 +-
> hw/piix4.c | 128 ++++++++++++++++++++++++
> hw/piix_pci.c | 275 +++++++++++++++++++++-------------------------------
> hw/ppc4xx_pci.c | 4 +-
> hw/ppce500_pci.c | 4 +-
> hw/prep_pci.c | 4 +-
> hw/r2d.c | 4 +-
> hw/sh_pci.c | 4 +-
> hw/unin_pci.c | 4 +-
> hw/versatile_pci.c | 4 +-
> savevm.c | 2 +-
> 18 files changed, 284 insertions(+), 192 deletions(-)
> create mode 100644 hw/piix4.c
^ permalink raw reply [flat|nested] 18+ messages in thread