From patchwork Mon Apr 30 14:47:15 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: 155879 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 3BFD5B6FA4 for ; Tue, 1 May 2012 00:47:41 +1000 (EST) Received: from localhost ([::1]:36301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOrt5-0000i5-3M for incoming@patchwork.ozlabs.org; Mon, 30 Apr 2012 10:47:39 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOrsu-0000hW-0k for qemu-devel@nongnu.org; Mon, 30 Apr 2012 10:47:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SOrss-0003aE-2I for qemu-devel@nongnu.org; Mon, 30 Apr 2012 10:47:27 -0400 Received: from mout.web.de ([212.227.15.3]:51144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SOrsr-0003ZP-Os for qemu-devel@nongnu.org; Mon, 30 Apr 2012 10:47:25 -0400 Received: from localhost.localdomain ([195.135.221.2]) by smtp.web.de (mrweb002) with ESMTPA (Nemesis) id 0Ls9JH-1SCOYu3vCx-013zFU; Mon, 30 Apr 2012 16:47:24 +0200 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Mon, 30 Apr 2012 16:47:15 +0200 Message-Id: <1335797240-14255-2-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1335797240-14255-1-git-send-email-andreas.faerber@web.de> References: <1335797240-14255-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 X-Provags-ID: V02:K0:GkBsPbcgoIuwMSJIBE3nHrbXQOL175qyS1Gl9BUt0Wd LjsX93KmWCpfurNN/DXTt6Tyyla4Sv5wh+aaisc+fnA5gnIAs5 w8aGFCLJsoqGQFTNXs/EATDb8cqoDMfozHb8TbYJ1FzsbFP3Mg rMch/yR3XJCahzL76AOckqenmaSlBcWif7APr7hYlV7Xco6fPP noI8uhc0vbDUIeFZXNMeg== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 212.227.15.3 Cc: blauwirbel@gmail.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , =?UTF-8?q?Herv=C3=A9=20Poussineau?= Subject: [Qemu-devel] [PATCH 1/5] i82378/i82374: Do not create DMA controller twice 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: Hervé Poussineau This fixes a crash in PReP emulation when using DMA controller to access floppy drive. Signed-off-by: Hervé Poussineau Signed-off-by: Andreas Färber --- hw/i82374.c | 5 ++++- hw/i82378.c | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/i82374.c b/hw/i82374.c index 67298a3..4a922c3 100644 --- a/hw/i82374.c +++ b/hw/i82374.c @@ -38,6 +38,7 @@ do { fprintf(stderr, "i82374 ERROR: " fmt , ## __VA_ARGS__); } while (0) typedef struct I82374State { uint8_t commands[8]; + qemu_irq out; } I82374State; static const VMStateDescription vmstate_i82374 = { @@ -99,7 +100,7 @@ static uint32_t i82374_read_descriptor(void *opaque, uint32_t nport) static void i82374_init(I82374State *s) { - DMA_init(1, NULL); + DMA_init(1, &s->out); memset(s->commands, 0, sizeof(s->commands)); } @@ -132,6 +133,8 @@ static int i82374_isa_init(ISADevice *dev) i82374_init(s); + qdev_init_gpio_out(&dev->qdev, &s->out, 1); + return 0; } diff --git a/hw/i82378.c b/hw/i82378.c index faad1a3..9b11d90 100644 --- a/hw/i82378.c +++ b/hw/i82378.c @@ -170,6 +170,7 @@ static void i82378_init(DeviceState *dev, I82378State *s) { ISABus *isabus = DO_UPCAST(ISABus, qbus, qdev_get_child_bus(dev, "isa.0")); ISADevice *pit; + ISADevice *isa; qemu_irq *out0_irq; /* This device has: @@ -199,8 +200,8 @@ static void i82378_init(DeviceState *dev, I82378State *s) pcspk_init(isabus, pit); /* 2 82C37 (dma) */ - DMA_init(1, &s->out[1]); - isa_create_simple(isabus, "i82374"); + isa = isa_create_simple(isabus, "i82374"); + qdev_connect_gpio_out(&isa->qdev, 0, s->out[1]); /* timer */ isa_create_simple(isabus, "mc146818rtc");