Revision 508240c0 hw/lsi53c895a.c
b/hw/lsi53c895a.c | ||
---|---|---|
853 | 853 |
{ |
854 | 854 |
uint8_t msg; |
855 | 855 |
int len; |
856 |
uint32_t current_tag; |
|
857 |
SCSIDevice *current_dev; |
|
858 |
lsi_request *p, *p_next; |
|
859 |
int id; |
|
860 |
|
|
861 |
if (s->current) { |
|
862 |
current_tag = s->current->tag; |
|
863 |
} else { |
|
864 |
current_tag = s->select_tag; |
|
865 |
} |
|
866 |
id = (current_tag >> 8) & 0xf; |
|
867 |
current_dev = s->bus.devs[id]; |
|
856 | 868 |
|
857 | 869 |
DPRINTF("MSG out len=%d\n", s->dbc); |
858 | 870 |
while (s->dbc) { |
... | ... | |
898 | 910 |
BADF("ORDERED queue not implemented\n"); |
899 | 911 |
s->select_tag |= lsi_get_msgbyte(s) | LSI_TAG_VALID; |
900 | 912 |
break; |
913 |
case 0x0d: |
|
914 |
/* The ABORT TAG message clears the current I/O process only. */ |
|
915 |
DPRINTF("MSG: ABORT TAG tag=0x%x\n", current_tag); |
|
916 |
current_dev->info->cancel_io(current_dev, current_tag); |
|
917 |
lsi_disconnect(s); |
|
918 |
break; |
|
919 |
case 0x06: |
|
920 |
case 0x0e: |
|
921 |
case 0x0c: |
|
922 |
/* The ABORT message clears all I/O processes for the selecting |
|
923 |
initiator on the specified logical unit of the target. */ |
|
924 |
if (msg == 0x06) { |
|
925 |
DPRINTF("MSG: ABORT tag=0x%x\n", current_tag); |
|
926 |
} |
|
927 |
/* The CLEAR QUEUE message clears all I/O processes for all |
|
928 |
initiators on the specified logical unit of the target. */ |
|
929 |
if (msg == 0x0e) { |
|
930 |
DPRINTF("MSG: CLEAR QUEUE tag=0x%x\n", current_tag); |
|
931 |
} |
|
932 |
/* The BUS DEVICE RESET message clears all I/O processes for all |
|
933 |
initiators on all logical units of the target. */ |
|
934 |
if (msg == 0x0c) { |
|
935 |
DPRINTF("MSG: BUS DEVICE RESET tag=0x%x\n", current_tag); |
|
936 |
} |
|
937 |
|
|
938 |
/* clear the current I/O process */ |
|
939 |
current_dev->info->cancel_io(current_dev, current_tag); |
|
940 |
|
|
941 |
/* As the current implemented devices scsi_disk and scsi_generic |
|
942 |
only support one LUN, we don't need to keep track of LUNs. |
|
943 |
Clearing I/O processes for other initiators could be possible |
|
944 |
for scsi_generic by sending a SG_SCSI_RESET to the /dev/sgX |
|
945 |
device, but this is currently not implemented (and seems not |
|
946 |
to be really necessary). So let's simply clear all queued |
|
947 |
commands for the current device: */ |
|
948 |
id = current_tag & 0x0000ff00; |
|
949 |
QTAILQ_FOREACH_SAFE(p, &s->queue, next, p_next) { |
|
950 |
if ((p->tag & 0x0000ff00) == id) { |
|
951 |
current_dev->info->cancel_io(current_dev, p->tag); |
|
952 |
QTAILQ_REMOVE(&s->queue, p, next); |
|
953 |
} |
|
954 |
} |
|
955 |
|
|
956 |
lsi_disconnect(s); |
|
957 |
break; |
|
901 | 958 |
default: |
902 | 959 |
if ((msg & 0x80) == 0) { |
903 | 960 |
goto bad; |
Also available in: Unified diff