Revision e590ecbe
b/hw/scsi-disk.c | ||
---|---|---|
1080 | 1080 |
{ |
1081 | 1081 |
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); |
1082 | 1082 |
uint64_t nb_sectors; |
1083 |
int page, dbd, buflen, ret, page_control; |
|
1083 |
bool dbd; |
|
1084 |
int page, buflen, ret, page_control; |
|
1084 | 1085 |
uint8_t *p; |
1085 | 1086 |
uint8_t dev_specific_param; |
1086 | 1087 |
|
1087 |
dbd = r->req.cmd.buf[1] & 0x8;
|
|
1088 |
dbd = (r->req.cmd.buf[1] & 0x8) != 0;
|
|
1088 | 1089 |
page = r->req.cmd.buf[2] & 0x3f; |
1089 | 1090 |
page_control = (r->req.cmd.buf[2] & 0xc0) >> 6; |
1090 | 1091 |
DPRINTF("Mode Sense(%d) (page %d, xfer %zd, page_control %d)\n", |
... | ... | |
1092 | 1093 |
memset(outbuf, 0, r->req.cmd.xfer); |
1093 | 1094 |
p = outbuf; |
1094 | 1095 |
|
1095 |
if (bdrv_is_read_only(s->qdev.conf.bs)) { |
|
1096 |
dev_specific_param = 0x80; /* Readonly. */ |
|
1096 |
dev_specific_param = 0x00; |
|
1097 |
if (s->qdev.type == TYPE_DISK) { |
|
1098 |
if (bdrv_is_read_only(s->qdev.conf.bs)) { |
|
1099 |
dev_specific_param |= 0x80; /* Readonly. */ |
|
1100 |
} |
|
1097 | 1101 |
} else { |
1098 |
dev_specific_param = 0x00; |
|
1102 |
/* MMC prescribes that CD/DVD drives have no block descriptors, |
|
1103 |
* and defines no device-specific parameter. */ |
|
1104 |
dbd = true; |
|
1099 | 1105 |
} |
1100 | 1106 |
|
1101 | 1107 |
if (r->req.cmd.buf[0] == MODE_SENSE) { |
... | ... | |
1110 | 1116 |
p += 8; |
1111 | 1117 |
} |
1112 | 1118 |
|
1113 |
/* MMC prescribes that CD/DVD drives have no block descriptors. */ |
|
1114 | 1119 |
bdrv_get_geometry(s->qdev.conf.bs, &nb_sectors); |
1115 |
if (!dbd && s->qdev.type == TYPE_DISK && nb_sectors) {
|
|
1120 |
if (!dbd && nb_sectors) { |
|
1116 | 1121 |
if (r->req.cmd.buf[0] == MODE_SENSE) { |
1117 | 1122 |
outbuf[3] = 8; /* Block descriptor length */ |
1118 | 1123 |
} else { /* MODE_SENSE_10 */ |
Also available in: Unified diff