Add SEEK_STAT in all non-error cases except sleep requests, since our
seek times are virtually 0. Although this flag is deprecated by newer
ATA standards, Linux at least checks it for CD drives, and would timeout
in some cases if we do not set it.
Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
diff --git a/hw/ide.c b/hw/ide.c
index dae6e7f..9fb7e18 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -1306,14 +1306,14 @@ static void ide_flush_cb(void *opaque, int ret)
return;
}
else
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
}
static void ide_atapi_cmd_ok(IDEState *s)
{
s->error = 0;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO | ATAPI_INT_REASON_CD;
ide_set_irq(s);
}
@@ -1427,7 +1427,7 @@ static void ide_atapi_cmd_reply_end(IDEState *s)
if (s->packet_transfer_size <= 0) {
/* end of transfer */
ide_transfer_stop(s);
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO |
ATAPI_INT_REASON_CD;
ide_set_irq(s);
#ifdef DEBUG_IDE_ATAPI
@@ -1505,10 +1505,10 @@ static void ide_atapi_cmd_reply(IDEState *s, int size,
int max_size)
s->io_buffer_index = 0;
if (s->atapi_dma) {
- s->status = READY_STAT | DRQ_STAT;
+ s->status = READY_STAT | SEEK_STAT | DRQ_STAT;
ide_dma_start(s, ide_atapi_cmd_read_dma_cb);
} else {
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_atapi_cmd_reply_end(s);
}
}
@@ -1523,7 +1523,7 @@ static void ide_atapi_cmd_read_pio(IDEState *s, int lba,
int nb_sectors,
s->io_buffer_index = sector_size;
s->cd_sector_size = sector_size;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_atapi_cmd_reply_end(s);
}
@@ -1568,7 +1568,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int
ret)
}
if (s->packet_transfer_size <= 0) {
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
s->nsector = (s->nsector & ~7) | ATAPI_INT_REASON_IO |
ATAPI_INT_REASON_CD;
ide_set_irq(s);
eot:
@@ -1614,7 +1614,7 @@ static void ide_atapi_cmd_read_dma(IDEState *s, int lba,
int nb_sectors,
s->cd_sector_size = sector_size;
/* XXX: check if BUSY_STAT should be set */
- s->status = READY_STAT | DRQ_STAT | BUSY_STAT;
+ s->status = READY_STAT | SEEK_STAT | DRQ_STAT | BUSY_STAT;
ide_dma_start(s, ide_atapi_cmd_read_dma_cb);
}
@@ -2258,14 +2258,14 @@ static void ide_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
if (s->is_cf && s->nsector == 0) {
/* Disable Read and Write Multiple */
s->mult_sectors = 0;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
} else if ((s->nsector & 0xff) != 0 &&
((s->nsector & 0xff) > MAX_MULT_SECTORS ||
(s->nsector & (s->nsector - 1)) != 0)) {
ide_abort_command(s);
} else {
s->mult_sectors = s->nsector & 0xff;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
}
ide_set_irq(s);
break;
@@ -2275,7 +2275,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr,
uint32_t val)
case WIN_VERIFY_ONCE:
/* do sector number check ? */
ide_cmd_lba48_transform(s, lba48);
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
break;
case WIN_READ_EXT:
@@ -2350,13 +2350,13 @@ static void ide_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
case WIN_READ_NATIVE_MAX:
ide_cmd_lba48_transform(s, lba48);
ide_set_sector(s, s->nb_sectors - 1);
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
break;
case WIN_CHECKPOWERMODE1:
case WIN_CHECKPOWERMODE2:
s->nsector = 0xff; /* device active or idle */
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
break;
case WIN_SETFEATURES:
@@ -2458,7 +2458,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr,
uint32_t val)
break;
case WIN_DIAGNOSE:
ide_set_signature(s);
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
s->error = 0x01;
ide_set_irq(s);
break;
@@ -2475,7 +2475,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr,
uint32_t val)
/* overlapping commands not supported */
if (s->feature & 0x02)
goto abort_cmd;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
s->atapi_dma = s->feature & 1;
s->nsector = 1;
ide_transfer_start(s, s->io_buffer, ATAPI_PACKET_SIZE,
@@ -2486,7 +2486,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr,
uint32_t val)
if (!s->is_cf)
goto abort_cmd;
s->error = 0x09; /* miscellaneous error */
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
break;
case CFA_ERASE_SECTORS:
@@ -2498,14 +2498,14 @@ static void ide_ioport_write(void *opaque, uint32_t
addr, uint32_t val)
if (val == CFA_ERASE_SECTORS)
s->media_changed = 1;
s->error = 0x00;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
break;
case CFA_TRANSLATE_SECTOR:
if (!s->is_cf)
goto abort_cmd;
s->error = 0x00;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
memset(s->io_buffer, 0, 0x200);
s->io_buffer[0x00] = s->hcyl; /* Cyl MSB */
s->io_buffer[0x01] = s->lcyl; /* Cyl LSB */
@@ -2551,7 +2551,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr,
uint32_t val)
default:
goto abort_cmd;
}
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_irq(s);
break;
default:
@@ -2769,7 +2769,7 @@ static void ide_reset(IDEState *s)
s->mult_sectors = MAX_MULT_SECTORS;
s->cur_drive = s;
s->select = 0xa0;
- s->status = READY_STAT;
+ s->status = READY_STAT | SEEK_STAT;
ide_set_signature(s);
/* init the transfer handler so that 0xffff is returned on data
accesses */
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|