qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 10/26] fdc: Remove status0 parameter from fdctrl_set_fifo()
Date: Wed, 14 Nov 2012 19:47:11 +0100	[thread overview]
Message-ID: <1352918847-3696-11-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1352918847-3696-1-git-send-email-kwolf@redhat.com>

It decided whether an interrupt is triggered. Only one caller made use
of this functionality, so move the code there.

In this one caller, the interrupt must actually be triggered
unconditionally, like it was before commit 2fee0088. For example, a
successful read without an implied seek can result in st0 = 0, but still
triggers the interrupt.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
---
 hw/fdc.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/hw/fdc.c b/hw/fdc.c
index bf8c1d9..3585220 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1079,15 +1079,12 @@ static void fdctrl_reset_fifo(FDCtrl *fdctrl)
 }
 
 /* Set FIFO status for the host to read */
-static void fdctrl_set_fifo(FDCtrl *fdctrl, int fifo_len, uint8_t status0)
+static void fdctrl_set_fifo(FDCtrl *fdctrl, int fifo_len)
 {
     fdctrl->data_dir = FD_DIR_READ;
     fdctrl->data_len = fifo_len;
     fdctrl->data_pos = 0;
     fdctrl->msr |= FD_MSR_CMDBUSY | FD_MSR_RQM | FD_MSR_DIO;
-    if (status0) {
-        fdctrl_raise_irq(fdctrl, status0);
-    }
 }
 
 /* Set an error: unimplemented/unknown command */
@@ -1096,7 +1093,7 @@ static void fdctrl_unimplemented(FDCtrl *fdctrl, int direction)
     qemu_log_mask(LOG_UNIMP, "fdc: unimplemented command 0x%02x\n",
                   fdctrl->fifo[0]);
     fdctrl->fifo[0] = FD_SR0_INVCMD;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 /* Seek to next sector
@@ -1170,7 +1167,9 @@ static void fdctrl_stop_transfer(FDCtrl *fdctrl, uint8_t status0,
     }
     fdctrl->msr |= FD_MSR_RQM | FD_MSR_DIO;
     fdctrl->msr &= ~FD_MSR_NONDMA;
-    fdctrl_set_fifo(fdctrl, 7, fdctrl->status0);
+
+    fdctrl_set_fifo(fdctrl, 7);
+    fdctrl_raise_irq(fdctrl, fdctrl->status0);
 }
 
 /* Prepare a data transfer (either DMA or FIFO) */
@@ -1536,7 +1535,7 @@ static void fdctrl_handle_lock(FDCtrl *fdctrl, int direction)
 {
     fdctrl->lock = (fdctrl->fifo[0] & 0x80) ? 1 : 0;
     fdctrl->fifo[0] = fdctrl->lock << 4;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_dumpreg(FDCtrl *fdctrl, int direction)
@@ -1561,20 +1560,20 @@ static void fdctrl_handle_dumpreg(FDCtrl *fdctrl, int direction)
         (cur_drv->perpendicular << 2);
     fdctrl->fifo[8] = fdctrl->config;
     fdctrl->fifo[9] = fdctrl->precomp_trk;
-    fdctrl_set_fifo(fdctrl, 10, 0);
+    fdctrl_set_fifo(fdctrl, 10);
 }
 
 static void fdctrl_handle_version(FDCtrl *fdctrl, int direction)
 {
     /* Controller's version */
     fdctrl->fifo[0] = fdctrl->version;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_partid(FDCtrl *fdctrl, int direction)
 {
     fdctrl->fifo[0] = 0x41; /* Stepping 1 */
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_restore(FDCtrl *fdctrl, int direction)
@@ -1627,7 +1626,7 @@ static void fdctrl_handle_save(FDCtrl *fdctrl, int direction)
     fdctrl->fifo[12] = fdctrl->pwrd;
     fdctrl->fifo[13] = 0;
     fdctrl->fifo[14] = 0;
-    fdctrl_set_fifo(fdctrl, 15, 0);
+    fdctrl_set_fifo(fdctrl, 15);
 }
 
 static void fdctrl_handle_readid(FDCtrl *fdctrl, int direction)
@@ -1693,7 +1692,7 @@ static void fdctrl_handle_sense_drive_status(FDCtrl *fdctrl, int direction)
         (cur_drv->head << 2) |
         GET_CUR_DRV(fdctrl) |
         0x28;
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_recalibrate(FDCtrl *fdctrl, int direction)
@@ -1718,7 +1717,7 @@ static void fdctrl_handle_sense_interrupt_status(FDCtrl *fdctrl, int direction)
         fdctrl->reset_sensei--;
     } else if (!(fdctrl->sra & FD_SRA_INTPEND)) {
         fdctrl->fifo[0] = FD_SR0_INVCMD;
-        fdctrl_set_fifo(fdctrl, 1, 0);
+        fdctrl_set_fifo(fdctrl, 1);
         return;
     } else {
         fdctrl->fifo[0] =
@@ -1727,7 +1726,7 @@ static void fdctrl_handle_sense_interrupt_status(FDCtrl *fdctrl, int direction)
     }
 
     fdctrl->fifo[1] = cur_drv->track;
-    fdctrl_set_fifo(fdctrl, 2, 0);
+    fdctrl_set_fifo(fdctrl, 2);
     fdctrl_reset_irq(fdctrl);
     fdctrl->status0 = FD_SR0_RDYCHG;
 }
@@ -1769,7 +1768,7 @@ static void fdctrl_handle_powerdown_mode(FDCtrl *fdctrl, int direction)
 {
     fdctrl->pwrd = fdctrl->fifo[1];
     fdctrl->fifo[0] = fdctrl->fifo[1];
-    fdctrl_set_fifo(fdctrl, 1, 0);
+    fdctrl_set_fifo(fdctrl, 1);
 }
 
 static void fdctrl_handle_option(FDCtrl *fdctrl, int direction)
@@ -1788,7 +1787,7 @@ static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direct
             fdctrl->fifo[0] = fdctrl->fifo[1];
             fdctrl->fifo[2] = 0;
             fdctrl->fifo[3] = 0;
-            fdctrl_set_fifo(fdctrl, 4, 0);
+            fdctrl_set_fifo(fdctrl, 4);
         } else {
             fdctrl_reset_fifo(fdctrl);
         }
@@ -1796,7 +1795,7 @@ static void fdctrl_handle_drive_specification_command(FDCtrl *fdctrl, int direct
         /* ERROR */
         fdctrl->fifo[0] = 0x80 |
             (cur_drv->head << 2) | GET_CUR_DRV(fdctrl);
-        fdctrl_set_fifo(fdctrl, 1, 0);
+        fdctrl_set_fifo(fdctrl, 1);
     }
 }
 
-- 
1.7.6.5

  parent reply	other threads:[~2012-11-14 18:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14 18:47 [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 01/26] qemu: Document GlusterFS block driver usage Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 02/26] qcow2: Fix refcount table size calculation Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 03/26] qemu-iotests: qcow2: Test growing large refcount table Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 04/26] MAINTAINERS: add Stefan Hajnoczi as block and virtio-blk co-maintainer Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 05/26] block: Workaround for older versions of MinGW gcc Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 06/26] tests: allow qemu-iotests to be run against nbd backend Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 07/26] aio: switch aiocb_size type int -> size_t Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 08/26] aio: use g_slice_alloc() for AIOCB pooling Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 09/26] aio: rename AIOPool to AIOCBInfo Kevin Wolf
2012-11-14 18:47 ` Kevin Wolf [this message]
2012-11-14 18:47 ` [Qemu-devel] [PATCH 11/26] fdc-test: split test_media_change() test, so insert part can be reused Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 12/26] fdc-test: insert media before fuzzing registers Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 13/26] fdc-test: add tests for non-DMA READ command Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 14/26] fdc: use status0 field instead of a local variable Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 15/26] fdc: fix FD_SR0_SEEK for non-DMA transfers and multi sectors transfers Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 16/26] fdc: fix FD_SR0_SEEK for initial seek on DMA transfers Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 17/26] fdc: fix false FD_SR0_SEEK Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 18/26] fdc-test: Check READ ID Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 19/26] fdc: implement VERIFY command Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 20/26] fdc-tests: add tests for " Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 21/26] fdc: remove double affectation of FD_MSR_CMDBUSY flag Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 22/26] fdc: fix typo in zero constant Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 23/26] fdc: remove last usage of FD_STATE_SEEK Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 24/26] vmdk: Fix data corruption bug in WRITE and READ handling Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 25/26] megasas: Use bdrv_drain_all instead of qemu_aio_flush Kevin Wolf
2012-11-14 18:47 ` [Qemu-devel] [PATCH 26/26] qemu-io: " Kevin Wolf
2012-11-19  9:12 ` [Qemu-devel] [PULL 00/26] Block patches Kevin Wolf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352918847-3696-11-git-send-email-kwolf@redhat.com \
    --to=kwolf@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).