summaryrefslogtreecommitdiff
path: root/include/hw/pci/pci.h
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2013-10-14 18:01:07 +0300
committerMichael S. Tsirkin <mst@redhat.com>2014-01-26 13:06:49 +0200
commiteb0acfdde604930688c47fe1ba99bec2bd84b7ad (patch)
treebb169f4088ca405e51683abcdfdc7a04c329a121 /include/hw/pci/pci.h
parent4d25299cb2b57a16fd3194e938eeb78d219400ba (diff)
downloadqemu-eb0acfdde604930688c47fe1ba99bec2bd84b7ad.tar.gz
qemu-eb0acfdde604930688c47fe1ba99bec2bd84b7ad.tar.bz2
qemu-eb0acfdde604930688c47fe1ba99bec2bd84b7ad.zip
pci: add pci_for_each_bus_depth_first
Useful for ACPI hotplug. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/pci/pci.h')
-rw-r--r--include/hw/pci/pci.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h
index 754b82de81..52523467b6 100644
--- a/include/hw/pci/pci.h
+++ b/include/hw/pci/pci.h
@@ -387,6 +387,20 @@ int pci_bus_num(PCIBus *s);
void pci_for_each_device(PCIBus *bus, int bus_num,
void (*fn)(PCIBus *bus, PCIDevice *d, void *opaque),
void *opaque);
+void pci_for_each_bus_depth_first(PCIBus *bus,
+ void *(*begin)(PCIBus *bus, void *parent_state),
+ void (*end)(PCIBus *bus, void *state),
+ void *parent_state);
+
+/* Use this wrapper when specific scan order is not required. */
+static inline
+void pci_for_each_bus(PCIBus *bus,
+ void (*fn)(PCIBus *bus, void *opaque),
+ void *opaque)
+{
+ pci_for_each_bus_depth_first(bus, NULL, fn, opaque);
+}
+
PCIBus *pci_find_primary_bus(void);
PCIBus *pci_device_root_bus(const PCIDevice *d);
const char *pci_root_bus_path(PCIDevice *dev);