Revision fc4f0754

b/hw/esp.c
245 245
    DPRINTF("do_busid_cmd: busid 0x%x\n", busid);
246 246
    lun = busid & 7;
247 247
    s->current_req = s->current_dev->info->alloc_req(s->current_dev, 0, lun);
248
    datalen = s->current_dev->info->send_command(s->current_req, buf);
248
    datalen = scsi_req_enqueue(s->current_req, buf);
249 249
    s->ti_size = datalen;
250 250
    if (datalen != 0) {
251 251
        s->rregs[ESP_RSTAT] = STAT_TC;
b/hw/lsi53c895a.c
791 791
    s->current->req = dev->info->alloc_req(dev, s->current->tag,
792 792
                                           s->current_lun);
793 793

  
794
    n = dev->info->send_command(s->current->req, buf);
794
    n = scsi_req_enqueue(s->current->req, buf);
795 795
    if (n > 0) {
796 796
        lsi_set_phase(s, PHASE_DI);
797 797
        dev->info->read_data(s->current->req);
b/hw/scsi-bus.c
146 146
    return req;
147 147
}
148 148

  
149
void scsi_req_enqueue(SCSIRequest *req)
149
int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf)
150 150
{
151
    int32_t rc;
152

  
151 153
    assert(!req->enqueued);
152 154
    scsi_req_ref(req);
153 155
    req->enqueued = true;
154 156
    QTAILQ_INSERT_TAIL(&req->dev->requests, req, next);
157

  
158
    scsi_req_ref(req);
159
    rc = req->dev->info->send_command(req, buf);
160
    scsi_req_unref(req);
161
    return rc;
155 162
}
156 163

  
157 164
static void scsi_req_dequeue(SCSIRequest *req)
b/hw/scsi-disk.c
984 984
    uint8_t *outbuf;
985 985
    int rc;
986 986

  
987
    scsi_req_enqueue(req);
988 987
    command = buf[0];
989 988
    outbuf = (uint8_t *)r->iov.iov_base;
990 989
    is_write = 0;
b/hw/scsi-generic.c
320 320
    SCSIGenericReq *r = DO_UPCAST(SCSIGenericReq, req, req);
321 321
    int ret;
322 322

  
323
    scsi_req_enqueue(req);
324 323
    if (cmd[0] != REQUEST_SENSE &&
325 324
        (req->lun != s->lun || (cmd[1] >> 5) != s->lun)) {
326 325
        DPRINTF("Unimplemented LUN %d\n", req->lun ? req->lun : cmd[1] >> 5);
b/hw/scsi.h
143 143
int scsi_sense_valid(SCSISense sense);
144 144

  
145 145
SCSIRequest *scsi_req_alloc(size_t size, SCSIDevice *d, uint32_t tag, uint32_t lun);
146
void scsi_req_enqueue(SCSIRequest *req);
146
int32_t scsi_req_enqueue(SCSIRequest *req, uint8_t *buf);
147 147
void scsi_req_free(SCSIRequest *req);
148 148
SCSIRequest *scsi_req_ref(SCSIRequest *req);
149 149
void scsi_req_unref(SCSIRequest *req);
b/hw/spapr_vscsi.c
459 459
    cdb[4] = 96;
460 460
    cdb[5] = 0;
461 461
    req->sensing = 1;
462
    n = sdev->info->send_command(req->sreq, cdb);
462
    n = scsi_req_enqueue(req->sreq, cdb);
463 463
    dprintf("VSCSI: Queued request sense tag 0x%x\n", req->qtag);
464 464
    if (n < 0) {
465 465
        fprintf(stderr, "VSCSI: REQUEST_SENSE wants write data !?!?!?\n");
......
654 654
    req->sdev = sdev;
655 655
    req->lun = lun;
656 656
    req->sreq = sdev->info->alloc_req(sdev, req->qtag, lun);
657
    n = sdev->info->send_command(req->sreq, srp->cmd.cdb);
657
    n = scsi_req_enqueue(req->sreq, srp->cmd.cdb);
658 658

  
659 659
    dprintf("VSCSI: Queued command tag 0x%x CMD 0x%x ID %d LUN %d ret: %d\n",
660 660
            req->qtag, srp->cmd.cdb[0], id, lun, n);
b/hw/usb-msd.c
378 378
            s->residue = 0;
379 379
            s->scsi_len = 0;
380 380
            s->req = s->scsi_dev->info->alloc_req(s->scsi_dev, s->tag, 0);
381
            s->scsi_dev->info->send_command(s->req, cbw.cmd);
381
            scsi_req_enqueue(s->req, cbw.cmd);
382 382
            /* ??? Should check that USB and SCSI data transfer
383 383
               directions match.  */
384 384
            if (s->residue == 0) {

Also available in: Unified diff