[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCHv2 06/15] apb: APB QOMify tidy-up
From: |
Mark Cave-Ayland |
Subject: |
[Qemu-devel] [PATCHv2 06/15] apb: APB QOMify tidy-up |
Date: |
Sun, 26 Nov 2017 12:34:37 +0000 |
Use DeviceClass rather than SysBusDeviceClass in pbm_host_class_init() and
adjust pci_pbm_init_device() accordingly.
Signed-off-by: Mark Cave-Ayland <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
---
hw/pci-host/apb.c | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/hw/pci-host/apb.c b/hw/pci-host/apb.c
index b0f80f6..c7837ef 100644
--- a/hw/pci-host/apb.c
+++ b/hw/pci-host/apb.c
@@ -705,12 +705,12 @@ static const MemoryRegionOps pci_config_ops = {
.endianness = DEVICE_LITTLE_ENDIAN,
};
-static int pci_pbm_init_device(SysBusDevice *dev)
+static int pci_pbm_init_device(DeviceState *dev)
{
- APBState *s;
+ APBState *s = APB_DEVICE(dev);
+ SysBusDevice *sbd = SYS_BUS_DEVICE(s);
unsigned int i;
- s = APB_DEVICE(dev);
for (i = 0; i < 8; i++) {
s->pci_irq_map[i] = (0x1f << 6) | (i << 2);
}
@@ -728,18 +728,18 @@ static int pci_pbm_init_device(SysBusDevice *dev)
memory_region_init_io(&s->apb_config, OBJECT(s), &apb_config_ops, s,
"apb-config", 0x10000);
/* at region 0 */
- sysbus_init_mmio(dev, &s->apb_config);
+ sysbus_init_mmio(sbd, &s->apb_config);
memory_region_init_io(&s->pci_config, OBJECT(s), &pci_config_ops, s,
"apb-pci-config", 0x1000000);
/* at region 1 */
- sysbus_init_mmio(dev, &s->pci_config);
+ sysbus_init_mmio(sbd, &s->pci_config);
/* pci_ioport */
memory_region_init(&s->pci_ioport, OBJECT(s), "apb-pci-ioport", 0x1000000);
/* at region 2 */
- sysbus_init_mmio(dev, &s->pci_ioport);
+ sysbus_init_mmio(sbd, &s->pci_ioport);
return 0;
}
@@ -783,11 +783,10 @@ static const TypeInfo pbm_pci_host_info = {
static void pbm_host_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
- SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass);
- k->init = pci_pbm_init_device;
- set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
+ dc->init = pci_pbm_init_device;
dc->reset = pci_pbm_reset;
+ set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
}
static const TypeInfo pbm_host_info = {
--
1.7.10.4
- [Qemu-devel] [PATCHv2 00/15] sun4u: tidy-up CPU, APB and ebus, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 02/15] sun4u: ebus QOMify tidy-up, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 04/15] sun4u: remove pci_ebus_init() function, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 05/15] sun4u: move initialisation of all ISABus devices into ebus_realize(), Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 07/15] apb: return APBState from pci_apb_init() rather than PCIBus, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 01/15] apb: move QOM macros and typedefs from apb.c to apb.h, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 08/15] apb: use gpios to wire up the apb device to the SPARC CPU IRQs, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 03/15] sun4u: move ISABus inside of EBusState, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 09/15] apb: move the two secondary PCI bridges objects into APBState, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 06/15] apb: APB QOMify tidy-up,
Mark Cave-Ayland <=
- [Qemu-devel] [PATCHv2 11/15] apb: split pci_pbm_map_irq() into separate functions for bus A and bus B, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 13/15] apb: replace OBIO interrupt numbers in pci_pbmA_map_irq() with constants, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 14/15] sparc64: introduce trace-events for hw/sparc64, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 15/15] sun4u: switch from EBUS_DPRINTF() macro to trace-events, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 10/15] apb: remove pci_apb_init() and instantiate APB device using qdev, Mark Cave-Ayland, 2017/11/26
- [Qemu-devel] [PATCHv2 12/15] ebus: wire up OBIO interrupts to APB pbm via qdev GPIOs, Mark Cave-Ayland, 2017/11/26