Revision c6df7102 hw/lsi53c895a.c

b/hw/lsi53c895a.c
711 711
        return 1;
712 712
    }
713 713
}
714
 /* Callback to indicate that the SCSI layer has completed a transfer.  */
715
static void lsi_command_complete(SCSIRequest *req, int reason, uint32_t arg)
714

  
715
 /* Callback to indicate that the SCSI layer has completed a command.  */
716
static void lsi_command_complete(SCSIRequest *req, uint32_t arg)
716 717
{
717 718
    LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
718 719
    int out;
719 720

  
720 721
    out = (s->sstat1 & PHASE_MASK) == PHASE_DO;
721
    if (reason == SCSI_REASON_DONE) {
722
        DPRINTF("Command complete status=%d\n", (int)arg);
723
        s->status = arg;
724
        s->command_complete = 2;
725
        if (s->waiting && s->dbc != 0) {
726
            /* Raise phase mismatch for short transfers.  */
727
            lsi_bad_phase(s, out, PHASE_ST);
728
        } else {
729
            lsi_set_phase(s, PHASE_ST);
730
        }
722
    DPRINTF("Command complete status=%d\n", (int)arg);
723
    s->status = arg;
724
    s->command_complete = 2;
725
    if (s->waiting && s->dbc != 0) {
726
        /* Raise phase mismatch for short transfers.  */
727
        lsi_bad_phase(s, out, PHASE_ST);
728
    } else {
729
        lsi_set_phase(s, PHASE_ST);
730
    }
731 731

  
732
        if (s->current && req == s->current->req) {
733
            scsi_req_unref(s->current->req);
734
            qemu_free(s->current);
735
            s->current = NULL;
736
        }
737
        lsi_resume_script(s);
738
        return;
732
    if (s->current && req == s->current->req) {
733
        scsi_req_unref(s->current->req);
734
        qemu_free(s->current);
735
        s->current = NULL;
739 736
    }
737
    lsi_resume_script(s);
738
}
739

  
740
 /* Callback to indicate that the SCSI layer has completed a transfer.  */
741
static void lsi_transfer_data(SCSIRequest *req, uint32_t arg)
742
{
743
    LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
744
    int out;
740 745

  
741 746
    if (s->waiting == 1 || !s->current || req->tag != s->current->tag ||
742 747
        (lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON))) {
......
745 750
        }
746 751
    }
747 752

  
753
    out = (s->sstat1 & PHASE_MASK) == PHASE_DO;
754

  
748 755
    /* host adapter (re)connected */
749 756
    DPRINTF("Data ready tag=0x%x len=%d\n", req->tag, arg);
750 757
    s->current->dma_len = arg;
751 758
    s->command_complete = 1;
752
    if (!s->waiting)
753
        return;
754
    if (s->waiting == 1 || s->dbc == 0) {
755
        lsi_resume_script(s);
756
    } else {
757
        lsi_do_dma(s, out);
759
    if (s->waiting) {
760
        if (s->waiting == 1 || s->dbc == 0) {
761
            lsi_resume_script(s);
762
        } else {
763
            lsi_do_dma(s, out);
764
        }
758 765
    }
759 766
}
760 767

  
......
2239 2246
}
2240 2247

  
2241 2248
static const struct SCSIBusOps lsi_scsi_ops = {
2249
    .transfer_data = lsi_transfer_data,
2242 2250
    .complete = lsi_command_complete,
2243 2251
    .cancel = lsi_request_cancelled
2244 2252
};

Also available in: Unified diff