From patchwork Tue Mar 17 09:39:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: BALATON Zoltan X-Patchwork-Id: 1256260 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=eik.bme.hu Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48hTGW6QQZz9sPR for ; Tue, 17 Mar 2020 21:01:38 +1100 (AEDT) Received: from localhost ([::1]:55420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE92W-0004DC-HA for incoming@patchwork.ozlabs.org; Tue, 17 Mar 2020 06:01:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36743) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE8yw-0008Io-QP for qemu-devel@nongnu.org; Tue, 17 Mar 2020 05:57:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jE8yu-0006Tv-Ek for qemu-devel@nongnu.org; Tue, 17 Mar 2020 05:57:54 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:31350) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jE8yo-00060Q-Sh; Tue, 17 Mar 2020 05:57:48 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id AE0EF747E18; Tue, 17 Mar 2020 10:57:44 +0100 (CET) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 2E4E4747E0B; Tue, 17 Mar 2020 10:57:44 +0100 (CET) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v2 1/7] hw/ide: Get rid of piix3_init functions Date: Tue, 17 Mar 2020 10:39:17 +0100 MIME-Version: 1.0 To: qemu-devel@nongnu.org, qemu-block@nongnu.org X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 152.66.115.2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , "Michael S. Tsirkin" , John Snow , Mark Cave-Ayland , Markus Armbruster , hpoussin@reactos.org, Aleksandar Markovic , Paolo Bonzini , philmd@redhat.com, Artyom Tarasenko , Richard Henderson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This removes pci_piix3_ide_init() and pci_piix3_xen_ide_init() functions similar to clean up done to other ide devices. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Markus Armbruster --- hw/i386/pc_piix.c | 10 +++++----- hw/ide/pci.c | 1 + hw/ide/piix.c | 21 +-------------------- include/hw/ide.h | 2 -- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index e2d98243bc..c399398739 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -39,6 +39,7 @@ #include "hw/usb.h" #include "net/net.h" #include "hw/ide.h" +#include "hw/ide/pci.h" #include "hw/irq.h" #include "sysemu/kvm.h" #include "hw/kvm/clock.h" @@ -242,11 +243,10 @@ static void pc_init1(MachineState *machine, ide_drive_get(hd, ARRAY_SIZE(hd)); if (pcmc->pci_enabled) { PCIDevice *dev; - if (xen_enabled()) { - dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); - } else { - dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); - } + + dev = pci_create_simple(pci_bus, piix3_devfn + 1, + xen_enabled() ? "piix3-ide-xen" : "piix3-ide"); + pci_ide_create_devs(dev, hd); idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); pc_cmos_init(pcms, idebus[0], idebus[1], rtc_state); diff --git a/hw/ide/pci.c b/hw/ide/pci.c index 1a6a287e76..4fc76c5225 100644 --- a/hw/ide/pci.c +++ b/hw/ide/pci.c @@ -476,6 +476,7 @@ const VMStateDescription vmstate_ide_pci = { } }; +/* hd_table must contain 4 block drivers */ void pci_ide_create_devs(PCIDevice *dev, DriveInfo **hd_table) { PCIIDEState *d = PCI_IDE(dev); diff --git a/hw/ide/piix.c b/hw/ide/piix.c index bc575b4d70..8bcd6b72c2 100644 --- a/hw/ide/piix.c +++ b/hw/ide/piix.c @@ -197,15 +197,6 @@ int pci_piix3_xen_ide_unplug(DeviceState *dev, bool aux) return 0; } -PCIDevice *pci_piix3_xen_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) -{ - PCIDevice *dev; - - dev = pci_create_simple(bus, devfn, "piix3-ide-xen"); - pci_ide_create_devs(dev, hd_table); - return dev; -} - static void pci_piix_ide_exitfn(PCIDevice *dev) { PCIIDEState *d = PCI_IDE(dev); @@ -217,17 +208,6 @@ static void pci_piix_ide_exitfn(PCIDevice *dev) } } -/* hd_table must contain 4 block drivers */ -/* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */ -PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) -{ - PCIDevice *dev; - - dev = pci_create_simple(bus, devfn, "piix3-ide"); - pci_ide_create_devs(dev, hd_table); - return dev; -} - /* hd_table must contain 4 block drivers */ /* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */ PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) @@ -239,6 +219,7 @@ PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn) return dev; } +/* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */ static void piix3_ide_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); diff --git a/include/hw/ide.h b/include/hw/ide.h index dea0ecf5be..883bbaeb9b 100644 --- a/include/hw/ide.h +++ b/include/hw/ide.h @@ -12,8 +12,6 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq, DriveInfo *hd0, DriveInfo *hd1); /* ide-pci.c */ -PCIDevice *pci_piix3_xen_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); -PCIDevice *pci_piix3_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); PCIDevice *pci_piix4_ide_init(PCIBus *bus, DriveInfo **hd_table, int devfn); int pci_piix3_xen_ide_unplug(DeviceState *dev, bool aux);