Commit a136e5a8b176bfd3ba687769ed999c55782f2584
1 parent
4796f5e9
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
Showing
1 changed file
with
11 additions
and
3 deletions
hw/ide.c
... | ... | @@ -550,6 +550,7 @@ static void ide_sector_read(IDEState *s) |
550 | 550 | int ret, n; |
551 | 551 | |
552 | 552 | s->status = READY_STAT | SEEK_STAT; |
553 | + s->error = 0; /* not needed by IDE spec, but needed by Windows */ | |
553 | 554 | sector_num = ide_get_sector(s); |
554 | 555 | n = s->nsector; |
555 | 556 | if (n == 0) { |
... | ... | @@ -694,10 +695,9 @@ static void ide_atapi_cmd_reply_end(IDEState *s) |
694 | 695 | if (byte_count_limit & 1) |
695 | 696 | byte_count_limit--; |
696 | 697 | size = byte_count_limit; |
697 | - } else { | |
698 | - s->lcyl = size; | |
699 | - s->hcyl = size >> 8; | |
700 | 698 | } |
699 | + s->lcyl = size; | |
700 | + s->hcyl = size >> 8; | |
701 | 701 | s->elementary_transfer_size = size; |
702 | 702 | /* we cannot transmit more than one sector at a time */ |
703 | 703 | if (s->lba != -1) { |
... | ... | @@ -1106,6 +1106,7 @@ static void ide_ioport_write(CPUState *env, uint32_t addr, uint32_t val) |
1106 | 1106 | break; |
1107 | 1107 | case WIN_SPECIFY: |
1108 | 1108 | case WIN_RECAL: |
1109 | + s->error = 0; | |
1109 | 1110 | s->status = READY_STAT; |
1110 | 1111 | ide_set_irq(s); |
1111 | 1112 | break; |
... | ... | @@ -1135,6 +1136,7 @@ static void ide_ioport_write(CPUState *env, uint32_t addr, uint32_t val) |
1135 | 1136 | break; |
1136 | 1137 | case WIN_WRITE: |
1137 | 1138 | case WIN_WRITE_ONCE: |
1139 | + s->error = 0; | |
1138 | 1140 | s->status = SEEK_STAT; |
1139 | 1141 | s->req_nb_sectors = 1; |
1140 | 1142 | 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) |
1148 | 1150 | case WIN_MULTWRITE: |
1149 | 1151 | if (!s->mult_sectors) |
1150 | 1152 | goto abort_cmd; |
1153 | + s->error = 0; | |
1151 | 1154 | s->status = SEEK_STAT; |
1152 | 1155 | s->req_nb_sectors = s->mult_sectors; |
1153 | 1156 | n = s->nsector; |
... | ... | @@ -1160,6 +1163,11 @@ static void ide_ioport_write(CPUState *env, uint32_t addr, uint32_t val) |
1160 | 1163 | s->status = READY_STAT; |
1161 | 1164 | ide_set_irq(s); |
1162 | 1165 | break; |
1166 | + case WIN_CHECKPOWERMODE1: | |
1167 | + s->nsector = 0xff; /* device active or idle */ | |
1168 | + s->status = READY_STAT; | |
1169 | + ide_set_irq(s); | |
1170 | + break; | |
1163 | 1171 | |
1164 | 1172 | /* ATAPI commands */ |
1165 | 1173 | case WIN_PIDENTIFY: | ... | ... |