[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v3 10/31] hw/pxb: Use a type for realizing expanders
From: |
Ben Widawsky |
Subject: |
[RFC PATCH v3 10/31] hw/pxb: Use a type for realizing expanders |
Date: |
Mon, 1 Feb 2021 16:59:27 -0800 |
This opens up the possibility for more types of expanders (other than
PCI and PCIe). We'll need this to create a CXL expander.
Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
---
hw/pci-bridge/pci_expander_bridge.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/hw/pci-bridge/pci_expander_bridge.c
b/hw/pci-bridge/pci_expander_bridge.c
index aedded1064..232b7ce305 100644
--- a/hw/pci-bridge/pci_expander_bridge.c
+++ b/hw/pci-bridge/pci_expander_bridge.c
@@ -24,6 +24,8 @@
#include "hw/boards.h"
#include "qom/object.h"
+enum BusType { PCI, PCIE };
+
#define TYPE_PXB_BUS "pxb-bus"
typedef struct PXBBus PXBBus;
DECLARE_INSTANCE_CHECKER(PXBBus, PXB_BUS,
@@ -214,7 +216,8 @@ static gint pxb_compare(gconstpointer a, gconstpointer b)
0;
}
-static void pxb_dev_realize_common(PCIDevice *dev, bool pcie, Error **errp)
+static void pxb_dev_realize_common(PCIDevice *dev, enum BusType type,
+ Error **errp)
{
PXBDev *pxb = convert_to_pxb(dev);
DeviceState *ds, *bds = NULL;
@@ -239,7 +242,7 @@ static void pxb_dev_realize_common(PCIDevice *dev, bool
pcie, Error **errp)
}
ds = qdev_new(TYPE_PXB_HOST);
- if (pcie) {
+ if (type == PCIE) {
bus = pci_root_bus_new(ds, dev_name, NULL, NULL, 0, TYPE_PXB_PCIE_BUS);
} else {
bus = pci_root_bus_new(ds, "pxb-internal", NULL, NULL, 0,
TYPE_PXB_BUS);
@@ -287,7 +290,7 @@ static void pxb_dev_realize(PCIDevice *dev, Error **errp)
return;
}
- pxb_dev_realize_common(dev, false, errp);
+ pxb_dev_realize_common(dev, PCI, errp);
}
static void pxb_dev_exitfn(PCIDevice *pci_dev)
@@ -339,7 +342,7 @@ static void pxb_pcie_dev_realize(PCIDevice *dev, Error
**errp)
return;
}
- pxb_dev_realize_common(dev, true, errp);
+ pxb_dev_realize_common(dev, PCIE, errp);
}
static void pxb_pcie_dev_class_init(ObjectClass *klass, void *data)
--
2.30.0
- Re: [RFC PATCH v3 05/31] hw/cxl/device: Implement basic mailbox (8.2.8.4), (continued)
Re: [RFC PATCH v3 05/31] hw/cxl/device: Implement basic mailbox (8.2.8.4), Jonathan Cameron, 2021/02/11
[RFC PATCH v3 07/31] hw/cxl/device: Add cheap EVENTS implementation (8.2.9.1), Ben Widawsky, 2021/02/01
[RFC PATCH v3 06/31] hw/cxl/device: Add memory device utilities, Ben Widawsky, 2021/02/01
[RFC PATCH v3 09/31] hw/cxl/device: Add log commands (8.2.9.4) + CEL, Ben Widawsky, 2021/02/01
[RFC PATCH v3 10/31] hw/pxb: Use a type for realizing expanders,
Ben Widawsky <=
[RFC PATCH v3 08/31] hw/cxl/device: Timestamp implementation (8.2.9.3), Ben Widawsky, 2021/02/01
[RFC PATCH v3 13/31] qtest: allow DSDT acpi table changes, Ben Widawsky, 2021/02/01
[RFC PATCH v3 11/31] hw/pci/cxl: Create a CXL bus type, Ben Widawsky, 2021/02/01
[RFC PATCH v3 12/31] hw/pxb: Allow creation of a CXL PXB (host bridge), Ben Widawsky, 2021/02/01
[RFC PATCH v3 14/31] acpi/pci: Consolidate host bridge setup, Ben Widawsky, 2021/02/01
[RFC PATCH v3 15/31] tests/acpi: remove stale allowed tables, Ben Widawsky, 2021/02/01
[RFC PATCH v3 16/31] hw/pci: Plumb _UID through host bridges, Ben Widawsky, 2021/02/01