diff options
| author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-11 15:19:46 +0000 |
|---|---|---|
| committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-02-11 15:19:46 +0000 |
| commit | 3ae806189842c70cf47e041b3c498c65683e5a21 (patch) | |
| tree | d4edd33a1e03aef31b8b061f01e5c3ed563f8e43 /hw/pci.c | |
| parent | f029bd940ee7d8e6e8bb02526fdf99e2490552ba (diff) | |
| download | focaccia-qemu-3ae806189842c70cf47e041b3c498c65683e5a21.tar.gz focaccia-qemu-3ae806189842c70cf47e041b3c498c65683e5a21.zip | |
qemu: add pci helper functions (Marcelo Tosatti)
Add pci_find_bus/pci_find_device to be used by PCI hotplug. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6592 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/pci.c')
| -rw-r--r-- | hw/pci.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/hw/pci.c b/hw/pci.c index 0e57d2190b..d0e16fe44f 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -711,6 +711,26 @@ static void pci_bridge_write_config(PCIDevice *d, pci_default_write_config(d, address, val, len); } +PCIBus *pci_find_bus(int bus_num) +{ + PCIBus *bus = first_bus; + + while (bus && bus->bus_num != bus_num) + bus = bus->next; + + return bus; +} + +PCIDevice *pci_find_device(int bus_num, int slot, int function) +{ + PCIBus *bus = pci_find_bus(bus_num); + + if (!bus) + return NULL; + + return bus->devices[PCI_DEVFN(slot, function)]; +} + PCIBus *pci_bridge_init(PCIBus *bus, int devfn, uint16_t vid, uint16_t did, pci_map_irq_fn map_irq, const char *name) { |