From patchwork Wed Nov 14 18:47:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 198992 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 381492C00A8 for ; Thu, 15 Nov 2012 06:15:21 +1100 (EST) Received: from localhost ([::1]:44493 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYi1y-0003SE-84 for incoming@patchwork.ozlabs.org; Wed, 14 Nov 2012 13:49:46 -0500 Received: from eggs.gnu.org ([208.118.235.92]:60015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYi0G-0000OA-4y for qemu-devel@nongnu.org; Wed, 14 Nov 2012 13:48:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TYi0D-0000Xa-0a for qemu-devel@nongnu.org; Wed, 14 Nov 2012 13:48:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TYi0C-0000XV-OR for qemu-devel@nongnu.org; Wed, 14 Nov 2012 13:47:56 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAEIltiV031288 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 Nov 2012 13:47:55 -0500 Received: from dhcp-5-188.str.redhat.com (vpn1-4-191.ams2.redhat.com [10.36.4.191]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAEIlTlT028359; Wed, 14 Nov 2012 13:47:54 -0500 From: Kevin Wolf To: anthony@codemonkey.ws Date: Wed, 14 Nov 2012 19:47:18 +0100 Message-Id: <1352918847-3696-18-git-send-email-kwolf@redhat.com> In-Reply-To: <1352918847-3696-1-git-send-email-kwolf@redhat.com> References: <1352918847-3696-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-MIME-Autoconverted: from 8bit to quoted-printable by mx1.redhat.com id qAEIltiV031288 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 17/26] fdc: fix false FD_SR0_SEEK 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 Do not always set FD_SR0_SEEK, as callers already set it if needed. Signed-off-by: Hervé Poussineau Signed-off-by: Kevin Wolf --- hw/fdc.c | 10 +++++++--- tests/fdc-test.c | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/hw/fdc.c b/hw/fdc.c index a9a2a2a..525ba20 100644 --- a/hw/fdc.c +++ b/hw/fdc.c @@ -1149,10 +1149,14 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0, uint8_t status1, uint8_t status2) { FDrive *cur_drv; - cur_drv = get_cur_drv(fdctrl); - fdctrl->status0 = status0 | FD_SR0_SEEK | (cur_drv->head << 2) | - GET_CUR_DRV(fdctrl); + + fdctrl->status0 &= ~(FD_SR0_DS0 | FD_SR0_DS1 | FD_SR0_HEAD); + fdctrl->status0 |= GET_CUR_DRV(fdctrl); + if (cur_drv->head) { + fdctrl->status0 |= FD_SR0_HEAD; + } + fdctrl->status0 |= status0; FLOPPY_DPRINTF("transfer status: %02x %02x %02x (%02x)\n", status0, status1, status2, fdctrl->status0); diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 4649e3f..1156112 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -154,7 +154,7 @@ static uint8_t send_read_command(void) } st0 = floppy_recv(); - if (st0 != 0x60) { + if (st0 != 0x40) { ret = 1; } @@ -398,7 +398,7 @@ static void test_read_no_dma_1(void) outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08); send_seek(0); - ret = send_read_no_dma_command(1, 0x24); /* FIXME: should be 0x04 */ + ret = send_read_no_dma_command(1, 0x04); g_assert(ret == 0); } @@ -408,7 +408,7 @@ static void test_read_no_dma_18(void) outb(FLOPPY_BASE + reg_dor, inb(FLOPPY_BASE + reg_dor) & ~0x08); send_seek(0); - ret = send_read_no_dma_command(18, 0x24); /* FIXME: should be 0x04 */ + ret = send_read_no_dma_command(18, 0x04); g_assert(ret == 0); }