From patchwork Tue Jan 5 06:27:40 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 42174 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 6ADA9B6EF7 for ; Wed, 6 Jan 2010 07:39:27 +1100 (EST) Received: from localhost ([127.0.0.1]:33642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSGBX-0000jP-W2 for incoming@patchwork.ozlabs.org; Tue, 05 Jan 2010 15:39:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NSFAL-0004AK-OZ for qemu-devel@nongnu.org; Tue, 05 Jan 2010 14:34:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NSFAF-00044Z-2i for qemu-devel@nongnu.org; Tue, 05 Jan 2010 14:34:03 -0500 Received: from [199.232.76.173] (port=60633 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NSFAE-00044Q-Tb for qemu-devel@nongnu.org; Tue, 05 Jan 2010 14:33:58 -0500 Received: from mx20.gnu.org ([199.232.41.8]:35695) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NSFAE-00050m-GH for qemu-devel@nongnu.org; Tue, 05 Jan 2010 14:33:58 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NS4vf-0005dq-Ei for qemu-devel@nongnu.org; Tue, 05 Jan 2010 03:38:15 -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 7035618277; Tue, 5 Jan 2010 15:27:42 +0900 (JST) Received: (nullmailer pid 22678 invoked by uid 1000); Tue, 05 Jan 2010 06:27:50 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Tue, 5 Jan 2010 15:27:40 +0900 Message-Id: <1262672870-22607-18-git-send-email-yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.5.4 In-Reply-To: <1262672870-22607-1-git-send-email-yamahata@valinux.co.jp> References: <1262672870-22607-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 mx20.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: yamahata@valinux.co.jp Subject: [Qemu-devel] [PATCH V11 17/27] pc: split out pci device init from pc_init1() into pc_pci_device_init() 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 Split out pci device initialization from pc_init1() into pc_pci_device_init(). and removed unnecessary braces. Signed-off-by: Isaku Yamahata --- hw/pc.c | 35 +++++++++++++++++++---------------- 1 files changed, 19 insertions(+), 16 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index dbff7b7..7ce1fdb 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1189,6 +1189,24 @@ static void pc_basic_device_init(qemu_irq *isa_irq, *floppy_controller = fdctrl_init_isa(fd); } +static void pc_pci_device_init(PCIBus *pci_bus) +{ + int i; + int max_bus; + + max_bus = drive_get_max_bus(IF_SCSI); + for (i = 0; i <= max_bus; i++) { + pci_create_simple(pci_bus, -1, "lsi53c895a"); + } + + /* Add virtio console devices */ + for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { + if (virtcon_hds[i]) { + pci_create_simple(pci_bus, -1, "virtio-console-pci"); + } + } +} + /* PC hardware initialisation */ static void pc_init1(ram_addr_t ram_size, const char *boot_device, @@ -1308,22 +1326,7 @@ static void pc_init1(ram_addr_t ram_size, } if (pci_enabled) { - int max_bus; - int bus; - - max_bus = drive_get_max_bus(IF_SCSI); - for (bus = 0; bus <= max_bus; bus++) { - pci_create_simple(pci_bus, -1, "lsi53c895a"); - } - } - - /* Add virtio console devices */ - if (pci_enabled) { - for(i = 0; i < MAX_VIRTIO_CONSOLES; i++) { - if (virtcon_hds[i]) { - pci_create_simple(pci_bus, -1, "virtio-console-pci"); - } - } + pc_pci_device_init(pci_bus); } rom_load_fw(fw_cfg);