[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 8/8] hw/mips/fuloong2e: Open code bonito_init()
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 8/8] hw/mips/fuloong2e: Open code bonito_init() |
Date: |
Thu, 5 Jan 2023 14:07:10 +0100 |
This helper is trivial and is called once, directly open-code it.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/mips/fuloong2e.c | 6 +++++-
hw/pci-host/bonito.c | 15 ---------------
include/hw/mips/mips.h | 3 ---
3 files changed, 5 insertions(+), 19 deletions(-)
diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c
index 34befa5dd5..f41e19dc3f 100644
--- a/hw/mips/fuloong2e.c
+++ b/hw/mips/fuloong2e.c
@@ -32,6 +32,7 @@
#include "hw/mips/bootloader.h"
#include "hw/mips/cpudevs.h"
#include "hw/pci/pci.h"
+#include "hw/pci-host/bonito.h"
#include "hw/loader.h"
#include "hw/ide/pci.h"
#include "hw/qdev-properties.h"
@@ -292,7 +293,10 @@ static void mips_fuloong2e_init(MachineState *machine)
cpu_mips_clock_init(cpu);
/* North bridge, Bonito --> IP2 */
- pci_bus = bonito_init((qemu_irq *)&(env->irq[2]));
+ dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE);
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
+ sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, env->irq[2]);
+ pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci"));
/* South bridge -> IP5 */
pci_dev = pci_create_simple_multifunction(pci_bus,
diff --git a/hw/pci-host/bonito.c b/hw/pci-host/bonito.c
index df61b051b0..ca5fa2a155 100644
--- a/hw/pci-host/bonito.c
+++ b/hw/pci-host/bonito.c
@@ -44,7 +44,6 @@
#include "qemu/error-report.h"
#include "hw/pci/pci.h"
#include "hw/irq.h"
-#include "hw/mips/mips.h"
#include "hw/pci-host/bonito.h"
#include "hw/pci/pci_host.h"
#include "migration/vmstate.h"
@@ -750,20 +749,6 @@ static void bonito_pci_realize(PCIDevice *dev, Error
**errp)
pci_set_byte(dev->config + PCI_MAX_LAT, 0x00);
}
-PCIBus *bonito_init(qemu_irq *pic)
-{
- DeviceState *dev;
- PCIHostState *phb;
-
- dev = qdev_new(TYPE_BONITO_PCI_HOST_BRIDGE);
- phb = PCI_HOST_BRIDGE(dev);
- sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
-
- sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, *pic);
-
- return phb->bus;
-}
-
static void bonito_pci_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
diff --git a/include/hw/mips/mips.h b/include/hw/mips/mips.h
index 101799f7d3..4d2db99952 100644
--- a/include/hw/mips/mips.h
+++ b/include/hw/mips/mips.h
@@ -9,9 +9,6 @@
#include "exec/memory.h"
-/* bonito.c */
-PCIBus *bonito_init(qemu_irq *pic);
-
/* rc4030.c */
typedef struct rc4030DMAState *rc4030_dma;
void rc4030_dma_read(void *dma, uint8_t *buf, int len);
--
2.38.1
- [PATCH 0/8] hw/pci-host/bonito: Housekeeping, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 1/8] hw/pci-host/bonito: Convert to 3-phase reset, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 2/8] hw/pci-host/bonito: Use 'bonito_host' for PCI host bridge code, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 3/8] hw/pci-host/bonito: Use 'bonito_pci' for PCI function #0 code, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 4/8] hw/pci-host/bonito: Set reference using object_property_add_const_link(), Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 8/8] hw/mips/fuloong2e: Open code bonito_init(),
Philippe Mathieu-Daudé <=
- [PATCH 5/8] hw/pci-host/bonito: Create PCI function #0 in bridge realize() handler, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 7/8] hw/pci-host/bonito: Declare TYPE_BONITO_PCI_HOST_BRIDGE in header, Philippe Mathieu-Daudé, 2023/01/05
- [PATCH 6/8] hw/pci-host/bonito: Sysbus'ify outgoing IRQ, Philippe Mathieu-Daudé, 2023/01/05
- Re: [PATCH 0/8] hw/pci-host/bonito: Housekeeping, Philippe Mathieu-Daudé, 2023/01/13