Revision c6df7102 hw/esp.c

b/hw/esp.c
395 395
    esp_dma_done(s);
396 396
}
397 397

  
398
static void esp_command_complete(SCSIRequest *req, int reason, uint32_t arg)
398
static void esp_command_complete(SCSIRequest *req, uint32_t arg)
399 399
{
400 400
    ESPState *s = DO_UPCAST(ESPState, busdev.qdev, req->bus->qbus.parent);
401 401

  
402
    if (reason == SCSI_REASON_DONE) {
403
        DPRINTF("SCSI Command complete\n");
404
        if (s->ti_size != 0)
405
            DPRINTF("SCSI command completed unexpectedly\n");
406
        s->ti_size = 0;
407
        s->dma_left = 0;
408
        s->async_len = 0;
409
        if (arg)
410
            DPRINTF("Command failed\n");
411
        s->status = arg;
412
        s->rregs[ESP_RSTAT] = STAT_ST;
402
    DPRINTF("SCSI Command complete\n");
403
    if (s->ti_size != 0) {
404
        DPRINTF("SCSI command completed unexpectedly\n");
405
    }
406
    s->ti_size = 0;
407
    s->dma_left = 0;
408
    s->async_len = 0;
409
    if (arg) {
410
        DPRINTF("Command failed\n");
411
    }
412
    s->status = arg;
413
    s->rregs[ESP_RSTAT] = STAT_ST;
414
    esp_dma_done(s);
415
    if (s->current_req) {
416
        scsi_req_unref(s->current_req);
417
        s->current_req = NULL;
418
        s->current_dev = NULL;
419
    }
420
}
421

  
422
static void esp_transfer_data(SCSIRequest *req, uint32_t arg)
423
{
424
    ESPState *s = DO_UPCAST(ESPState, busdev.qdev, req->bus->qbus.parent);
425

  
426
    DPRINTF("transfer %d/%d\n", s->dma_left, s->ti_size);
427
    s->async_len = arg;
428
    s->async_buf = scsi_req_get_buf(req);
429
    if (s->dma_left) {
430
        esp_do_dma(s);
431
    } else if (s->dma_counter != 0 && s->ti_size <= 0) {
432
        /* If this was the last part of a DMA transfer then the
433
           completion interrupt is deferred to here.  */
413 434
        esp_dma_done(s);
414
        if (s->current_req) {
415
            scsi_req_unref(s->current_req);
416
            s->current_req = NULL;
417
            s->current_dev = NULL;
418
        }
419
    } else {
420
        DPRINTF("transfer %d/%d\n", s->dma_left, s->ti_size);
421
        s->async_len = arg;
422
        s->async_buf = scsi_req_get_buf(req);
423
        if (s->dma_left) {
424
            esp_do_dma(s);
425
        } else if (s->dma_counter != 0 && s->ti_size <= 0) {
426
            /* If this was the last part of a DMA transfer then the
427
               completion interrupt is deferred to here.  */
428
            esp_dma_done(s);
429
        }
430 435
    }
431 436
}
432 437

  
......
725 730
}
726 731

  
727 732
static const struct SCSIBusOps esp_scsi_ops = {
733
    .transfer_data = esp_transfer_data,
728 734
    .complete = esp_command_complete,
729 735
    .cancel = esp_request_cancelled
730 736
};

Also available in: Unified diff