From patchwork Thu Dec 24 08:09:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 41764 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 B9B95B7BF2 for ; Thu, 24 Dec 2009 20:16:51 +1100 (EST) Received: from localhost ([127.0.0.1]:52519 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNjoN-0002NS-3B for incoming@patchwork.ozlabs.org; Thu, 24 Dec 2009 04:16:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NNj9N-0001oL-Pf for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:34:25 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NNj9I-0001hM-H4 for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:34:24 -0500 Received: from [199.232.76.173] (port=41410 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NNj9I-0001gh-91 for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:34:20 -0500 Received: from mail.valinux.co.jp ([210.128.90.3]:55630) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NNj9H-0006Zh-Mt for qemu-devel@nongnu.org; Thu, 24 Dec 2009 03:34:20 -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 64E89106AD0; Thu, 24 Dec 2009 17:09:26 +0900 (JST) Received: (nullmailer pid 22815 invoked by uid 1000); Thu, 24 Dec 2009 08:09:20 -0000 From: Isaku Yamahata To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Thu, 24 Dec 2009 17:09:09 +0900 Message-Id: <1261642160-22754-17-git-send-email-yamahata@valinux.co.jp> X-Mailer: git-send-email 1.6.5.4 In-Reply-To: <1261642160-22754-1-git-send-email-yamahata@valinux.co.jp> References: <1261642160-22754-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 V10 16/27] pc: split out basic device init from pc_init1() into pc_basic_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 basic device, i.e. legacy devices like floppy, initialization from pc_init1() into pc_basic_device_init(). Later it will be used. Signed-off-by: Isaku Yamahata --- hw/pc.c | 87 +++++++++++++++++++++++++++++++++++--------------------------- 1 files changed, 49 insertions(+), 38 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 3774e0e..3c01df8 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1133,6 +1133,53 @@ static void pc_vga_init(PCIBus *pci_bus) } } +static void pc_basic_device_init(qemu_irq *isa_irq, + ISADevice **isa_dev, + fdctrl_t **floppy_controller, + RTCState **rtc_state) +{ + int i; + DriveInfo *fd[MAX_FD]; + PITState *pit; + + register_ioport_write(0x80, 1, 1, ioport80_write, NULL); + + register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); + + *rtc_state = rtc_init(2000); + + qemu_register_boot_set(pc_boot_set, *rtc_state); + + register_ioport_read(0x92, 1, 1, ioport92_read, NULL); + register_ioport_write(0x92, 1, 1, ioport92_write, NULL); + + pit = pit_init(0x40, isa_reserve_irq(0)); + pcspk_init(pit); + if (!no_hpet) { + hpet_init(isa_irq); + } + + for(i = 0; i < MAX_SERIAL_PORTS; i++) { + if (serial_hds[i]) { + serial_isa_init(i, serial_hds[i]); + } + } + + for(i = 0; i < MAX_PARALLEL_PORTS; i++) { + if (parallel_hds[i]) { + parallel_init(i, parallel_hds[i]); + } + } + + *isa_dev = isa_create_simple("i8042"); + DMA_init(0); + + for(i = 0; i < MAX_FD; i++) { + fd[i] = drive_get(IF_FLOPPY, 0, i); + } + *floppy_controller = fdctrl_init_isa(fd); +} + /* PC hardware initialisation */ static void pc_init1(ram_addr_t ram_size, const char *boot_device, @@ -1153,11 +1200,9 @@ static void pc_init1(ram_addr_t ram_size, qemu_irq *i8259; IsaIrqState *isa_irq_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; - DriveInfo *fd[MAX_FD]; void *fw_cfg; fdctrl_t *floppy_controller; RTCState *rtc_state; - PITState *pit; pc_cpus_init(cpu_model); @@ -1186,37 +1231,10 @@ static void pc_init1(ram_addr_t ram_size, pc_register_ferr_irq(isa_reserve_irq(13)); - /* init basic PC hardware */ - register_ioport_write(0x80, 1, 1, ioport80_write, NULL); - - register_ioport_write(0xf0, 1, 1, ioportF0_write, NULL); - pc_vga_init(pci_enabled? pci_bus: NULL); - rtc_state = rtc_init(2000); - - qemu_register_boot_set(pc_boot_set, rtc_state); - - register_ioport_read(0x92, 1, 1, ioport92_read, NULL); - register_ioport_write(0x92, 1, 1, ioport92_write, NULL); - - pit = pit_init(0x40, isa_reserve_irq(0)); - pcspk_init(pit); - if (!no_hpet) { - hpet_init(isa_irq); - } - - for(i = 0; i < MAX_SERIAL_PORTS; i++) { - if (serial_hds[i]) { - serial_isa_init(i, serial_hds[i]); - } - } - - for(i = 0; i < MAX_PARALLEL_PORTS; i++) { - if (parallel_hds[i]) { - parallel_init(i, parallel_hds[i]); - } - } + /* init basic PC hardware */ + pc_basic_device_init(isa_irq, &isa_dev, &floppy_controller, &rtc_state); for(i = 0; i < nb_nics; i++) { NICInfo *nd = &nd_table[i]; @@ -1245,17 +1263,10 @@ static void pc_init1(ram_addr_t ram_size, } } - isa_dev = isa_create_simple("i8042"); - DMA_init(0); #ifdef HAS_AUDIO audio_init(pci_enabled ? pci_bus : NULL, isa_irq); #endif - for(i = 0; i < MAX_FD; i++) { - fd[i] = drive_get(IF_FLOPPY, 0, i); - } - floppy_controller = fdctrl_init_isa(fd); - cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd, floppy_controller, rtc_state);