[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/8] pci: export pci_bus_reset() and pci_device_rese
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 3/8] pci: export pci_bus_reset() and pci_device_reset() for later use. |
Date: |
Fri, 30 Jul 2010 19:03:57 +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
- [Qemu-devel] [PATCH 0/8] RFC: qbus reset callback and implement pci bus reset, Isaku Yamahata, 2010/07/30
- [Qemu-devel] [PATCH 8/8] pci bridge: implement secondary bus reset., Isaku Yamahata, 2010/07/30
- [Qemu-devel] [PATCH 3/8] pci: export pci_bus_reset() and pci_device_reset() for later use.,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 7/8] pci: eliminate work around in pci_device_reset()., Isaku Yamahata, 2010/07/30
- [Qemu-devel] [PATCH 1/8] apb: fix typo., Isaku Yamahata, 2010/07/30
- [Qemu-devel] [PATCH 6/8] pci: use qbus bus reset callback., Isaku Yamahata, 2010/07/30
- [Qemu-devel] [PATCH 2/8] qdev: export qdev_reset() for later use., Isaku Yamahata, 2010/07/30
- [Qemu-devel] [PATCH 5/8] qdev: introduce bus reset callback and helper functions., Isaku Yamahata, 2010/07/30
- [Qemu-devel] [PATCH 4/8] pci: make pci_device_reset() aware of qdev., Isaku Yamahata, 2010/07/30