From patchwork Thu May 28 20:04:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 478192 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1Yy42e-0000vE-L6 for mharc-qemu-devel@gnu.org; Thu, 28 May 2015 16:04:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yy42Z-0000lf-6I for qemu-devel@nongnu.org; Thu, 28 May 2015 16:04:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yy42Y-0005go-3t for qemu-devel@nongnu.org; Thu, 28 May 2015 16:04:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54297) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yy42V-0005gY-Op; Thu, 28 May 2015 16:04:27 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id 3A13A3500F9; Thu, 28 May 2015 20:04:27 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-121.ams2.redhat.com [10.36.116.121]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t4SK4FvA030488; Thu, 28 May 2015 16:04:22 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org, lersek@redhat.com Date: Thu, 28 May 2015 22:04:08 +0200 Message-Id: <1432843451-9653-2-git-send-email-lersek@redhat.com> In-Reply-To: <1432843451-9653-1-git-send-email-lersek@redhat.com> References: <1432843451-9653-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , qemu-block@nongnu.org, "Michael S. Tsirkin" , Markus Armbruster , "Gabriel L. Somlo" , Gerd Hoffmann , Paolo Bonzini , John Snow Subject: [Qemu-devel] [PATCH v2 1/4] i386/pc: pc_basic_device_init(): delegate FDC creation request 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: , X-List-Received-Date: Thu, 28 May 2015 20:04:34 -0000 This patch introduces no observable change, but it allows the callers of pc_basic_device_init(), ie. pc_init1() and pc_q35_init(), to request (or not request) the creation of the FDC explicitly. At the moment both callers pass constant create_fdctrl=true (hence no observable change). Assuming a board passes create_fdctrl=false, "floppy" will be NULL on output, and (beyond the FDC not being created) that NULL will be passed on to pc_cmos_init(). Luckily, pc_cmos_init() already handles that case. Cc: Markus Armbruster Cc: Paolo Bonzini Cc: Gerd Hoffmann Cc: John Snow Cc: "Gabriel L. Somlo" Cc: "Michael S. Tsirkin" Cc: Kevin Wolf Cc: qemu-block@nongnu.org Signed-off-by: Laszlo Ersek --- Notes: v2: - reduce scope of first patch - rename "force_fdctrl" to "create_fdctrl", so that it reflects more closely that it's a request from the board code [Markus, Michael] - split out "floppy drive implies FDC" magic to separate patch [Markus, Michael] - drop Paolo's A-b (move it to the last patch) and drop Markus's R-b. include/hw/i386/pc.h | 1 + hw/i386/pc.c | 3 ++- hw/i386/pc_piix.c | 2 +- hw/i386/pc_q35.c | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index 1b35168..58a92c1 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -199,6 +199,7 @@ qemu_irq *pc_allocate_cpu_irq(void); DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus); void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, + bool create_fdctrl, ISADevice **floppy, bool no_vmport, uint32 hpet_irqs); diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 769eb25..a49323d 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1395,6 +1395,7 @@ static const MemoryRegionOps ioportF0_io_ops = { void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, ISADevice **rtc_state, + bool create_fdctrl, ISADevice **floppy, bool no_vmport, uint32 hpet_irqs) @@ -1490,7 +1491,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi, for(i = 0; i < MAX_FD; i++) { fd[i] = drive_get(IF_FLOPPY, 0, i); } - *floppy = fdctrl_init_isa(isa_bus, fd); + *floppy = create_fdctrl ? fdctrl_init_isa(isa_bus, fd) : NULL; } void pc_nic_init(ISABus *isa_bus, PCIBus *pci_bus) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 212e263..9f530c4 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -242,7 +242,7 @@ static void pc_init1(MachineState *machine, } /* init basic PC hardware */ - pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, + pc_basic_device_init(isa_bus, gsi, &rtc_state, true, &floppy, (pc_machine->vmport != ON_OFF_AUTO_ON), 0x4); pc_nic_init(isa_bus, pci_bus); diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index e67f2de..2411349 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -250,7 +250,7 @@ static void pc_q35_init(MachineState *machine) } /* init basic PC hardware */ - pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, + pc_basic_device_init(isa_bus, gsi, &rtc_state, true, &floppy, (pc_machine->vmport != ON_OFF_AUTO_ON), 0xff0104); /* connect pm stuff to lpc */