Revision ad3376cc hw/esp.c

b/hw/esp.c
253 253
        s->dma_counter = 0;
254 254
        if (datalen > 0) {
255 255
            s->rregs[ESP_RSTAT] |= STAT_DI;
256
            s->current_dev->info->read_data(s->current_req);
257 256
        } else {
258 257
            s->rregs[ESP_RSTAT] |= STAT_DO;
259
            s->current_dev->info->write_data(s->current_req);
260 258
        }
259
        scsi_req_continue(s->current_req);
261 260
    }
262 261
    s->rregs[ESP_RINTR] = INTR_BS | INTR_FC;
263 262
    s->rregs[ESP_RSEQ] = SEQ_CD;
......
383 382
    else
384 383
        s->ti_size -= len;
385 384
    if (s->async_len == 0) {
386
        if (to_device) {
387
            // ti_size is negative
388
            s->current_dev->info->write_data(s->current_req);
389
        } else {
390
            s->current_dev->info->read_data(s->current_req);
391
            /* If there is still data to be read from the device then
392
               complete the DMA operation immediately.  Otherwise defer
393
               until the scsi layer has completed.  */
394
            if (s->dma_left == 0 && s->ti_size > 0) {
395
                esp_dma_done(s);
396
            }
385
        scsi_req_continue(s->current_req);
386
        /* If there is still data to be read from the device then
387
           complete the DMA operation immediately.  Otherwise defer
388
           until the scsi layer has completed.  */
389
        if (to_device || s->dma_left != 0 || s->ti_size == 0) {
390
            return;
397 391
        }
398
    } else {
399
        /* Partially filled a scsi buffer. Complete immediately.  */
400
        esp_dma_done(s);
401 392
    }
393

  
394
    /* Partially filled a scsi buffer. Complete immediately.  */
395
    esp_dma_done(s);
402 396
}
403 397

  
404 398
static void esp_command_complete(SCSIRequest *req, int reason, uint32_t arg)

Also available in: Unified diff