From patchwork Thu Aug 5 02:09:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 60917 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 E5BE9B70D4 for ; Thu, 5 Aug 2010 12:11:15 +1000 (EST) Received: from localhost ([127.0.0.1]:42117 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OgpvM-0005DK-JR for incoming@patchwork.ozlabs.org; Wed, 04 Aug 2010 22:11:12 -0400 Received: from [140.186.70.92] (port=38880 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ogpnr-0001IO-EL for qemu-devel@nongnu.org; Wed, 04 Aug 2010 22:03:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ogpno-0007Mp-I7 for qemu-devel@nongnu.org; Wed, 04 Aug 2010 22:03:27 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:38264) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ogpno-0007Mc-7o for qemu-devel@nongnu.org; Wed, 04 Aug 2010 22:03:24 -0400 Received: from ps.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with SMTP id 8CA01107956; Thu, 5 Aug 2010 11:03:20 +0900 (JST) Received: (nullmailer pid 14311 invoked by uid 1000); Thu, 05 Aug 2010 02:09:05 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org Date: Thu, 5 Aug 2010 11:09:05 +0900 Message-Id: <6287832d420f5faf313b99bb447f39228ad4b240.1280973617.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: blauwirbel@gmail.com, yamahata@valinux.co.jp, kraxel@redhat.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v2 8/8] pci bridge: implement secondary bus reset. 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 implement secondary bus reset. Signed-off-by: Isaku Yamahata --- hw/pci_bridge.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/hw/pci_bridge.c b/hw/pci_bridge.c index ab7ed6e..37710e9 100644 --- a/hw/pci_bridge.c +++ b/hw/pci_bridge.c @@ -119,6 +119,9 @@ pcibus_t pci_bridge_get_limit(const PCIDevice *bridge, uint8_t type) void pci_bridge_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len) { + PCIBridge *s = container_of(d, PCIBridge, dev); + uint16_t bridge_control = pci_get_word(d->config + PCI_BRIDGE_CONTROL); + pci_default_write_config(d, address, val, len); if (/* io base/limit */ @@ -127,9 +130,17 @@ void pci_bridge_write_config(PCIDevice *d, /* memory base/limit, prefetchable base/limit and io base/limit upper 16 */ ranges_overlap(address, len, PCI_MEMORY_BASE, 20)) { - PCIBridge *s = container_of(d, PCIBridge, dev); pci_bridge_update_mappings(&s->sec_bus); } + + if (ranges_overlap(address, len, PCI_BRIDGE_CONTROL, 2)) { + uint16_t new = pci_get_word(d->config + PCI_BRIDGE_CONTROL); + if (!(bridge_control & PCI_BRIDGE_CTL_BUS_RESET) && + (new & PCI_BRIDGE_CTL_BUS_RESET)) { + /* 0 -> 1 */ + pci_bus_reset(&s->sec_bus); + } + } } /* reset bridge specific configuration registers */