[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V7 12/24] hw/pci: extend PCI config access to suppor
From: |
Marcel Apfelbaum |
Subject: |
[Qemu-devel] [PATCH V7 12/24] hw/pci: extend PCI config access to support devices behind PXB |
Date: |
Mon, 25 May 2015 18:33:50 +0300 |
PXB buses are assumed to be children of bus 0. Look for them
while scanning the buses.
Signed-off-by: Marcel Apfelbaum <address@hidden>
---
hw/pci/pci.c | 34 +++++++++++++++++++++++++++++-----
1 file changed, 29 insertions(+), 5 deletions(-)
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index 2f24f74..3361d85 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -1699,10 +1699,28 @@ static bool pci_secondary_bus_in_range(PCIDevice *dev,
int bus_num)
{
return !(pci_get_word(dev->config + PCI_BRIDGE_CONTROL) &
PCI_BRIDGE_CTL_BUS_RESET) /* Don't walk the bus if it's reset. */
&&
- dev->config[PCI_SECONDARY_BUS] < bus_num &&
+ dev->config[PCI_SECONDARY_BUS] <= bus_num &&
bus_num <= dev->config[PCI_SUBORDINATE_BUS];
}
+/* Whether a given bus number is in a range of a root bus */
+static bool pci_root_bus_in_range(PCIBus *bus, int bus_num)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(bus->devices); ++i) {
+ PCIDevice *dev = bus->devices[i];
+
+ if (dev && PCI_DEVICE_GET_CLASS(dev)->is_bridge) {
+ if (pci_secondary_bus_in_range(dev, bus_num)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
static PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num)
{
PCIBus *sec;
@@ -1724,12 +1742,18 @@ static PCIBus *pci_find_bus_nr(PCIBus *bus, int bus_num)
/* try child bus */
for (; bus; bus = sec) {
QLIST_FOREACH(sec, &bus->child, sibling) {
- assert(!pci_bus_is_root(sec));
- if (sec->parent_dev->config[PCI_SECONDARY_BUS] == bus_num) {
+ if (pci_bus_num(sec) == bus_num) {
return sec;
}
- if (pci_secondary_bus_in_range(sec->parent_dev, bus_num)) {
- break;
+ /* PXB buses assumed to be children of bus 0 */
+ if (pci_bus_is_root(sec)) {
+ if (pci_root_bus_in_range(sec, bus_num)) {
+ break;
+ }
+ } else {
+ if (pci_secondary_bus_in_range(sec->parent_dev, bus_num)) {
+ break;
+ }
}
}
}
--
2.1.0
- [Qemu-devel] [PATCH V7 03/24] acpi: add aml_lless() term, (continued)
- [Qemu-devel] [PATCH V7 03/24] acpi: add aml_lless() term, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 04/24] acpi: add aml_index() term, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 02/24] acpi: add aml_add() term, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 05/24] acpi: add aml_shiftleft() term, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 06/24] acpi: add aml_shiftright() term, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 07/24] acpi: add aml_increment() term, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 08/24] acpi: add aml_while() term, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 09/24] hw/pci: made pci_bus_is_root a PCIBusClass method, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 10/24] hw/pci: made pci_bus_num a PCIBusClass method, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 11/24] hw/i386: query only for q35/pc when looking for pci host bridge, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 12/24] hw/pci: extend PCI config access to support devices behind PXB,
Marcel Apfelbaum <=
- [Qemu-devel] [PATCH V7 14/24] hw/apci: add _PRT method for extra PCI root busses, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 13/24] hw/acpi: add support for i440fx 'snooping' root busses, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 15/24] hw/acpi: add _CRS method for extra root busses, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 16/24] hw/acpi: remove from root bus 0 the crs resources used by other buses., Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 17/24] hw/pci: removed 'rootbus nr is 0' assumption from qmp_pci_query, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 18/24] hw/pci: introduce PCI Expander Bridge (PXB), Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 19/24] hw/pci: inform bios if the system has extra pci root buses, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 21/24] hw/pci: add support for NUMA nodes, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 20/24] hw/pxb: add map_irq func, Marcel Apfelbaum, 2015/05/25
- [Qemu-devel] [PATCH V7 22/24] hw/pxb: add numa_node parameter, Marcel Apfelbaum, 2015/05/25