Revision ab9adc88
b/hw/scsi-bus.c | ||
---|---|---|
495 | 495 |
return names[cmd]; |
496 | 496 |
} |
497 | 497 |
|
498 |
/* Called by the devices when data is ready for the HBA. The HBA should |
|
499 |
start a DMA operation to read or fill the device's data buffer. |
|
500 |
Once it completes, calling one of req->dev->info->read_data or |
|
501 |
req->dev->info->write_data (depending on the direction of the |
|
502 |
transfer) will restart I/O. */ |
|
503 |
void scsi_req_data(SCSIRequest *req, int len) |
|
504 |
{ |
|
505 |
trace_scsi_req_data(req->dev->id, req->lun, req->tag, len); |
|
506 |
req->bus->complete(req->bus, SCSI_REASON_DATA, req->tag, len); |
|
507 |
} |
|
508 |
|
|
498 | 509 |
void scsi_req_print(SCSIRequest *req) |
499 | 510 |
{ |
500 | 511 |
FILE *fp = stderr; |
b/hw/scsi-disk.c | ||
---|---|---|
170 | 170 |
n = r->iov.iov_len / 512; |
171 | 171 |
r->sector += n; |
172 | 172 |
r->sector_count -= n; |
173 |
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, r->iov.iov_len);
|
|
173 |
scsi_req_data(&r->req, r->iov.iov_len);
|
|
174 | 174 |
} |
175 | 175 |
|
176 | 176 |
|
... | ... | |
182 | 182 |
if (r->sector_count == (uint32_t)-1) { |
183 | 183 |
DPRINTF("Read buf_len=%zd\n", r->iov.iov_len); |
184 | 184 |
r->sector_count = 0; |
185 |
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, r->iov.iov_len);
|
|
185 |
scsi_req_data(&r->req, r->iov.iov_len);
|
|
186 | 186 |
return; |
187 | 187 |
} |
188 | 188 |
DPRINTF("Read sector_count=%d\n", r->sector_count); |
... | ... | |
245 | 245 |
vm_stop(VMSTOP_DISKFULL); |
246 | 246 |
} else { |
247 | 247 |
if (type == SCSI_REQ_STATUS_RETRY_READ) { |
248 |
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, 0);
|
|
248 |
scsi_req_data(&r->req, 0);
|
|
249 | 249 |
} |
250 | 250 |
scsi_command_complete(r, CHECK_CONDITION, |
251 | 251 |
HARDWARE_ERROR); |
... | ... | |
281 | 281 |
} |
282 | 282 |
r->iov.iov_len = len; |
283 | 283 |
DPRINTF("Write complete tag=0x%x more=%d\n", r->req.tag, len); |
284 |
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, len);
|
|
284 |
scsi_req_data(&r->req, len);
|
|
285 | 285 |
} |
286 | 286 |
} |
287 | 287 |
|
b/hw/scsi-generic.c | ||
---|---|---|
175 | 175 |
if (len == 0) { |
176 | 176 |
scsi_command_complete(r, 0); |
177 | 177 |
} else { |
178 |
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, len);
|
|
178 |
scsi_req_data(&r->req, len);
|
|
179 | 179 |
} |
180 | 180 |
} |
181 | 181 |
|
... | ... | |
212 | 212 |
DPRINTF("Sense: %d %d %d %d %d %d %d %d\n", |
213 | 213 |
r->buf[0], r->buf[1], r->buf[2], r->buf[3], |
214 | 214 |
r->buf[4], r->buf[5], r->buf[6], r->buf[7]); |
215 |
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, s->senselen);
|
|
215 |
scsi_req_data(&r->req, s->senselen);
|
|
216 | 216 |
return; |
217 | 217 |
} |
218 | 218 |
|
... | ... | |
263 | 263 |
|
264 | 264 |
if (r->len == 0) { |
265 | 265 |
r->len = r->buflen; |
266 |
r->req.bus->complete(r->req.bus, SCSI_REASON_DATA, r->req.tag, r->len);
|
|
266 |
scsi_req_data(&r->req, r->len);
|
|
267 | 267 |
return 0; |
268 | 268 |
} |
269 | 269 |
|
b/hw/scsi.h | ||
---|---|---|
105 | 105 |
|
106 | 106 |
int scsi_req_parse(SCSIRequest *req, uint8_t *buf); |
107 | 107 |
void scsi_req_print(SCSIRequest *req); |
108 |
void scsi_req_data(SCSIRequest *req, int len); |
|
108 | 109 |
void scsi_req_complete(SCSIRequest *req); |
109 | 110 |
|
110 | 111 |
#endif |
b/trace-events | ||
---|---|---|
207 | 207 |
|
208 | 208 |
# hw/scsi-bus.c |
209 | 209 |
disable scsi_req_alloc(int target, int lun, int tag) "target %d lun %d tag %d" |
210 |
disable scsi_req_data(int target, int lun, int tag, int len) "target %d lun %d tag %d len %d" |
|
210 | 211 |
disable scsi_req_dequeue(int target, int lun, int tag) "target %d lun %d tag %d" |
211 | 212 |
disable scsi_req_parsed(int target, int lun, int tag, int cmd, int mode, int xfer, uint64_t lba) "target %d lun %d tag %d command %d dir %d length %d lba %"PRIu64"" |
212 | 213 |
disable scsi_req_parse_bad(int target, int lun, int tag, int cmd) "target %d lun %d tag %d command %d" |
Also available in: Unified diff