From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Kevin Wolf" <kwolf@redhat.com>,
"Hervé Poussineau" <hpoussin@reactos.org>
Subject: [Qemu-devel] [PATCH 4/8] fdc: fix false FD_SR0_SEEK
Date: Thu, 6 Sep 2012 21:17:55 +0200 [thread overview]
Message-ID: <1346959079-8307-5-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1346959079-8307-1-git-send-email-hpoussin@reactos.org>
fdctrl_start/stop_transfer() used to set FD_SR0_SEEK no matter if
there actually was a seek or not. This is obviously wrong.
fdctrl_seek_to_next_sect() has this information because it performs
the seek itself.
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
hw/fdc.c | 13 +++++++++----
tests/fdc-test.c | 2 +-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/hw/fdc.c b/hw/fdc.c
index d8bffb6..3c343b1 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1123,11 +1123,13 @@ static int fdctrl_seek_to_next_sect(FDCtrl *fdctrl, FDrive *cur_drv)
} else {
new_head = 0;
new_track++;
+ fdctrl->status0 |= FD_SR0_SEEK;
if ((cur_drv->flags & FDISK_DBL_SIDES) == 0) {
ret = 0;
}
}
} else {
+ fdctrl->status0 |= FD_SR0_SEEK;
new_track++;
ret = 0;
}
@@ -1147,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);
@@ -1284,7 +1290,6 @@ static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction)
if (direction != FD_DIR_WRITE)
fdctrl->msr |= FD_MSR_DIO;
/* IO based transfer: calculate len */
- fdctrl->status0 |= FD_SR0_SEEK;
fdctrl_raise_irq(fdctrl);
}
diff --git a/tests/fdc-test.c b/tests/fdc-test.c
index 18051ef..b825959 100644
--- a/tests/fdc-test.c
+++ b/tests/fdc-test.c
@@ -153,7 +153,7 @@ static uint8_t send_read_command(void)
}
st0 = floppy_recv();
- if (st0 != 0x60) {
+ if (st0 != 0x40) {
ret = 1;
}
--
1.7.10.4
next prev parent reply other threads:[~2012-09-06 19:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-06 19:17 [Qemu-devel] [PATCH 0/8] fdc: fix FD_SR0_SEEK flag + implement VERIFY Hervé Poussineau
2012-09-06 19:17 ` [Qemu-devel] [PATCH 1/8] fdc: Remove status0 parameter from fdctrl_set_fifo() Hervé Poussineau
2012-09-06 19:17 ` [Qemu-devel] [PATCH 2/8] fdc: use status0 field instead of a local variable Hervé Poussineau
2012-09-06 19:17 ` [Qemu-devel] [PATCH 3/8] fdc-test: Check READ ID Hervé Poussineau
2012-09-06 19:17 ` Hervé Poussineau [this message]
2012-09-06 19:17 ` [Qemu-devel] [PATCH 5/8] fdc: implement VERIFY command Hervé Poussineau
2012-09-06 19:17 ` [Qemu-devel] [PATCH 6/8] fdc-tests: add tests for " Hervé Poussineau
2012-09-06 19:17 ` [Qemu-devel] [PATCH 7/8] fdc: remove double affectation of FD_MSR_CMDBUSY flag Hervé Poussineau
2012-09-06 19:17 ` [Qemu-devel] [PATCH 8/8] fdc: fix typo in zero constant Hervé Poussineau
2012-09-07 10:27 ` [Qemu-devel] [PATCH 0/8] fdc: fix FD_SR0_SEEK flag + implement VERIFY 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=1346959079-8307-5-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=kwolf@redhat.com \
--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).