From patchwork Sat Jun 22 08:50:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hu Tao X-Patchwork-Id: 253365 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 134D72C0415 for ; Sat, 22 Jun 2013 18:52:22 +1000 (EST) Received: from localhost ([::1]:36792 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqJYS-00014E-6M for incoming@patchwork.ozlabs.org; Sat, 22 Jun 2013 04:52:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43391) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqJXv-000137-O2 for qemu-devel@nongnu.org; Sat, 22 Jun 2013 04:51:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UqJXu-0003ZO-He for qemu-devel@nongnu.org; Sat, 22 Jun 2013 04:51:47 -0400 Received: from [222.73.24.84] (port=8818 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UqJXu-0003NV-6x for qemu-devel@nongnu.org; Sat, 22 Jun 2013 04:51:46 -0400 X-IronPort-AV: E=Sophos;i="4.87,917,1363104000"; d="scan'208";a="7638482" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 22 Jun 2013 16:48:35 +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 r5M8pTqf002351; Sat, 22 Jun 2013 16:51:29 +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 2013062216502035-2388908 ; Sat, 22 Jun 2013 16:50:20 +0800 From: Hu Tao To: qemu-devel Date: Sat, 22 Jun 2013 16:50:15 +0800 Message-Id: <25c4fce0937523ea2c53e54c41326c7f8423a2d5.1371804804.git.hutao@cn.fujitsu.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: MIME-Version: 1.0 X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/06/22 16:50:20, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/06/22 16:50:20 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 222.73.24.84 Cc: Peter Crosthwaite , "Michael S. Tsirkin" , Anthony Liguori , Paolo Bonzini , Laszlo Ersek , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH 03/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 Cc: Anthony Liguori Cc: "Andreas Färber" Cc: "Michael S. Tsirkin" Cc: Laszlo Ersek Cc: Paolo Bonzini 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, };