From patchwork Mon Jul 1 10:18:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 256067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6883C2C007B for ; Mon, 1 Jul 2013 20:24:34 +1000 (EST) Received: from localhost ([::1]:43775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtbHc-0006zr-6w for incoming@patchwork.ozlabs.org; Mon, 01 Jul 2013 06:24:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtbCz-0008Tj-V5 for qemu-devel@nongnu.org; Mon, 01 Jul 2013 06:19:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtbCx-0001HQ-K5 for qemu-devel@nongnu.org; Mon, 01 Jul 2013 06:19:45 -0400 Received: from [222.73.24.84] (port=20227 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtbCx-0001Fv-95 for qemu-devel@nongnu.org; Mon, 01 Jul 2013 06:19:43 -0400 X-IronPort-AV: E=Sophos;i="4.87,973,1363104000"; d="scan'208";a="7747757" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 01 Jul 2013 18:16:42 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r61AJcdK015554 for ; Mon, 1 Jul 2013 18:19:38 +0800 Received: from G08FNSTD100614.fnst.cn.fujitsu.com ([10.167.233.156]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013070118181369-2618434 ; Mon, 1 Jul 2013 18:18:13 +0800 From: Hu Tao To: qemu-devel Date: Mon, 1 Jul 2013 18:18:20 +0800 Message-Id: <5097791eb12a1c3e2c8963143d4c39ea42348b58.1372673778.git.hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/07/01 18:18:13, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/07/01 18:18:14, Serialize complete at 2013/07/01 18:18:14 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Subject: [Qemu-devel] [PATCH v2 04/26] i440fx-pcihost: use realize for i440fx-pcihost X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Hu Tao --- hw/pci-host/piix.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/hw/pci-host/piix.c b/hw/pci-host/piix.c index f9e68c3..801341a 100644 --- a/hw/pci-host/piix.c +++ b/hw/pci-host/piix.c @@ -197,21 +197,26 @@ static const VMStateDescription vmstate_i440fx = { } }; -static int i440fx_pcihost_initfn(SysBusDevice *dev) +static void i440fx_pcihost_initfn(Object *obj) { - PCIHostState *s = PCI_HOST_BRIDGE(dev); + PCIHostState *s = PCI_HOST_BRIDGE(obj); memory_region_init_io(&s->conf_mem, &pci_host_conf_le_ops, s, "pci-conf-idx", 4); - sysbus_add_io(dev, 0xcf8, &s->conf_mem); - sysbus_init_ioports(&s->busdev, 0xcf8, 4); - memory_region_init_io(&s->data_mem, &pci_host_data_le_ops, s, "pci-conf-data", 4); - sysbus_add_io(dev, 0xcfc, &s->data_mem); - sysbus_init_ioports(&s->busdev, 0xcfc, 4); +} - return 0; +static void i440fx_pcihost_realize(DeviceState *dev, Error **errp) +{ + PCIHostState *s = PCI_HOST_BRIDGE(dev); + SysBusDevice *b = SYS_BUS_DEVICE(dev); + + sysbus_add_io(b, 0xcf8, &s->conf_mem); + sysbus_init_ioports(b, 0xcf8, 4); + + sysbus_add_io(b, 0xcfc, &s->data_mem); + sysbus_init_ioports(b, 0xcfc, 4); } static int i440fx_initfn(PCIDevice *dev) @@ -632,9 +637,8 @@ static const TypeInfo i440fx_info = { static void i440fx_pcihost_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); - SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); - k->init = i440fx_pcihost_initfn; + dc->realize = i440fx_pcihost_realize; dc->fw_name = "pci"; dc->no_user = 1; } @@ -643,6 +647,7 @@ static const TypeInfo i440fx_pcihost_info = { .name = "i440FX-pcihost", .parent = TYPE_PCI_HOST_BRIDGE, .instance_size = sizeof(I440FXState), + .instance_init = i440fx_pcihost_initfn, .class_init = i440fx_pcihost_class_init, };