[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 13/50] dino: change dino_init() to return the DINO device inst
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v2 13/50] dino: change dino_init() to return the DINO device instead of PCIBus |
Date: |
Wed, 4 May 2022 10:25:23 +0100 |
This is in preparation for using more qdev APIs during the configuration of the
HPPA generic machine.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
---
hw/hppa/dino.c | 8 +++-----
hw/hppa/hppa_sys.h | 3 ++-
hw/hppa/machine.c | 6 ++++--
3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/hw/hppa/dino.c b/hw/hppa/dino.c
index 01546ff6fc..6c488c908e 100644
--- a/hw/hppa/dino.c
+++ b/hw/hppa/dino.c
@@ -409,12 +409,11 @@ static void dino_set_serial_irq(void *opaque, int irq,
int level)
dino_set_irq(opaque, 10, level);
}
-PCIBus *dino_init(MemoryRegion *addr_space,
- qemu_irq *p_rtc_irq, qemu_irq *p_ser_irq)
+DinoState *dino_init(MemoryRegion *addr_space,
+ qemu_irq *p_rtc_irq, qemu_irq *p_ser_irq)
{
DeviceState *dev;
DinoState *s;
- PCIBus *pci_bus;
dev = qdev_new(TYPE_DINO_PCI_HOST_BRIDGE);
object_property_set_link(OBJECT(dev), "memory-as", OBJECT(addr_space),
@@ -428,8 +427,7 @@ PCIBus *dino_init(MemoryRegion *addr_space,
*p_rtc_irq = qemu_allocate_irq(dino_set_timer_irq, s, 0);
*p_ser_irq = qemu_allocate_irq(dino_set_serial_irq, s, 0);
- pci_bus = PCI_BUS(qdev_get_child_bus(dev, "pci"));
- return pci_bus;
+ return s;
}
static void dino_pcihost_reset(DeviceState *dev)
diff --git a/hw/hppa/hppa_sys.h b/hw/hppa/hppa_sys.h
index 9d8b28ec01..88773d2c35 100644
--- a/hw/hppa/hppa_sys.h
+++ b/hw/hppa/hppa_sys.h
@@ -9,8 +9,9 @@
#include "hw/intc/i8259.h"
#include "hppa_hardware.h"
+#include "dino.h"
-PCIBus *dino_init(MemoryRegion *, qemu_irq *, qemu_irq *);
+DinoState *dino_init(MemoryRegion *, qemu_irq *, qemu_irq *);
DeviceState *lasi_init(MemoryRegion *);
#define enable_lasi_lan() 0
diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index 971d7ffcfe..94bc1b202a 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -17,6 +17,7 @@
#include "hw/char/serial.h"
#include "hw/net/lasi_82596.h"
#include "hw/nmi.h"
+#include "dino.h"
#include "hppa_sys.h"
#include "qemu/units.h"
#include "qapi/error.h"
@@ -126,7 +127,7 @@ static void machine_hppa_init(MachineState *machine)
const char *kernel_filename = machine->kernel_filename;
const char *kernel_cmdline = machine->kernel_cmdline;
const char *initrd_filename = machine->initrd_filename;
- DeviceState *dev;
+ DeviceState *dev, *dino_dev;
PCIBus *pci_bus;
ISABus *isa_bus;
qemu_irq rtc_irq, serial_irq;
@@ -166,7 +167,8 @@ static void machine_hppa_init(MachineState *machine)
lasi_init(addr_space);
/* Init Dino (PCI host bus chip). */
- pci_bus = dino_init(addr_space, &rtc_irq, &serial_irq);
+ dino_dev = DEVICE(dino_init(addr_space, &rtc_irq, &serial_irq));
+ pci_bus = PCI_BUS(qdev_get_child_bus(dino_dev, "pci"));
assert(pci_bus);
/* Create ISA bus. */
--
2.20.1
- Re: [PATCH v2 09/50] dino: use QOM cast instead of directly referencing parent_obj, (continued)
- [PATCH v2 11/50] dino: split declarations from dino.c into dino.h, Mark Cave-Ayland, 2022/05/04
- [PATCH v2 14/50] machine.c: map DINO device during board configuration, Mark Cave-Ayland, 2022/05/04
- [PATCH v2 06/50] dino: move pci_setup_iommu() to dino_pcihost_init(), Mark Cave-Ayland, 2022/05/04
- [PATCH v2 10/50] dino: return PCIBus from dino_init() using qdev_get_child_bus(), Mark Cave-Ayland, 2022/05/04
- [PATCH v2 17/50] dino: wire up serial IRQ using a qdev GPIO in machine.c, Mark Cave-Ayland, 2022/05/04
- [PATCH v2 13/50] dino: change dino_init() to return the DINO device instead of PCIBus,
Mark Cave-Ayland <=
- [PATCH v2 15/50] dino.h: add defines for DINO IRQ numbers, Mark Cave-Ayland, 2022/05/04
- [PATCH v2 18/50] dino: remove unused dino_set_timer_irq() IRQ handler, Mark Cave-Ayland, 2022/05/04
- [PATCH v2 12/50] hppa: use new CONFIG_HPPA_B160L option instead of CONFIG_DINO to build hppa machine, Mark Cave-Ayland, 2022/05/04
- [PATCH v2 16/50] dino: define IRQ inputs as qdev GPIOs, Mark Cave-Ayland, 2022/05/04