[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH for-1.2 v7 12/14] pci_host: Turn into SysBus-derived
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH for-1.2 v7 12/14] pci_host: Turn into SysBus-derived QOM type |
Date: |
Mon, 20 Aug 2012 19:08:07 +0200 |
From: Andreas Färber <address@hidden>
The preceding commits fixed misuses of FROM_SYSBUS() that led people to
add a bogus busdev field. For qdev the field order was less relevant but
for QOM the PCIHostState field (including the SysBusDevice actually
initialized with a value) must be placed first within the state struct.
To facilitate accessing the PCIHostState fields, derive all PCI host
bridges from TYPE_PCI_HOST_BRIDGE rather than TYPE_SYS_BUS_DEVICE.
We can now access PCIHostState QOM-style, with PCI_HOST_BRIDGE() macro.
Signed-off-by: Anthony Liguori <address@hidden>
Signed-off-by: Wanpeng Li <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
Acked-by: Michael S. Tsirkin <address@hidden>
---
hw/pci_host.c | 12 ++++++++++++
hw/pci_host.h | 5 +++++
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/hw/pci_host.c b/hw/pci_host.c
index 8041778..3950e94 100644
--- a/hw/pci_host.c
+++ b/hw/pci_host.c
@@ -165,4 +165,16 @@ const MemoryRegionOps pci_host_data_be_ops = {
.endianness = DEVICE_BIG_ENDIAN,
};
+static const TypeInfo pci_host_type_info = {
+ .name = TYPE_PCI_HOST_BRIDGE,
+ .parent = TYPE_SYS_BUS_DEVICE,
+ .abstract = true,
+ .instance_size = sizeof(PCIHostState),
+};
+
+static void pci_host_register_types(void)
+{
+ type_register_static(&pci_host_type_info);
+}
+type_init(pci_host_register_types)
diff --git a/hw/pci_host.h b/hw/pci_host.h
index 359e38f..4b9c300 100644
--- a/hw/pci_host.h
+++ b/hw/pci_host.h
@@ -30,8 +30,13 @@
#include "sysbus.h"
+#define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
+#define PCI_HOST_BRIDGE(obj) \
+ OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST_BRIDGE)
+
struct PCIHostState {
SysBusDevice busdev;
+
MemoryRegion conf_mem;
MemoryRegion data_mem;
MemoryRegion mmcfg;
--
1.7.7
- [Qemu-devel] [PATCH for-1.2 v7 05/14] grackle_pci: QOM'ify Grackle PCI host bridge, (continued)
- [Qemu-devel] [PATCH for-1.2 v7 05/14] grackle_pci: QOM'ify Grackle PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 03/14] bonito: QOM'ify Bonito PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 04/14] dec_pci: QOM'ify DEC 21154 PCI-PCI bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 02/14] alpha_typhoon: QOM'ify Typhoon PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 01/14] pci: Make host bridge TypeInfos const, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 06/14] gt64xxx: QOM'ify GT64120 PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 08/14] ppce500_pci: QOM'ify e500 PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 07/14] ppc4xx_pci: QOM'ify ppc4xx PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 09/14] prep_pci: QOM'ify Raven PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 10/14] spapr_pci: QOM'ify sPAPR PCI host bridge, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 12/14] pci_host: Turn into SysBus-derived QOM type,
Andreas Färber <=
- [Qemu-devel] [PATCH for-1.2 v7 14/14] pci: Tidy up PCI host bridges, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 13/14] pci: Derive PCI host bridges from TYPE_PCI_HOST_BRIDGE, Andreas Färber, 2012/08/20
- [Qemu-devel] [PATCH for-1.2 v7 11/14] unin_pci: QOM'ify UniNorth PCI host bridges, Andreas Färber, 2012/08/20