Small issue in the IDE emulation
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'
ide.c +9 -2
@@ -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 :
Signature · 2 lines
Regards Vincent http://www.kyllikki.org/
Quoted 9 lines · 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'
ide.c line 2314
Quoted 9 lines
ide.c +4
-2@@ -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
Quoted 6 lines · Samuel Thibault
Quoted 5 lines · 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.
Quoted 15 lines
ide.c line 2314
Quoted 13 lines
=== modified file '
hw/ide.c'ide.c +4
-2@@ -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.
Quoted 4 lines
Samuel
Signature · 2 lines
Regards Vincent http://www.kyllikki.org/
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?
Signature · 2 lines
Regards Vincent http://www.kyllikki.org/
Quoted 3 lines · Vincent Sanders
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