qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 52/61] pci: add a hook to replace default pci bus in


From: Isaku Yamahata
Subject: [Qemu-devel] [PATCH 52/61] pci: add a hook to replace default pci bus instead of 0 bus.
Date: Wed, 30 Sep 2009 19:18:28 +0900

add a register function to replace default pci bus of 0.

Signed-off-by: Isaku Yamahata <address@hidden>
---
 hw/pci.c |   10 ++++++++++
 hw/pci.h |    1 +
 2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 7aed737..05cd2cb 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -343,6 +343,14 @@ int pci_read_devaddr(Monitor *mon, const char *addr, int 
*domp, int *busp,
     return 0;
 }
 
+static PCIBus *pci_default_bus;
+
+void pci_set_default_bus(PCIBus *bus)
+{
+    assert(pci_default_bus == NULL);
+    pci_default_bus = bus;
+}
+
 static PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr)
 {
     int dom, bus;
@@ -350,6 +358,8 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, const char 
*devaddr)
 
     if (!devaddr) {
         *devfnp = -1;
+        if (pci_default_bus)
+            return pci_default_bus;
         return pci_find_bus(0);
     }
 
diff --git a/hw/pci.h b/hw/pci.h
index aed4a44..27a5d33 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -352,6 +352,7 @@ void pci_default_write_config(PCIDevice *d,
                               uint32_t address, uint32_t val, int len);
 void pci_device_save(PCIDevice *s, QEMUFile *f);
 int pci_device_load(PCIDevice *s, QEMUFile *f);
+void pci_set_default_bus(PCIBus *bus);
 
 typedef void (*pci_set_irq_fn)(void *opaque, int irq_num, int level);
 typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num);
-- 
1.6.0.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]