From 41a2b9596c9ed2a827e16e749632752dd2686647 Mon Sep 17 00:00:00 2001 From: aliguori Date: Mon, 11 Aug 2008 18:52:14 +0000 Subject: [PATCH] IDE SEEK_STAT flag Add SEEK_STAT in all non-error cases except sleep request, 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 case if we do not set it. Signed-off-by: Samuel Thibault Signed-off-by: Anthony Liguori git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4994 c046a42c-6fe2-441c-8c8c-71466251a162 --- hw/ide.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/hw/ide.c b/hw/ide.c index 104e7dce95..f4243c49aa 100644 --- a/hw/ide.c +++ b/hw/ide.c @@ -1048,7 +1048,7 @@ static void ide_sector_write_dma(IDEState *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); } @@ -1162,7 +1162,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 @@ -1240,10 +1240,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); } } @@ -1258,7 +1258,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); } @@ -1299,7 +1299,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: @@ -1349,7 +1349,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); } @@ -2067,14 +2067,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; @@ -2084,7 +2084,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: @@ -2159,13 +2159,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: @@ -2230,7 +2230,7 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val) case WIN_FLUSH_CACHE_EXT: if (s->bs) bdrv_flush(s->bs); - s->status = READY_STAT; + s->status = READY_STAT | SEEK_STAT; ide_set_irq(s); break; case WIN_STANDBY: @@ -2259,7 +2259,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; @@ -2276,7 +2276,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, @@ -2287,7 +2287,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: @@ -2299,14 +2299,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 */ @@ -2352,7 +2352,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: @@ -2566,7 +2566,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 */