[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/8] pci: make pci_device_reset() aware of qdev.
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 4/8] pci: make pci_device_reset() aware of qdev. |
Date: |
Fri, 30 Jul 2010 19:03:58 +0900 |
Make pci_device_reset handle qdevfied device and non-converted device
differently.
Later they will be handled differently.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pci.c | 35 +++++++++++++++++++++++++++++++++--
hw/pci.h | 1 +
2 files changed, 34 insertions(+), 2 deletions(-)
diff --git a/hw/pci.c b/hw/pci.c
index 6a614d1..c48bb3e 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -130,8 +130,7 @@ static void pci_update_irq_status(PCIDevice *dev)
}
}
-/* Reset the device in response to RST# signal. */
-void pci_device_reset(PCIDevice *dev)
+void pci_device_reset_default(PCIDevice *dev)
{
int r;
@@ -159,6 +158,38 @@ void pci_device_reset(PCIDevice *dev)
pci_update_mappings(dev);
}
+/* Reset the device in response to RST# signal. */
+void pci_device_reset(PCIDevice *dev)
+{
+ if (!dev->qdev.info || !dev->qdev.info->reset) {
+ /* for not qdevified device or reset isn't implemented property.
+ * So take care of them in PCI generic layer.
+ */
+ pci_device_reset_default(dev);
+ return;
+ }
+
+ /*
+ * There are two paths to reset pci device. Each resets does partially.
+ * qemu_system_reset()
+ * -> pci_device_reset() with bus
+ * -> pci_device_reset_default() which resets pci common part.
+ * -> DeviceState::reset: each device specific reset hanlder
+ * which resets device specific part.
+ *
+ * TODO:
+ * It requires two execution paths to reset the device fully.
+ * It is confusing and prone to error. Each device should know all
+ * its states.
+ * So move this part to each device specific callback.
+ */
+
+ /* For now qdev_reset() is called directly by qemu_system_reset() */
+ /* qdev_reset(&dev->qdev); */
+
+ pci_device_reset_default(dev);
+}
+
/*
* Trigger pci bus reset under a given bus.
* This functions emulates RST#.
diff --git a/hw/pci.h b/hw/pci.h
index be05662..ce1feb4 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -210,6 +210,7 @@ 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_device_reset_default(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);
--
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, 2010/07/30
- [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 <=