From patchwork Fri Aug 28 13:28:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 32367 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 0E079B7BEF for ; Sat, 29 Aug 2009 00:06:01 +1000 (EST) Received: from localhost ([127.0.0.1]:46342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh23y-0000sO-Du for incoming@patchwork.ozlabs.org; Fri, 28 Aug 2009 10:04:22 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mh1Xu-0004mY-J7 for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:31:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mh1Xn-0004bC-69 for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:31:12 -0400 Received: from [199.232.76.173] (port=38616 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mh1Xm-0004aE-IA for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:31:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:21478) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mh1Xl-0004q0-VL for qemu-devel@nongnu.org; Fri, 28 Aug 2009 09:31:06 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n7SDV5lS009465 for ; Fri, 28 Aug 2009 09:31:05 -0400 Received: from localhost.localdomain (vpn2-8-216.ams2.redhat.com [10.36.8.216]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7SDUpno030148; Fri, 28 Aug 2009 09:31:04 -0400 From: Juan Quintela To: qemu-devel@nongnu.org Date: Fri, 28 Aug 2009 15:28:20 +0200 Message-Id: <0246cb9e80aced8a7b85c34fc94df6e7f8a51c55.1251465671.git.quintela@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 09/16] Fold piix3_init() intto i440fx_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 i440fx_init will now work properly if we don't setup piix3 Signed-off-by: Juan Quintela --- hw/pc.c | 3 +-- hw/pc.h | 3 +-- hw/piix_pci.c | 18 ++++++------------ 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/hw/pc.c b/hw/pc.c index 6477b41..e771170 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -1279,8 +1279,7 @@ static void pc_init1(ram_addr_t ram_size, isa_irq = qemu_allocate_irqs(isa_irq_handler, isa_irq_state, 24); if (pci_enabled) { - pci_bus = i440fx_init(&i440fx_state, isa_irq); - piix3_devfn = piix3_init(pci_bus, -1); + pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq); } else { pci_bus = NULL; isa_bus_new(NULL); diff --git a/hw/pc.h b/hw/pc.h index 3572165..ec5735b 100644 --- a/hw/pc.h +++ b/hw/pc.h @@ -120,9 +120,8 @@ int pcspk_audio_init(qemu_irq *pic); struct PCII440FXState; typedef struct PCII440FXState PCII440FXState; -PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic); +PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq *pic); void i440fx_set_smm(PCII440FXState *d, int val); -int piix3_init(PCIBus *bus, int devfn); void i440fx_init_memory_mappings(PCII440FXState *d); /* piix4.c */ diff --git a/hw/piix_pci.c b/hw/piix_pci.c index b931f84..86582fe 100644 --- a/hw/piix_pci.c +++ b/hw/piix_pci.c @@ -217,7 +217,9 @@ static int i440fx_initfn(PCIDevice *dev) return 0; } -PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic) +static PIIX3State *piix3_dev; + +PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq *pic) { DeviceState *dev; PCIBus *b; @@ -236,13 +238,14 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, qemu_irq *pic) d = pci_create_simple(b, 0, "i440FX"); *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d); + piix3_dev = DO_UPCAST(PIIX3State, dev, pci_create_simple(b, -1, "PIIX3")); + *piix3_devfn = piix3_dev->dev.devfn; + return b; } /* PIIX3 PCI to ISA bridge */ -static PIIX3State *piix3_dev; - static void piix3_set_irq(void *opaque, int irq_num, int level) { int i, pic_irq, pic_level; @@ -334,20 +337,11 @@ static int piix3_initfn(PCIDevice *dev) pci_conf[PCI_HEADER_TYPE] = PCI_HEADER_TYPE_NORMAL | PCI_HEADER_TYPE_MULTI_FUNCTION; // header_type = PCI_multifunction, generic - piix3_dev = d; piix3_reset(d); qemu_register_reset(piix3_reset, d); return 0; } -int piix3_init(PCIBus *bus, int devfn) -{ - PCIDevice *d; - - d = pci_create_simple(bus, devfn, "PIIX3"); - return d->devfn; -} - static PCIDeviceInfo i440fx_info[] = { { .qdev.name = "i440FX",