Revision e119bcac hw/ide/atapi.c
b/hw/ide/atapi.c | ||
---|---|---|
416 | 416 |
if (layer != 0) |
417 | 417 |
return -ASC_INV_FIELD_IN_CMD_PACKET; |
418 | 418 |
|
419 |
bdrv_get_geometry(s->bs, &total_sectors); |
|
420 |
total_sectors >>= 2; |
|
421 |
if (total_sectors == 0) |
|
419 |
total_sectors = s->nb_sectors >> 2; |
|
420 |
if (total_sectors == 0) { |
|
422 | 421 |
return -ASC_MEDIUM_NOT_PRESENT; |
422 |
} |
|
423 | 423 |
|
424 | 424 |
buf[4] = 1; /* DVD-ROM, part version 1 */ |
425 | 425 |
buf[5] = 0xf; /* 120mm disc, minimum rate unspecified */ |
... | ... | |
881 | 881 |
static void cmd_seek(IDEState *s, uint8_t* buf) |
882 | 882 |
{ |
883 | 883 |
unsigned int lba; |
884 |
uint64_t total_sectors; |
|
885 |
|
|
886 |
bdrv_get_geometry(s->bs, &total_sectors); |
|
884 |
uint64_t total_sectors = s->nb_sectors >> 2; |
|
887 | 885 |
|
888 |
total_sectors >>= 2; |
|
889 | 886 |
if (total_sectors == 0) { |
890 | 887 |
ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); |
891 | 888 |
return; |
... | ... | |
944 | 941 |
static void cmd_read_toc_pma_atip(IDEState *s, uint8_t* buf) |
945 | 942 |
{ |
946 | 943 |
int format, msf, start_track, len; |
947 |
uint64_t total_sectors; |
|
944 |
uint64_t total_sectors = s->nb_sectors >> 2;
|
|
948 | 945 |
int max_len; |
949 | 946 |
|
950 |
bdrv_get_geometry(s->bs, &total_sectors); |
|
951 |
|
|
952 |
total_sectors >>= 2; |
|
953 | 947 |
if (total_sectors == 0) { |
954 | 948 |
ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); |
955 | 949 |
return; |
... | ... | |
990 | 984 |
|
991 | 985 |
static void cmd_read_cdvd_capacity(IDEState *s, uint8_t* buf) |
992 | 986 |
{ |
993 |
uint64_t total_sectors; |
|
994 |
|
|
995 |
bdrv_get_geometry(s->bs, &total_sectors); |
|
987 |
uint64_t total_sectors = s->nb_sectors >> 2; |
|
996 | 988 |
|
997 |
total_sectors >>= 2; |
|
998 | 989 |
if (total_sectors == 0) { |
999 | 990 |
ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); |
1000 | 991 |
return; |
Also available in: Unified diff