[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 10/18] spapr_pci: QOM'ify sPAPR PCI host bridge
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH v4 10/18] spapr_pci: QOM'ify sPAPR PCI host bridge |
Date: |
Thu, 26 Jul 2012 14:28:28 +0200 |
Introduce type constant. Introduce cast macro to drop bogus busdev field
that would've broken SYS_BUS_DEVICE().
Signed-off-by: Andreas Färber <address@hidden>
Reviewed-by: Anthony Liguori <address@hidden>
[AF: Moved type_init function rename here]
---
hw/spapr_pci.c | 13 +++++++------
hw/spapr_pci.h | 6 +++++-
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/hw/spapr_pci.c b/hw/spapr_pci.c
index b901d34..17cdbbd 100644
--- a/hw/spapr_pci.c
+++ b/hw/spapr_pci.c
@@ -276,7 +276,7 @@ static DMAContext *spapr_pci_dma_context_fn(PCIBus *bus,
void *opaque,
static int spapr_phb_init(SysBusDevice *s)
{
- sPAPRPHBState *phb = FROM_SYSBUS(sPAPRPHBState, s);
+ sPAPRPHBState *phb = SPAPR_PCI_HOST_BRIDGE(s);
char *namebuf;
int i;
PCIBus *bus;
@@ -314,7 +314,7 @@ static int spapr_phb_init(SysBusDevice *s)
memory_region_add_subregion(get_system_memory(), phb->io_win_addr,
&phb->iowindow);
- bus = pci_register_bus(&phb->busdev.qdev,
+ bus = pci_register_bus(DEVICE(s),
phb->busname ? phb->busname : phb->dtbusname,
pci_spapr_set_irq, pci_spapr_map_irq, phb,
&phb->memspace, &phb->iospace,
@@ -369,7 +369,7 @@ static void spapr_phb_class_init(ObjectClass *klass, void
*data)
}
static const TypeInfo spapr_phb_info = {
- .name = "spapr-pci-host-bridge",
+ .name = TYPE_SPAPR_PCI_HOST_BRIDGE,
.parent = TYPE_SYS_BUS_DEVICE,
.instance_size = sizeof(sPAPRPHBState),
.class_init = spapr_phb_class_init,
@@ -382,7 +382,7 @@ void spapr_create_phb(sPAPREnvironment *spapr,
{
DeviceState *dev;
- dev = qdev_create(NULL, spapr_phb_info.name);
+ dev = qdev_create(NULL, TYPE_SPAPR_PCI_HOST_BRIDGE);
if (busname) {
qdev_prop_set_string(dev, "busname", g_strdup(busname));
@@ -490,8 +490,9 @@ int spapr_populate_pci_devices(sPAPRPHBState *phb,
return 0;
}
-static void register_types(void)
+static void spapr_pci_register_types(void)
{
type_register_static(&spapr_phb_info);
}
-type_init(register_types)
+
+type_init(spapr_pci_register_types)
diff --git a/hw/spapr_pci.h b/hw/spapr_pci.h
index d9e46e2..06e2742 100644
--- a/hw/spapr_pci.h
+++ b/hw/spapr_pci.h
@@ -27,8 +27,12 @@
#include "hw/pci_host.h"
#include "hw/xics.h"
+#define TYPE_SPAPR_PCI_HOST_BRIDGE "spapr-pci-host-bridge"
+
+#define SPAPR_PCI_HOST_BRIDGE(obj) \
+ OBJECT_CHECK(sPAPRPHBState, (obj), TYPE_SPAPR_PCI_HOST_BRIDGE)
+
typedef struct sPAPRPHBState {
- SysBusDevice busdev;
PCIHostState host_state;
uint64_t buid;
--
1.7.7
- [Qemu-devel] [PATCH v4 00/18] pci_host: Convert to QOM, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 03/18] bonito: QOM'ify Bonito PCI host bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 05/18] grackle_pci: QOM'ify Grackle PCI host bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 02/18] alpha_typhoon: QOM'ify Typhoon PCI host bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 09/18] prep_pci: QOM'ify Raven PCI host bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 01/18] pci: Make host bridge TypeInfos const, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 04/18] dec_pci: QOM'ify DEC 21154 PCI-PCI bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 06/18] gt64xxx: QOM'ify GT64120 PCI host bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 08/18] ppce500_pci: QOM'ify e500 PCI host bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 10/18] spapr_pci: QOM'ify sPAPR PCI host bridge,
Andreas Färber <=
- [Qemu-devel] [PATCH v4 07/18] ppc4xx_pci: QOM'ify ppc4xx PCI host bridge, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 11/18] unin_pci: QOM'ify UniNorth PCI host bridges, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 13/18] pci: Derive PCI host bridges from TYPE_PCI_HOST_BRIDGE, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH v4 12/18] pci_host: Turn into SysBus-derived QOM type, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH RFC v4 15/18] MAINTAINERS: Document sPAPR (pSeries) machine, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH RFC v4 17/18] MAINTAINERS: Document Bamboo machine, Andreas Färber, 2012/07/26
- [Qemu-devel] [PATCH RFC v4 16/18] MAINTAINERS: Document e500 machine, Andreas Färber, 2012/07/26