Commit b44ff9d4 authored by Andreas Färber's avatar Andreas Färber Committed by Anthony Liguori
Browse files

pci_host: Turn into SysBus-derived QOM type

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: default avatarAnthony Liguori <>
Signed-off-by: default avatarWanpeng Li <>
Signed-off-by: default avatarAndreas Färber <>
Signed-off-by: default avatarAndreas Färber <>
Acked-by: default avatarMichael S. Tsirkin <>
Signed-off-by: default avatarAnthony Liguori <>
parent 57fd7b7f
......@@ -165,4 +165,16 @@ const MemoryRegionOps pci_host_data_be_ops = {
.endianness = DEVICE_BIG_ENDIAN,
static const TypeInfo pci_host_type_info = {
.abstract = true,
.instance_size = sizeof(PCIHostState),
static void pci_host_register_types(void)
......@@ -30,8 +30,13 @@
#include "sysbus.h"
#define TYPE_PCI_HOST_BRIDGE "pci-host-bridge"
#define PCI_HOST_BRIDGE(obj) \
struct PCIHostState {
SysBusDevice busdev;
MemoryRegion conf_mem;
MemoryRegion data_mem;
MemoryRegion mmcfg;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment