[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/20] hw/pci-host/piix: Extract piix3_create()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 13/20] hw/pci-host/piix: Extract piix3_create() |
Date: |
Mon, 28 Oct 2019 17:34:40 +0100 |
Extract the PIIX3 creation code from the i440fx_init() function.
Reviewed-by: Aleksandar Markovic <address@hidden>
Reviewed-by: Esteban Bosse <address@hidden>
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/pci-host/piix.c | 51 ++++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 20 deletions(-)
diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c
index 2f4cbcbfe9..3292703de7 100644
--- a/hw/pci-host/piix.c
+++ b/hw/pci-host/piix.c
@@ -331,6 +331,36 @@ static void i440fx_realize(PCIDevice *dev, Error **errp)
}
}
+static PIIX3State *piix3_create(PCIBus *pci_bus, ISABus **isa_bus)
+{
+ PIIX3State *piix3;
+ PCIDevice *pci_dev;
+
+ /*
+ * Xen supports additional interrupt routes from the PCI devices to
+ * the IOAPIC: the four pins of each PCI device on the bus are also
+ * connected to the IOAPIC directly.
+ * These additional routes can be discovered through ACPI.
+ */
+ if (xen_enabled()) {
+ pci_dev = pci_create_simple_multifunction(pci_bus, -1, true,
+ TYPE_PIIX3_XEN_DEVICE);
+ piix3 = PIIX3_PCI_DEVICE(pci_dev);
+ pci_bus_irqs(pci_bus, xen_piix3_set_irq, xen_pci_slot_get_pirq,
+ piix3, XEN_PIIX_NUM_PIRQS);
+ } else {
+ pci_dev = pci_create_simple_multifunction(pci_bus, -1, true,
+ TYPE_PIIX3_DEVICE);
+ piix3 = PIIX3_PCI_DEVICE(pci_dev);
+ pci_bus_irqs(pci_bus, piix3_set_irq, pci_slot_get_pirq,
+ piix3, PIIX_NUM_PIRQS);
+ pci_bus_set_route_irq_fn(pci_bus, piix3_route_intx_pin_to_irq);
+ }
+ *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
+
+ return piix3;
+}
+
PCIBus *i440fx_init(const char *host_type, const char *pci_type,
PCII440FXState **pi440fx_state,
int *piix3_devfn,
@@ -400,27 +430,8 @@ PCIBus *i440fx_init(const char *host_type, const char
*pci_type,
PAM_EXPAN_SIZE);
}
- /* Xen supports additional interrupt routes from the PCI devices to
- * the IOAPIC: the four pins of each PCI device on the bus are also
- * connected to the IOAPIC directly.
- * These additional routes can be discovered through ACPI. */
- if (xen_enabled()) {
- PCIDevice *pci_dev = pci_create_simple_multifunction(b,
- -1, true, TYPE_PIIX3_XEN_DEVICE);
- piix3 = PIIX3_PCI_DEVICE(pci_dev);
- pci_bus_irqs(b, xen_piix3_set_irq, xen_pci_slot_get_pirq,
- piix3, XEN_PIIX_NUM_PIRQS);
- } else {
- PCIDevice *pci_dev = pci_create_simple_multifunction(b,
- -1, true, TYPE_PIIX3_DEVICE);
- piix3 = PIIX3_PCI_DEVICE(pci_dev);
- pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3,
- PIIX_NUM_PIRQS);
- pci_bus_set_route_irq_fn(b, piix3_route_intx_pin_to_irq);
- }
+ piix3 = piix3_create(b, isa_bus);
piix3->pic = pic;
- *isa_bus = ISA_BUS(qdev_get_child_bus(DEVICE(piix3), "isa.0"));
-
*piix3_devfn = piix3->dev.devfn;
ram_size = ram_size / 8 / 1024 / 1024;
--
2.21.0
- [PULL 03/20] piix4: Add an i8259 Interrupt Controller as specified in datasheet, (continued)
- [PULL 03/20] piix4: Add an i8259 Interrupt Controller as specified in datasheet, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 05/20] piix4: Rename PIIX4 object to piix4-isa, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 04/20] Revert "irq: introduce qemu_irq_proxy()", Philippe Mathieu-Daudé, 2019/10/28
- [PULL 06/20] piix4: Add an i8257 DMA Controller as specified in datasheet, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 07/20] piix4: Add an i8254 PIT Controller as specified in datasheet, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 09/20] hw/mips/mips_malta: Create IDE hard drive array dynamically, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 08/20] piix4: Add a MC146818 RTC Controller as specified in datasheet, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 11/20] hw/isa/piix4: Move piix4_create() to hw/isa/piix4.c, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 10/20] hw/mips/mips_malta: Extract the PIIX4 creation code as piix4_create(), Philippe Mathieu-Daudé, 2019/10/28
- [PULL 12/20] hw/i386: Remove obsolete LoadStateHandler::load_state_old handlers, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 13/20] hw/pci-host/piix: Extract piix3_create(),
Philippe Mathieu-Daudé <=
- [PULL 14/20] hw/pci-host/piix: Move RCR_IOPORT register definition, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 15/20] hw/pci-host/piix: Define and use the PIIX IRQ Route Control Registers, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 17/20] hw/pci-host/piix: Fix code style issues, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 16/20] hw/pci-host/piix: Move i440FX declarations to hw/pci-host/i440fx.h, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 19/20] hw/pci-host: Rename incorrectly named 'piix' as 'i440fx', Philippe Mathieu-Daudé, 2019/10/28
- [PULL 18/20] hw/pci-host/piix: Extract PIIX3 functions to hw/isa/piix3.c, Philippe Mathieu-Daudé, 2019/10/28
- [PULL 20/20] hw/pci-host/i440fx: Remove the last PIIX3 traces, Philippe Mathieu-Daudé, 2019/10/28
- Re: [PULL 00/20] hw/i386/pc: Split PIIX3 southbridge from i440FX northbridge, no-reply, 2019/10/28
- Re: [PULL 00/20] hw/i386/pc: Split PIIX3 southbridge from i440FX northbridge, no-reply, 2019/10/28
- Re: [PULL 00/20] hw/i386/pc: Split PIIX3 southbridge from i440FX northbridge, no-reply, 2019/10/28