Commit 6b136f9e8f3934f50e07a01b537ade3b57f6b2ce

Authored by bellard
1 parent 2ddbbd10

CD-ROM detection fix


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@520 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 10 additions and 5 deletions
hw/ide.c
... ... @@ -40,14 +40,14 @@
40 40 #include <sys/wait.h>
41 41 #include <netinet/in.h>
42 42  
  43 +#define NO_THUNK_TYPE_SIZE
  44 +#include "thunk.h"
  45 +
43 46 #include "cpu.h"
44 47 #include "exec-all.h"
45 48  
46 49 #include "vl.h"
47 50  
48   -#define NO_THUNK_TYPE_SIZE
49   -#include "thunk.h"
50   -
51 51 /* debug IDE devices */
52 52 //#define DEBUG_IDE
53 53 //#define DEBUG_IDE_ATAPI
... ... @@ -1128,6 +1128,8 @@ static void ide_ioport_write(CPUX86State *env, uint32_t addr, uint32_t val)
1128 1128 break;
1129 1129 case WIN_READ:
1130 1130 case WIN_READ_ONCE:
  1131 + if (!s->bs)
  1132 + goto abort_cmd;
1131 1133 s->req_nb_sectors = 1;
1132 1134 ide_sector_read(s);
1133 1135 break;
... ... @@ -1174,7 +1176,7 @@ static void ide_ioport_write(CPUX86State *env, uint32_t addr, uint32_t val)
1174 1176 if (!s->is_cdrom)
1175 1177 goto abort_cmd;
1176 1178 ide_set_signature(s);
1177   - s->status = READY_STAT;
  1179 + s->status = 0x00; /* NOTE: READY is _not_ set */
1178 1180 s->error = 0x01;
1179 1181 break;
1180 1182 case WIN_PACKETCMD:
... ... @@ -1271,7 +1273,10 @@ static void ide_cmd_write(CPUX86State *env, uint32_t addr, uint32_t val)
1271 1273 /* high to low */
1272 1274 for(i = 0;i < 2; i++) {
1273 1275 s = &ide_if[i];
1274   - s->status = READY_STAT;
  1276 + if (s->is_cdrom)
  1277 + s->status = 0x00; /* NOTE: READY is _not_ set */
  1278 + else
  1279 + s->status = READY_STAT;
1275 1280 ide_set_signature(s);
1276 1281 }
1277 1282 }
... ...