From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:52785) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdVM-0000DN-33 for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TkdVK-0008I3-Rb for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:23 -0500 Received: from mail-ia0-f173.google.com ([209.85.210.173]:46672) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TkdVK-0008Hv-Lp for qemu-devel@nongnu.org; Mon, 17 Dec 2012 11:25:22 -0500 Received: by mail-ia0-f173.google.com with SMTP id w21so5709882iac.4 for ; Mon, 17 Dec 2012 08:25:22 -0800 (PST) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 17 Dec 2012 17:24:41 +0100 Message-Id: <1355761490-10073-7-git-send-email-pbonzini@redhat.com> In-Reply-To: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> References: <1355761490-10073-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 06/15] qdev: add qbus_reset_all List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, mst@redhat.com Signed-off-by: Paolo Bonzini --- hw/qdev-core.h | 12 ++++++++++++ hw/qdev.c | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/hw/qdev-core.h b/hw/qdev-core.h index d672cca..f8bf9dd 100644 --- a/hw/qdev-core.h +++ b/hw/qdev-core.h @@ -182,6 +182,18 @@ int qbus_walk_children(BusState *bus, qdev_walkerfn *devfn, int qdev_walk_children(DeviceState *dev, qdev_walkerfn *devfn, qbus_walkerfn *busfn, void *opaque); void qdev_reset_all(DeviceState *dev); + +/** + * @qbus_reset_all: + * @bus: Bus to be reset. + * + * Reset @bus and perform a bus-level ("hard") reset of all devices connected + * to it, including recursive processing of all buses below @bus itself. A + * hard reset means that qbus_reset_all will reset all state of the device. + * For PCI devices, for example, this will include the base address registers + * or configuration space. + */ +void qbus_reset_all(BusState *bus); void qbus_reset_all_fn(void *opaque); void qbus_free(BusState *bus); diff --git a/hw/qdev.c b/hw/qdev.c index 2fdf4ac..87ffad8 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -230,10 +230,15 @@ void qdev_reset_all(DeviceState *dev) qdev_walk_children(dev, qdev_reset_one, qbus_reset_one, NULL); } +void qbus_reset_all(BusState *bus) +{ + qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL); +} + void qbus_reset_all_fn(void *opaque) { BusState *bus = opaque; - qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL); + qbus_reset_all(bus); } /* can be used as ->unplug() callback for the simple cases */ -- 1.8.0.2