From patchwork Fri Jun 22 10:33:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Hrdina X-Patchwork-Id: 166579 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 866D6B6FB7 for ; Fri, 22 Jun 2012 21:03:16 +1000 (EST) Received: from localhost ([::1]:37595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si1Ck-0001PH-8c for incoming@patchwork.ozlabs.org; Fri, 22 Jun 2012 06:35:06 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41721) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si1Bu-0007gh-Jm for qemu-devel@nongnu.org; Fri, 22 Jun 2012 06:34:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Si1Bn-00032P-Qn for qemu-devel@nongnu.org; Fri, 22 Jun 2012 06:34:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4729) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si1Bn-00031e-Iy for qemu-devel@nongnu.org; Fri, 22 Jun 2012 06:34:07 -0400 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 q5MAY6DA032181 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 22 Jun 2012 06:34:06 -0400 Received: from antique-laptop.brq.redhat.com (dhcp-27-171.brq.redhat.com [10.34.27.171]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5MAXvQx009017; Fri, 22 Jun 2012 06:34:05 -0400 From: Pavel Hrdina To: kwolf@redhat.com Date: Fri, 22 Jun 2012 12:33:56 +0200 Message-Id: In-Reply-To: References: In-Reply-To: <3359847e9dbdf4531ed17e86ef55be8b8676e329.1340360906.git.phrdina@redhat.com> References: <3359847e9dbdf4531ed17e86ef55be8b8676e329.1340360906.git.phrdina@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Pavel Hrdina , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v6 5/6] fdc_test: update media_change test 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 After rewrite DSKCHG bit handling the test has to be updated. Now is needed to seek to different track to clear DSKCHG bit. Signed-off-by: Pavel Hrdina --- tests/fdc-test.c | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-) diff --git a/tests/fdc-test.c b/tests/fdc-test.c index 610e2f1..5280eff 100644 --- a/tests/fdc-test.c +++ b/tests/fdc-test.c @@ -156,19 +156,20 @@ static uint8_t send_read_command(void) return ret; } -static void send_step_pulse(void) +static void send_step_pulse(bool chg_cyl) { int drive = 0; int head = 0; - static int cyl = 0; + int cyl = 0; + + if (chg_cyl) + cyl = (cyl + 1) % 4; floppy_send(CMD_SEEK); floppy_send(head << 2 | drive); g_assert(!get_irq(FLOPPY_IRQ)); floppy_send(cyl); ack_irq(); - - cyl = (cyl + 1) % 4; } static uint8_t cmos_read(uint8_t reg) @@ -195,8 +196,7 @@ static void test_no_media_on_start(void) assert_bit_set(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); - send_step_pulse(); - send_step_pulse(); + send_step_pulse(1); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir); @@ -227,7 +227,14 @@ static void test_media_change(void) dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); - send_step_pulse(); + send_step_pulse(0); + dir = inb(FLOPPY_BASE + reg_dir); + assert_bit_set(dir, DSKCHG); + dir = inb(FLOPPY_BASE + reg_dir); + assert_bit_set(dir, DSKCHG); + + /* Step to next track should clear DSKCHG bit. */ + send_step_pulse(1); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_clear(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir); @@ -243,7 +250,13 @@ static void test_media_change(void) dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); - send_step_pulse(); + send_step_pulse(0); + dir = inb(FLOPPY_BASE + reg_dir); + assert_bit_set(dir, DSKCHG); + dir = inb(FLOPPY_BASE + reg_dir); + assert_bit_set(dir, DSKCHG); + + send_step_pulse(1); dir = inb(FLOPPY_BASE + reg_dir); assert_bit_set(dir, DSKCHG); dir = inb(FLOPPY_BASE + reg_dir);