[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/13] Fold piix3_init() into i440fx_init
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PATCH 09/13] Fold piix3_init() into i440fx_init |
Date: |
Mon, 24 Aug 2009 16:16:54 +0200 |
i440fx_init will now work properly if we don't setup piix3
Signed-off-by: Juan Quintela <address@hidden>
---
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 a908f8b..74b6829 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1268,8 +1268,7 @@ static void pc_init1(ram_addr_t ram_size,
ferr_irq = i8259[13];
if (pci_enabled) {
- pci_bus = i440fx_init(&i440fx_state, i8259);
- piix3_devfn = piix3_init(pci_bus, -1);
+ pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, i8259);
} else {
pci_bus = NULL;
}
diff --git a/hw/pc.h b/hw/pc.h
index 7733d1a..fd148fb 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -122,9 +122,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 0443a1d..66aeb72 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -215,7 +215,9 @@ static void i440fx_initfn(PCIDevice *dev)
register_savevm("I440FX", 0, 2, i440fx_save, i440fx_load, d);
}
-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;
@@ -234,13 +236,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;
@@ -332,19 +335,10 @@ static void 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);
}
-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
- [Qemu-devel] [PATCH v2 00/13] piix_pci cleanup, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 01/13] piix4 don't use pci_irq_levels at all, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 02/13] Split piix4 support from piix_pci.c, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 03/13] low_set_irq is not used anywhere, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 04/13] Use PCII440FXState instead of generic PCIDevice, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 05/13] Move smm_enabled and isa_memory_mappings to PCII440FXState, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 06/13] We want the argument pass to set_irq to be opaque, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 08/13] Introduce PIIX3IrqState for piix3 irq's state, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 07/13] Create PIIX3State instead of using PCIDevice for PIIX3, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 09/13] Fold piix3_init() into i440fx_init,
Juan Quintela <=
- [Qemu-devel] [PATCH 11/13] Save irq_state into PCII440FXState, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 10/13] We can add piix3_dev now to PIIX3IrqState, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 13/13] Update SaveVM versions, Juan Quintela, 2009/08/24
- [Qemu-devel] [PATCH 12/13] pci_irq_levels[] belong to PIIX3State, Juan Quintela, 2009/08/24