qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Small issue in the IDE emulation
@ 2008-10-04 11:10 Vincent Sanders
  2008-10-04 11:30 ` Samuel Thibault
  2008-10-06 11:14 ` Vincent Sanders
  0 siblings, 2 replies; 5+ messages in thread
From: Vincent Sanders @ 2008-10-04 11:10 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1157 bytes --]

While doing some other work I have come across a small issue with the
DIAGNOSE command in the qemu IDE implementation. The status register
value is dependant on the drive being a packet device or not. The
simple patch (attached) fixes this.

=== modified file 'hw/ide.c'
--- hw/ide.c	2008-10-01 01:43:16 +0000
+++ hw/ide.c	2008-10-04 10:56:58 +0000
@@ -2308,8 +2308,15 @@
             break;
         case WIN_DIAGNOSE:
             ide_set_signature(s);
-            s->status = READY_STAT | SEEK_STAT;
-            s->error = 0x01;
+            if (s->is_cdrom)
+                s->status = 0; /* ATAPI spec (v6) section 9.10 defines packet
+                                * devices to return a clear status register
+                                * with READY_STAT *not* set. */
+            else
+                s->status = READY_STAT | SEEK_STAT;
+            s->error = 0x01; /* Device 0 passed, Device 1 passed or not
+                              * present. 
+                              */
             ide_set_irq(s);
             break;
         case WIN_SRST:


-- 
Regards Vincent
http://www.kyllikki.org/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Small issue in the IDE emulation
  2008-10-04 11:10 [Qemu-devel] Small issue in the IDE emulation Vincent Sanders
@ 2008-10-04 11:30 ` Samuel Thibault
  2008-10-04 11:51   ` Vincent Sanders
  2008-10-06 11:14 ` Vincent Sanders
  1 sibling, 1 reply; 5+ messages in thread
From: Samuel Thibault @ 2008-10-04 11:30 UTC (permalink / raw)
  To: qemu-devel

Vincent Sanders, le Sat 04 Oct 2008 12:10:02 +0100, a écrit :
> While doing some other work I have come across a small issue with the
> DIAGNOSE command in the qemu IDE implementation. The status register
> value is dependant on the drive being a packet device or not. The
> simple patch (attached) fixes this.
> 
> === modified file 'hw/ide.c'
> --- hw/ide.c	2008-10-01 01:43:16 +0000
> +++ hw/ide.c	2008-10-04 10:56:58 +0000
> @@ -2308,8 +2308,15 @@
>              break;
>          case WIN_DIAGNOSE:
>              ide_set_signature(s);
> -            s->status = READY_STAT | SEEK_STAT;
> -            s->error = 0x01;
> +            if (s->is_cdrom)
> +                s->status = 0; /* ATAPI spec (v6) section 9.10 defines packet
> +                                * devices to return a clear status register
> +                                * with READY_STAT *not* set. */

But shouldn't we at least set SEEK_STAT?

Samuel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Small issue in the IDE emulation
  2008-10-04 11:30 ` Samuel Thibault
@ 2008-10-04 11:51   ` Vincent Sanders
  0 siblings, 0 replies; 5+ messages in thread
From: Vincent Sanders @ 2008-10-04 11:51 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 1718 bytes --]

On Sat, Oct 04, 2008 at 01:30:37PM +0200, Samuel Thibault wrote:
> Vincent Sanders, le Sat 04 Oct 2008 12:10:02 +0100, a écrit :
> > While doing some other work I have come across a small issue with the
> > DIAGNOSE command in the qemu IDE implementation. The status register
> > value is dependant on the drive being a packet device or not. The
> > simple patch (attached) fixes this.
> > 
> > === modified file 'hw/ide.c'
> > --- hw/ide.c	2008-10-01 01:43:16 +0000
> > +++ hw/ide.c	2008-10-04 10:56:58 +0000
> > @@ -2308,8 +2308,15 @@
> >              break;
> >          case WIN_DIAGNOSE:
> >              ide_set_signature(s);
> > -            s->status = READY_STAT | SEEK_STAT;
> > -            s->error = 0x01;
> > +            if (s->is_cdrom)
> > +                s->status = 0; /* ATAPI spec (v6) section 9.10 defines packet
> > +                                * devices to return a clear status register
> > +                                * with READY_STAT *not* set. */
> 
> But shouldn't we at least set SEEK_STAT?

Spec says:

"If the device implements the PACKET command feature set, the device
SHALL clear bits 6,5,4,3,2 and 0 in the Status register to zero."

I beleive a version of this spec is available online
http://www.t10.org/t13/project/d1410r3a-ATA-ATAPI-6.pdf page 362 (pdf
page is 376 there is an offset) is where this is mentioned.

And I just went and checked a couple of physical devices doing it and
they do indeed behave as per the spec. 

A few boot loaders that support older drive diagnostics through this
method seem to get a bit confused if the status is not clear.

> 
> Samuel
> 
> 

-- 
Regards Vincent
http://www.kyllikki.org/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Small issue in the IDE emulation
  2008-10-04 11:10 [Qemu-devel] Small issue in the IDE emulation Vincent Sanders
  2008-10-04 11:30 ` Samuel Thibault
@ 2008-10-06 11:14 ` Vincent Sanders
  2008-10-07 20:19   ` Anthony Liguori
  1 sibling, 1 reply; 5+ messages in thread
From: Vincent Sanders @ 2008-10-06 11:14 UTC (permalink / raw)
  To: qemu-devel

Whats the correct way to get this patch included? I think I answered
the questions on its validity? If not what else is required please?

-- 
Regards Vincent
http://www.kyllikki.org/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Small issue in the IDE emulation
  2008-10-06 11:14 ` Vincent Sanders
@ 2008-10-07 20:19   ` Anthony Liguori
  0 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2008-10-07 20:19 UTC (permalink / raw)
  To: qemu-devel, vince

Vincent Sanders wrote:
> Whats the correct way to get this patch included? I think I answered
> the questions on its validity? If not what else is required please?
>   

It's easy for the maintainers to miss a patch if you don't put [PATCH] 
in the subject.  I'll queue this patch up for testing if you can resend 
the patch with a proper Signed-off-by attached.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-10-07 20:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-04 11:10 [Qemu-devel] Small issue in the IDE emulation Vincent Sanders
2008-10-04 11:30 ` Samuel Thibault
2008-10-04 11:51   ` Vincent Sanders
2008-10-06 11:14 ` Vincent Sanders
2008-10-07 20:19   ` Anthony Liguori

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).