From patchwork Wed Sep 30 10:18:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 34597 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 917C1B7BCC for ; Thu, 1 Oct 2009 00:05:15 +1000 (EST) Received: from localhost ([127.0.0.1]:33041 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mszns-00023a-Pt for incoming@patchwork.ozlabs.org; Wed, 30 Sep 2009 10:05:12 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mswe7-0002zn-Ih for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:42:55 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mswe3-0002xN-40 for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:42:54 -0400 Received: from [199.232.76.173] (port=41720 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mswe2-0002xB-HU for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:42:50 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:55563) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mswe1-0000IX-Nz for qemu-devel@nongnu.org; Wed, 30 Sep 2009 06:42:50 -0400 Received: from nm.local.valinux.co.jp (vagw.valinux.co.jp [210.128.90.14]) by mail.valinux.co.jp (Postfix) with ESMTP id 1708A49C3B; Wed, 30 Sep 2009 19:20:18 +0900 (JST) Received: from yamahata by nm.local.valinux.co.jp with local (Exim 4.69) (envelope-from ) id 1MswGd-0003tH-G6; Wed, 30 Sep 2009 19:18:39 +0900 From: Isaku Yamahata To: qemu-devel@nongnu.org, anthony@codemonkey.ws Date: Wed, 30 Sep 2009 19:18:28 +0900 Message-Id: <1254305917-14784-53-git-send-email-yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1254305917-14784-1-git-send-email-yamahata@valinux.co.jp> References: <1254305917-14784-1-git-send-email-yamahata@valinux.co.jp> X-Virus-Scanned: clamav-milter 0.95.2 at va-mail.local.valinux.co.jp X-Virus-Status: Clean X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: yamahata@valinux.co.jp Subject: [Qemu-devel] [PATCH 52/61] pci: add a hook to replace default pci bus instead of 0 bus. 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 add a register function to replace default pci bus of 0. Signed-off-by: Isaku Yamahata --- hw/pci.c | 10 ++++++++++ hw/pci.h | 1 + 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 7aed737..05cd2cb 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -343,6 +343,14 @@ int pci_read_devaddr(Monitor *mon, const char *addr, int *domp, int *busp, return 0; } +static PCIBus *pci_default_bus; + +void pci_set_default_bus(PCIBus *bus) +{ + assert(pci_default_bus == NULL); + pci_default_bus = bus; +} + static PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr) { int dom, bus; @@ -350,6 +358,8 @@ static PCIBus *pci_get_bus_devfn(int *devfnp, const char *devaddr) if (!devaddr) { *devfnp = -1; + if (pci_default_bus) + return pci_default_bus; return pci_find_bus(0); } diff --git a/hw/pci.h b/hw/pci.h index aed4a44..27a5d33 100644 --- a/hw/pci.h +++ b/hw/pci.h @@ -352,6 +352,7 @@ void pci_default_write_config(PCIDevice *d, uint32_t address, uint32_t val, int len); void pci_device_save(PCIDevice *s, QEMUFile *f); int pci_device_load(PCIDevice *s, QEMUFile *f); +void pci_set_default_bus(PCIBus *bus); typedef void (*pci_set_irq_fn)(void *opaque, int irq_num, int level); typedef int (*pci_map_irq_fn)(PCIDevice *pci_dev, int irq_num);