Skip to contentSkip to conversation

Fix IDE DIAGNOSE for packet devices

PATCH Applied Vincent Sanders 2 participants 2 messages Oct 9, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix IDE DIAGNOSE for packet devices

The DIAGNOSE command in the qemu IDE implementation has an error when use dfor packet devices.

The status register value is dependant on the drive being a packet device or not, this patch corrects the returned status.

Quoted 1 line

From the ATA/PI specification (V6 draft):

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

A selection of physical devices have been checked and do conform to the specifications behaviour.

=== 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:
#1 lore raw
Quoted 8 lines · Vincent Sanders

The DIAGNOSE command in the qemu IDE implementation has an error when use dfor packet devices.

The status register value is dependant on the drive being a packet device or not, this patch corrects the returned status.

From the ATA/PI specification (V6 draft):

Quoted 8 lines

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

A selection of physical devices have been checked and do conform to the specifications behaviour.

Applied. Thanks.

Regards,

Anthony Liguori