From patchwork Fri Nov 19 09:56:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 72237 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6A7CE1007D2 for ; Fri, 19 Nov 2010 21:08:40 +1100 (EST) Received: from localhost ([127.0.0.1]:39843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJNtL-0004G7-Mb for incoming@patchwork.ozlabs.org; Fri, 19 Nov 2010 05:08:27 -0500 Received: from [140.186.70.92] (port=45138 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJNhU-0007YF-E1 for qemu-devel@nongnu.org; Fri, 19 Nov 2010 04:56:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJNhQ-0004Sw-Lc for qemu-devel@nongnu.org; Fri, 19 Nov 2010 04:56:12 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:52286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJNhQ-0004SY-Be for qemu-devel@nongnu.org; Fri, 19 Nov 2010 04:56:08 -0500 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 4F21427E90; Fri, 19 Nov 2010 18:56:05 +0900 (JST) Received: (nullmailer pid 21299 invoked by uid 1000); Fri, 19 Nov 2010 09:56:03 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Fri, 19 Nov 2010 18:56:00 +0900 Message-Id: <76d19d63919ef9da48da1d4724adeff77e0bcae3.1290160397.git.yamahata@valinux.co.jp> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: skandasa@cisco.com, Anthony Liguori , etmartin@cisco.com, wexu2@cisco.com, mst@redhat.com, yamahata@valinux.co.jp, pbonzini@redhat.com Subject: [Qemu-devel] [PATCH v2 3/6] qdev: introduce reset call back for qbus level X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org and make it called via qbus_reset_all(). The qbus reset callback will be used by pci bus reset. Signed-off-by: Isaku Yamahata Signed-off-by: Anthony Liguori --- hw/qdev.c | 10 +++++++++- hw/qdev.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletions(-) diff --git a/hw/qdev.c b/hw/qdev.c index 92ccc8d..b76da07 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -314,9 +314,17 @@ BusState *sysbus_get_default(void) return main_system_bus; } +static int qbus_reset_one(BusState *bus, void *opaque) +{ + if (bus->info->reset) { + return bus->info->reset(bus); + } + return 0; +} + void qbus_reset_all(BusState *bus) { - qbus_walk_children(bus, qdev_reset_one, NULL, NULL); + qbus_walk_children(bus, qdev_reset_one, qbus_reset_one, NULL); } /* can be used as ->unplug() callback for the simple cases */ diff --git a/hw/qdev.h b/hw/qdev.h index e5ed333..5ac084f 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -49,12 +49,14 @@ struct DeviceState { typedef void (*bus_dev_printfn)(Monitor *mon, DeviceState *dev, int indent); typedef char *(*bus_get_dev_path)(DeviceState *dev); +typedef int (qbus_resetfn)(BusState *bus); struct BusInfo { const char *name; size_t size; bus_dev_printfn print_dev; bus_get_dev_path get_dev_path; + qbus_resetfn *reset; Property *props; };