[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V2 4/4] hw/pxb: add support for PCIe
From: |
Marcel Apfelbaum |
Subject: |
[Qemu-devel] [PATCH V2 4/4] hw/pxb: add support for PCIe |
Date: |
Sun, 15 Nov 2015 17:39:06 +0200 |
The PXB internal bus type is created in conformance
with the primary root bus (bus 0).
Signed-off-by: Marcel Apfelbaum <address@hidden>
---
hw/pci-bridge/pci_expander_bridge.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/hw/pci-bridge/pci_expander_bridge.c
b/hw/pci-bridge/pci_expander_bridge.c
index 541414c..0a04297 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -23,6 +23,9 @@
#define TYPE_PXB_BUS "pxb-bus"
#define PXB_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_BUS)
+#define TYPE_PXB_PCIE_BUS "pxb-pcie-bus"
+#define PXB_PCIE_BUS(obj) OBJECT_CHECK(PXBBus, (obj), TYPE_PXB_PCIE_BUS)
+
typedef struct PXBBus {
/*< private >*/
PCIBus parent_obj;
@@ -86,10 +89,18 @@ static const TypeInfo pxb_bus_info = {
.class_init = pxb_bus_class_init,
};
+static const TypeInfo pxb_pcie_bus_info = {
+ .name = TYPE_PXB_PCIE_BUS,
+ .parent = TYPE_PCIE_BUS,
+ .instance_size = sizeof(PXBBus),
+ .class_init = pxb_bus_class_init,
+};
+
static const char *pxb_host_root_bus_path(PCIHostState *host_bridge,
PCIBus *rootbus)
{
- PXBBus *bus = PXB_BUS(rootbus);
+ PXBBus *bus = pci_bus_is_express(rootbus) ?
+ PXB_PCIE_BUS(rootbus) : PXB_BUS(rootbus);
snprintf(bus->bus_path, 8, "0000:%02x", pxb_bus_num(rootbus));
return bus->bus_path;
@@ -222,7 +233,11 @@ static int pxb_dev_initfn(PCIDevice *dev)
qdev_prop_set_uint8(bds, PCI_BRIDGE_DEV_PROP_CHASSIS_NR, pxb->bus_nr);
qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, false);
} else {
- bus = pci_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_BUS);
+ if (pci_bus_is_express(dev->bus)) {
+ bus = pci_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS);
+ } else {
+ bus = pci_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_BUS);
+ }
}
bus->parent_dev = dev;
@@ -290,6 +305,7 @@ static const TypeInfo pxb_dev_info = {
static void pxb_register_types(void)
{
type_register_static(&pxb_bus_info);
+ type_register_static(&pxb_pcie_bus_info);
type_register_static(&pxb_host_info);
type_register_static(&pxb_dev_info);
}
--
2.1.0
- Re: [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35, (continued)
- Re: [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35, Laine Stump, 2015/11/19
- Re: [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35, Markus Armbruster, 2015/11/17
- Re: [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35, Marcel Apfelbaum, 2015/11/17
- Re: [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35, Markus Armbruster, 2015/11/17
- Re: [Qemu-devel] [PATCH V2 0/4] hw/pcie: Multi-root support for Q35, Marcel Apfelbaum, 2015/11/17
[Qemu-devel] [PATCH V2 1/4] hw/pxb: remove the built-in pci bridge, Marcel Apfelbaum, 2015/11/16
[Qemu-devel] [PATCH V2 3/4] hw/pc: query both q35 and i440fx bus, Marcel Apfelbaum, 2015/11/16
[Qemu-devel] [PATCH V2 2/4] hw/acpi: merge pxb adjacent memory/IO ranges, Marcel Apfelbaum, 2015/11/16
[Qemu-devel] [PATCH V2 4/4] hw/pxb: add support for PCIe,
Marcel Apfelbaum <=