qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Fix IDE FDC emulation for no media


From: Pavel Hrdina
Subject: Re: [Qemu-devel] [PATCH] Fix IDE FDC emulation for no media
Date: Tue, 24 Apr 2012 14:05:55 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1



On 04/24/2012 01:38 PM, Stefan Hajnoczi wrote:
On Tue, Apr 24, 2012 at 10:46 AM, Pavel Hrdina<address@hidden>  wrote:
On 04/24/2012 11:06 AM, Stefan Hajnoczi wrote:

On Mon, Apr 23, 2012 at 5:06 PM, Pavel Hrdina<address@hidden>  wrote:

Hi,
this is the patch to fix incorrect handling of IDE floppy drive controller
emulation

s/IDE//

It's unrelated to IDE.

@@ -937,6 +940,9 @@ static int fdctrl_media_changed(FDrive *drv)

     if (!drv->bs)
         return 0;
+    /* This is needed for driver to detect there is no media in drive */
+    if (!bdrv_is_inserted(drv->bs))
+        return 1;
     if (drv->media_changed) {
         drv->media_changed = 0;
         ret = 1;

Why isn't the BlockDevOps.change_media_cb() mechanism enough to report
disk changes correctly?

Stefan

You can look here, http://www.isdaman.com/alsos/hardware/fdc/floppy.htm ,
for specification of DIR register. Bit7 is there as CHAN and in this bit is
saved information whether media is changed or not. This bit is set to true
while there is no media. And floppy driver is checking this bit to detect
media change or media missing.
I can't find anything from your link that says the bit is set while
there is no media.

"Disk Change: 1 = disk changed since last command, 0 = disk not changed"

The "82078 44 PIN CHMOS SINGLE-CHIP FLOPPY DISK CONTROLLER" datasheet
(http://wiki.qemu.org/images/f/f0/29047403.pdf) doesn't give details
but suggests what you are saying.  It says "DSKCHG monitors the pin of
the same name and
reflects the opposite value seen on the disk cable".  So perhaps this
is really a level-triggered "is the drive empty?" bit.

This is still pretty unclear to me.  Also, if you need to implement
the level-triggered behavior, then can we remove/simplify/clean up the
existing media change code in hw/fdc.c?

Stefan
I didn't find anything about that too, but I checked this behaviour on real floppy drive and it returns always this bit setted up without media. It could be probably good to rewrite media change code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]