From patchwork Sun Jun 10 15:57:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 164004 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7EF5EB6FF5 for ; Mon, 11 Jun 2012 01:58:25 +1000 (EST) Received: from localhost ([::1]:48148 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdkX1-0005ML-EV for incoming@patchwork.ozlabs.org; Sun, 10 Jun 2012 11:58:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdkWq-0005Kd-Au for qemu-devel@nongnu.org; Sun, 10 Jun 2012 11:58:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdkWo-0005yG-5N for qemu-devel@nongnu.org; Sun, 10 Jun 2012 11:58:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53992 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdkWn-0005xb-Sb; Sun, 10 Jun 2012 11:58:10 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 5C1DD90B96; Sun, 10 Jun 2012 17:58:05 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 10 Jun 2012 17:57:54 +0200 Message-Id: <1339343875-6958-2-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1339343875-6958-1-git-send-email-afaerber@suse.de> References: <1339343875-6958-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Anthony Liguori , Wanpeng Li , "Michael S. Tsirkin" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "open list:PReP" , Anthony Liguori Subject: [Qemu-devel] [PATCH v2 1/2] pci_host: Turn into SysBus-derived QOM type 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 From: Andreas Färber Allows us to access PCIHostState QOM-style with PCI_HOST() macro. Update PReP Raven PCI to derive from this type. Signed-off-by: Anthony Liguori Signed-off-by: Wanpeng Li Signed-off-by: Andreas Färber Reviewed-by: Anthony Liguori --- hw/pci_host.c | 11 +++++++++++ hw/pci_host.h | 3 +++ hw/prep_pci.c | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/pci_host.c b/hw/pci_host.c index 8041778..347bfa6 100644 --- a/hw/pci_host.c +++ b/hw/pci_host.c @@ -165,4 +165,15 @@ const MemoryRegionOps pci_host_data_be_ops = { .endianness = DEVICE_BIG_ENDIAN, }; +static const TypeInfo pci_host_type_info = { + .name = TYPE_PCI_HOST, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(PCIHostState), +}; + +static void pci_host_register_types(void) +{ + type_register_static(&pci_host_type_info); +} +type_init(pci_host_register_types) diff --git a/hw/pci_host.h b/hw/pci_host.h index 359e38f..fba9fde 100644 --- a/hw/pci_host.h +++ b/hw/pci_host.h @@ -30,6 +30,9 @@ #include "sysbus.h" +#define TYPE_PCI_HOST "pci-host" +#define PCI_HOST(obj) OBJECT_CHECK(PCIHostState, (obj), TYPE_PCI_HOST) + struct PCIHostState { SysBusDevice busdev; MemoryRegion conf_mem; diff --git a/hw/prep_pci.c b/hw/prep_pci.c index 38dbff4..3e9f6b8 100644 --- a/hw/prep_pci.c +++ b/hw/prep_pci.c @@ -183,9 +183,9 @@ static void raven_pcihost_class_init(ObjectClass *klass, void *data) dc->no_user = 1; } -static TypeInfo raven_pcihost_info = { +static const TypeInfo raven_pcihost_info = { .name = "raven-pcihost", - .parent = TYPE_SYS_BUS_DEVICE, + .parent = TYPE_PCI_HOST, .instance_size = sizeof(PREPPCIState), .class_init = raven_pcihost_class_init, };