From patchwork Sun Jun 30 13:23:57 2013 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: 255894 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 9F7792C00A6 for ; Sun, 30 Jun 2013 23:31:43 +1000 (EST) Received: from localhost ([::1]:39497 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtHjA-0007bJ-D3 for incoming@patchwork.ozlabs.org; Sun, 30 Jun 2013 09:31:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54902) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtHix-0007aM-JR for qemu-devel@nongnu.org; Sun, 30 Jun 2013 09:31:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtHiw-0006Px-Cq for qemu-devel@nongnu.org; Sun, 30 Jun 2013 09:31:27 -0400 Received: from cantor2.suse.de ([195.135.220.15]:49951 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtHbn-0003lj-Va for qemu-devel@nongnu.org; Sun, 30 Jun 2013 09:24:04 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 77F13A51BB; Sun, 30 Jun 2013 15:24:03 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Sun, 30 Jun 2013 15:23:57 +0200 Message-Id: <1372598637-30681-1-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <9d1116516fd0d5c38ff376df4b8437e197eb8295.1372055322.git.peter.crosthwaite@xilinx.com> References: <9d1116516fd0d5c38ff376df4b8437e197eb8295.1372055322.git.peter.crosthwaite@xilinx.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Paolo Bonzini , Peter Crosthwaite , =?UTF-8?q?Andreas=20F=C3=A4rber?= , "Michael S. Tsirkin" Subject: [Qemu-devel] [PATCH qom-next] xen/xen_platform: QOM parent field cleanup 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 Replace direct uses of PCIXenPlatformState::pci_dev field with QOM casts and rename it to parent_obj. Signed-off-by: Andreas Färber --- hw/xen/xen_platform.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/hw/xen/xen_platform.c b/hw/xen/xen_platform.c index 24c2118..5138acb 100644 --- a/hw/xen/xen_platform.c +++ b/hw/xen/xen_platform.c @@ -49,7 +49,10 @@ #define PFFLAG_ROM_LOCK 1 /* Sets whether ROM memory area is RW or RO */ typedef struct PCIXenPlatformState { - PCIDevice pci_dev; + /*< private >*/ + PCIDevice parent_obj; + /*< public >*/ + MemoryRegion fixed_io; MemoryRegion bar; MemoryRegion mmio_bar; @@ -121,7 +124,8 @@ static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t v PCIXenPlatformState *s = opaque; switch (addr) { - case 0: + case 0: { + PCIDevice *pci_dev = PCI_DEVICE(s); /* Unplug devices. Value is a bitmask of which devices to unplug, with bit 0 the IDE devices, bit 1 the network devices, and bit 2 the non-primary-master IDE devices. */ @@ -129,16 +133,17 @@ static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t v DPRINTF("unplug disks\n"); bdrv_drain_all(); bdrv_flush_all(); - pci_unplug_disks(s->pci_dev.bus); + pci_unplug_disks(pci_dev->bus); } if (val & UNPLUG_ALL_NICS) { DPRINTF("unplug nics\n"); - pci_unplug_nics(s->pci_dev.bus); + pci_unplug_nics(pci_dev->bus); } if (val & UNPLUG_AUX_IDE_DISKS) { DPRINTF("unplug auxiliary disks not supported\n"); } break; + } case 2: switch (val) { case 1: @@ -367,7 +372,7 @@ static const VMStateDescription vmstate_xen_platform = { .minimum_version_id_old = 4, .post_load = xen_platform_post_load, .fields = (VMStateField []) { - VMSTATE_PCI_DEVICE(pci_dev, PCIXenPlatformState), + VMSTATE_PCI_DEVICE(parent_obj, PCIXenPlatformState), VMSTATE_UINT8(flags, PCIXenPlatformState), VMSTATE_END_OF_LIST() } @@ -378,7 +383,7 @@ static int xen_platform_initfn(PCIDevice *dev) PCIXenPlatformState *d = XEN_PLATFORM(dev); uint8_t *pci_conf; - pci_conf = d->pci_dev.config; + pci_conf = dev->config; pci_set_word(pci_conf + PCI_COMMAND, PCI_COMMAND_IO | PCI_COMMAND_MEMORY); @@ -387,11 +392,11 @@ static int xen_platform_initfn(PCIDevice *dev) pci_conf[PCI_INTERRUPT_PIN] = 1; platform_ioport_bar_setup(d); - pci_register_bar(&d->pci_dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->bar); + pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &d->bar); /* reserve 16MB mmio address for share memory*/ platform_mmio_setup(d); - pci_register_bar(&d->pci_dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH, + pci_register_bar(dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH, &d->mmio_bar); platform_fixed_ioport_init(d);