Revision c5bf71a9 hw/lsi53c895a.c

b/hw/lsi53c895a.c
661 661
static void lsi_request_cancelled(SCSIRequest *req)
662 662
{
663 663
    LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
664
    lsi_request *p;
664
    lsi_request *p = req->hba_private;
665 665

  
666 666
    if (s->current && req == s->current->req) {
667 667
        scsi_req_unref(req);
......
670 670
        return;
671 671
    }
672 672

  
673
    p = lsi_find_by_tag(s, req->tag);
674 673
    if (p) {
675 674
        QTAILQ_REMOVE(&s->queue, p, next);
676 675
        scsi_req_unref(req);
......
680 679

  
681 680
/* Record that data is available for a queued command.  Returns zero if
682 681
   the device was reselected, nonzero if the IO is deferred.  */
683
static int lsi_queue_tag(LSIState *s, uint32_t tag, uint32_t len)
682
static int lsi_queue_req(LSIState *s, SCSIRequest *req, uint32_t len)
684 683
{
685
    lsi_request *p;
686

  
687
    p = lsi_find_by_tag(s, tag);
688
    if (!p) {
689
        BADF("IO with unknown tag %d\n", tag);
690
        return 1;
691
    }
684
    lsi_request *p = req->hba_private;
692 685

  
693 686
    if (p->pending) {
694
        BADF("Multiple IO pending for tag %d\n", tag);
687
        BADF("Multiple IO pending for request %p\n", p);
695 688
    }
696 689
    p->pending = len;
697 690
    /* Reselect if waiting for it, or if reselection triggers an IRQ
......
743 736
    LSIState *s = DO_UPCAST(LSIState, dev.qdev, req->bus->qbus.parent);
744 737
    int out;
745 738

  
746
    if (s->waiting == 1 || !s->current || req->tag != s->current->tag ||
739
    if (s->waiting == 1 || !s->current || req->hba_private != s->current ||
747 740
        (lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON))) {
748
        if (lsi_queue_tag(s, req->tag, len)) {
741
        if (lsi_queue_req(s, req, len)) {
749 742
            return;
750 743
        }
751 744
    }
......
789 782
    assert(s->current == NULL);
790 783
    s->current = qemu_mallocz(sizeof(lsi_request));
791 784
    s->current->tag = s->select_tag;
792
    s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun);
785
    s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun,
786
                                   s->current);
793 787

  
794 788
    n = scsi_req_enqueue(s->current->req, buf);
795 789
    if (n) {

Also available in: Unified diff