aboutsummaryrefslogtreecommitdiff
path: root/hw/ide.c
diff options
context:
space:
mode:
authorbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-01-22 23:52:27 +0000
committerbellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162>2004-01-22 23:52:27 +0000
commita136e5a8b176bfd3ba687769ed999c55782f2584 (patch)
treec4b8c04a76be363a6132a9559ea82639b78bc048 /hw/ide.c
parent4796f5e9bc5efc46d0149bae57b530afd26ff65d (diff)
ATAPI transfer size fix (NetBSD CDROM access fix) - added WIN_CHECKPOWERMODE1 - set error to zero in some cases
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@574 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ide.c')
-rw-r--r--hw/ide.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/hw/ide.c b/hw/ide.c
index 480a7be6d3..794572109a 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -550,6 +550,7 @@ static void ide_sector_read(IDEState *s)
int ret, n;
s->status = READY_STAT | SEEK_STAT;
+ s->error = 0; /* not needed by IDE spec, but needed by Windows */
sector_num = ide_get_sector(s);
n = s->nsector;
if (n == 0) {
@@ -694,10 +695,9 @@ static void ide_atapi_cmd_reply_end(IDEState *s)
if (byte_count_limit & 1)
byte_count_limit--;
size = byte_count_limit;
- } else {
- s->lcyl = size;
- s->hcyl = size >> 8;
}
+ s->lcyl = size;
+ s->hcyl = size >> 8;
s->elementary_transfer_size = size;
/* we cannot transmit more than one sector at a time */
if (s->lba != -1) {
@@ -1106,6 +1106,7 @@ static void ide_ioport_write(CPUState *env, uint32_t addr, uint32_t val)
break;
case WIN_SPECIFY:
case WIN_RECAL:
+ s->error = 0;
s->status = READY_STAT;
ide_set_irq(s);
break;
@@ -1135,6 +1136,7 @@ static void ide_ioport_write(CPUState *env, uint32_t addr, uint32_t val)
break;
case WIN_WRITE:
case WIN_WRITE_ONCE:
+ s->error = 0;
s->status = SEEK_STAT;
s->req_nb_sectors = 1;
ide_transfer_start(s, s->io_buffer, 512, ide_sector_write);
@@ -1148,6 +1150,7 @@ static void ide_ioport_write(CPUState *env, uint32_t addr, uint32_t val)
case WIN_MULTWRITE:
if (!s->mult_sectors)
goto abort_cmd;
+ s->error = 0;
s->status = SEEK_STAT;
s->req_nb_sectors = s->mult_sectors;
n = s->nsector;
@@ -1160,6 +1163,11 @@ static void ide_ioport_write(CPUState *env, uint32_t addr, uint32_t val)
s->status = READY_STAT;
ide_set_irq(s);
break;
+ case WIN_CHECKPOWERMODE1:
+ s->nsector = 0xff; /* device active or idle */
+ s->status = READY_STAT;
+ ide_set_irq(s);
+ break;
/* ATAPI commands */
case WIN_PIDENTIFY: