[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 7/8] pci: eliminate work around in pci_device_res
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH v2 7/8] pci: eliminate work around in pci_device_reset(). |
Date: |
Thu, 5 Aug 2010 11:09:04 +0900 |
Eliminate work around in pci_device_reset() by
making each pci reset function to call pci_device_reset_default().
Each device should know reset itself. It shouldn't be done pci generic
layer automatically. PCI layer should just signal reset and let each device
respond to reset.
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/e1000.c | 1 +
hw/lsi53c895a.c | 2 ++
hw/pci.c | 6 ------
hw/pcnet.c | 1 +
hw/rtl8139.c | 2 ++
hw/virtio-pci.c | 1 +
6 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/hw/e1000.c b/hw/e1000.c
index 8d87492..0f303b0 100644
--- a/hw/e1000.c
+++ b/hw/e1000.c
@@ -1077,6 +1077,7 @@ static void e1000_reset(void *opaque)
memmove(d->mac_reg, mac_reg_init, sizeof mac_reg_init);
d->rxbuf_min_shift = 1;
memset(&d->tx, 0, sizeof d->tx);
+ pci_device_reset_default(&d->dev);
}
static NetClientInfo net_e1000_info = {
diff --git a/hw/lsi53c895a.c b/hw/lsi53c895a.c
index 33a8eb2..1e4ba10 100644
--- a/hw/lsi53c895a.c
+++ b/hw/lsi53c895a.c
@@ -358,6 +358,8 @@ static void lsi_soft_reset(LSIState *s)
qemu_free(s->current);
s->current = NULL;
}
+
+ pci_device_reset_default(&s->dev);
}
static int lsi_dma_40bit(LSIState *s)
diff --git a/hw/pci.c b/hw/pci.c
index 731d367..54cb89b 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -171,13 +171,7 @@ void pci_device_reset(PCIDevice *dev)
return;
}
- /*
- * TODO:
- * Each device should know all its states.
- * So move this part to each device specific callback.
- */
qdev_reset(&dev->qdev);
- pci_device_reset_default(dev);
}
/*
diff --git a/hw/pcnet.c b/hw/pcnet.c
index b52935a..e73e682 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -2023,6 +2023,7 @@ static void pci_reset(DeviceState *dev)
PCIPCNetState *d = DO_UPCAST(PCIPCNetState, pci_dev.qdev, dev);
pcnet_h_reset(&d->state);
+ pci_device_reset_default(&d->pci_dev);
}
static PCIDeviceInfo pcnet_info = {
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index d92981d..1f35e5d 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -1260,6 +1260,8 @@ static void rtl8139_reset(DeviceState *d)
/* reset tally counters */
RTL8139TallyCounters_clear(&s->tally_counters);
+
+ pci_device_reset_default(&s->dev);
}
static void RTL8139TallyCounters_clear(RTL8139TallyCounters* counters)
diff --git a/hw/virtio-pci.c b/hw/virtio-pci.c
index c728fff..d9b97be 100644
--- a/hw/virtio-pci.c
+++ b/hw/virtio-pci.c
@@ -184,6 +184,7 @@ static void virtio_pci_reset(DeviceState *d)
virtio_reset(proxy->vdev);
msix_reset(&proxy->pci_dev);
proxy->bugs = 0;
+ pci_device_reset_default(&proxy->pci_dev);
}
static void virtio_ioport_write(void *opaque, uint32_t addr, uint32_t val)
--
1.7.1.1
- [Qemu-devel] [PATCH v2 0/8] qbus reset callback and implement pci bus reset, Isaku Yamahata, 2010/08/04
- [Qemu-devel] [PATCH v2 5/8] qdev: introduce bus reset callback and helper functions., Isaku Yamahata, 2010/08/04
- [Qemu-devel] [PATCH v2 3/8] pci: export pci_bus_reset() and pci_device_reset() for later use., Isaku Yamahata, 2010/08/04
- [Qemu-devel] [PATCH v2 7/8] pci: eliminate work around in pci_device_reset().,
Isaku Yamahata <=
- [Qemu-devel] [PATCH v2 4/8] pci: make pci_device_reset() aware of qdev., Isaku Yamahata, 2010/08/04
- [Qemu-devel] [PATCH v2 6/8] pci: use qbus bus reset callback., Isaku Yamahata, 2010/08/04
- [Qemu-devel] [PATCH v2 1/8] apb: fix typo., Isaku Yamahata, 2010/08/04
- [Qemu-devel] [PATCH v2 2/8] qdev: export qdev_reset() for later use., Isaku Yamahata, 2010/08/04
- [Qemu-devel] [PATCH v2 8/8] pci bridge: implement secondary bus reset., Isaku Yamahata, 2010/08/04