From: Kevin Wolf <kwolf@redhat.com>
To: anthony@codemonkey.ws
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 5/5] fdc: simplify media change handling
Date: Mon, 7 May 2012 19:55:54 +0200 [thread overview]
Message-ID: <1336413354-5244-6-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1336413354-5244-1-git-send-email-kwolf@redhat.com>
From: Hervé Poussineau <hpoussin@reactos.org>
This also (partly) fixes IBM OS/2 Warp 4.0 floppy installation, where
not all floppies have the same format (2x80x18 for the first ones,
2x80x23 for the next ones).
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
hw/fdc.c | 29 +++++++++++------------------
1 files changed, 11 insertions(+), 18 deletions(-)
diff --git a/hw/fdc.c b/hw/fdc.c
index 756d4ce..cb4cd25 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -705,6 +705,15 @@ static void fdctrl_raise_irq(FDCtrl *fdctrl, uint8_t status0)
qemu_set_irq(fdctrl->irq, 1);
fdctrl->sra |= FD_SRA_INTPEND;
}
+ if (status0 & FD_SR0_SEEK) {
+ FDrive *cur_drv;
+ /* A seek clears the disk change line (if a disk is inserted) */
+ cur_drv = get_cur_drv(fdctrl);
+ if (cur_drv->max_track) {
+ cur_drv->media_changed = 0;
+ }
+ }
+
fdctrl->reset_sensei = 0;
fdctrl->status0 = status0;
FLOPPY_DPRINTF("Set interrupt status to 0x%02x\n", fdctrl->status0);
@@ -936,23 +945,7 @@ static void fdctrl_write_ccr(FDCtrl *fdctrl, uint32_t value)
static int fdctrl_media_changed(FDrive *drv)
{
- int ret;
-
- if (!drv->bs)
- return 0;
- if (drv->media_changed) {
- drv->media_changed = 0;
- ret = 1;
- } else {
- ret = bdrv_media_changed(drv->bs);
- if (ret < 0) {
- ret = 0; /* we don't know, assume no */
- }
- }
- if (ret) {
- fd_revalidate(drv);
- }
- return ret;
+ return drv->media_changed;
}
/* Digital input register : 0x07 (read-only) */
@@ -1856,6 +1849,7 @@ static void fdctrl_change_cb(void *opaque, bool load)
FDrive *drive = opaque;
drive->media_changed = 1;
+ fd_revalidate(drive);
}
static const BlockDevOps fdctrl_block_ops = {
@@ -1886,7 +1880,6 @@ static int fdctrl_connect_drives(FDCtrl *fdctrl)
fd_init(drive);
fd_revalidate(drive);
if (drive->bs) {
- drive->media_changed = 1;
bdrv_set_dev_ops(drive->bs, &fdctrl_block_ops, drive);
}
}
--
1.7.6.5
next prev parent reply other threads:[~2012-05-07 17:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-07 17:55 [Qemu-devel] [PULL 0/5] Block patches for 1.1 Kevin Wolf
2012-05-07 17:55 ` [Qemu-devel] [PATCH 1/5] sheepdog: switch to writethrough mode if cluster doesn't support flush Kevin Wolf
2012-05-07 17:55 ` [Qemu-devel] [PATCH 2/5] qcow2: Limit COW to where it's needed Kevin Wolf
2012-05-07 17:55 ` [Qemu-devel] [PATCH 3/5] block: make bdrv_create adopt coroutine Kevin Wolf
2012-05-07 17:55 ` [Qemu-devel] [PATCH 4/5] qcow2: lock on prealloc Kevin Wolf
2012-05-07 17:55 ` Kevin Wolf [this message]
2012-05-08 16:11 ` [Qemu-devel] [PULL 0/5] Block patches for 1.1 Anthony Liguori
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=1336413354-5244-6-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).