Commit 33256a25b3b31915b9038eefe7923c68bb034118

Authored by aliguori
1 parent 9e472e10

Fix IDE DIAGNOSE for packet devices (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):

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

Signed-off-by: Vincent Sanders <vince@simtec.co.uk>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5452 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 9 additions and 2 deletions
hw/ide.c
... ... @@ -2308,8 +2308,15 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
2308 2308 break;
2309 2309 case WIN_DIAGNOSE:
2310 2310 ide_set_signature(s);
2311   - s->status = READY_STAT | SEEK_STAT;
2312   - s->error = 0x01;
  2311 + if (s->is_cdrom)
  2312 + s->status = 0; /* ATAPI spec (v6) section 9.10 defines packet
  2313 + * devices to return a clear status register
  2314 + * with READY_STAT *not* set. */
  2315 + else
  2316 + s->status = READY_STAT | SEEK_STAT;
  2317 + s->error = 0x01; /* Device 0 passed, Device 1 passed or not
  2318 + * present.
  2319 + */
2313 2320 ide_set_irq(s);
2314 2321 break;
2315 2322 case WIN_SRST:
... ...