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
This commit is contained in:
bellard 2004-01-22 23:52:27 +00:00
parent 4796f5e9bc
commit a136e5a8b1
1 changed files with 11 additions and 3 deletions

View File

@ -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: