summary refs log tree commit diff stats
path: root/hw/piix_pci.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2009-08-28 15:28:20 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-09-04 09:37:24 -0500
commit85a750ca90ec78b4288b84b716dda2d90643ae7f (patch)
tree383712427affa2a2c95124ae26b7bc5f3bbd9599 /hw/piix_pci.c
parentbd7dce87eacd90ef99b0e625cc4d5f2ab4573a70 (diff)
downloadfocaccia-qemu-85a750ca90ec78b4288b84b716dda2d90643ae7f.tar.gz
focaccia-qemu-85a750ca90ec78b4288b84b716dda2d90643ae7f.zip
Fold piix3_init() intto i440fx_init
i440fx_init will now work properly if we don't setup piix3

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/piix_pci.c')
-rw-r--r--hw/piix_pci.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index b931f8439c..86582fe234 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",