qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 3/8] pci: export pci_bus_reset() and pci_device_r


From: Isaku Yamahata
Subject: [Qemu-devel] [PATCH v2 3/8] pci: export pci_bus_reset() and pci_device_reset() for later use.
Date: Thu, 5 Aug 2010 11:09:00 +0900

export pci_bus_reset() and pci_device_reset() for later use
with slight function signature adjustment.

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

diff --git a/hw/pci.c b/hw/pci.c
index 2dc1577..6a614d1 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -130,7 +130,8 @@ static void pci_update_irq_status(PCIDevice *dev)
     }
 }
 
-static void pci_device_reset(PCIDevice *dev)
+/* Reset the device in response to RST# signal. */
+void pci_device_reset(PCIDevice *dev)
 {
     int r;
 
@@ -158,9 +159,12 @@ static void pci_device_reset(PCIDevice *dev)
     pci_update_mappings(dev);
 }
 
-static void pci_bus_reset(void *opaque)
+/*
+ * Trigger pci bus reset under a given bus.
+ * This functions emulates RST#.
+ */
+void pci_bus_reset(PCIBus *bus)
 {
-    PCIBus *bus = opaque;
     int i;
 
     for (i = 0; i < bus->nirq; i++) {
@@ -173,6 +177,11 @@ static void pci_bus_reset(void *opaque)
     }
 }
 
+static void pci_bus_reset_fn(void *opaque)
+{
+    pci_bus_reset(opaque);
+}
+
 static void pci_host_bus_register(int domain, PCIBus *bus)
 {
     struct PCIHostBus *host;
@@ -227,7 +236,7 @@ void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
     pci_host_bus_register(0, bus); /* for now only pci domain 0 is supported */
 
     vmstate_register(NULL, -1, &vmstate_pcibus, bus);
-    qemu_register_reset(pci_bus_reset, bus);
+    qemu_register_reset(pci_bus_reset_fn, bus);
 }
 
 PCIBus *pci_bus_new(DeviceState *parent, const char *name, int devfn_min)
diff --git a/hw/pci.h b/hw/pci.h
index c551f96..be05662 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -207,6 +207,10 @@ typedef int (*pci_hotplug_fn)(DeviceState *qdev, PCIDevice 
*pci_dev, int state);
 void pci_bus_new_inplace(PCIBus *bus, DeviceState *parent,
                          const char *name, int devfn_min);
 PCIBus *pci_bus_new(DeviceState *parent, const char *name, int devfn_min);
+
+void pci_bus_reset(PCIBus *bus);
+void pci_device_reset(PCIDevice *dev);
+
 void pci_bus_irqs(PCIBus *bus, pci_set_irq_fn set_irq, pci_map_irq_fn map_irq,
                   void *irq_opaque, int nirq);
 void pci_bus_hotplug(PCIBus *bus, pci_hotplug_fn hotplug, DeviceState *dev);
-- 
1.7.1.1




reply via email to

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