Lines Matching refs:srb

97 	struct scsi_cmd	*srb;			/* current srb */  member
533 static int usb_stor_BBB_comdat(struct scsi_cmd *srb, struct us_data *us) in usb_stor_BBB_comdat() argument
541 dir_in = US_DIRECTION(srb->cmd[0]); in usb_stor_BBB_comdat()
545 dir_in, srb->lun, srb->cmdlen, srb->cmd, srb->datalen, in usb_stor_BBB_comdat()
546 srb->pdata); in usb_stor_BBB_comdat()
547 if (srb->cmdlen) { in usb_stor_BBB_comdat()
548 for (result = 0; result < srb->cmdlen; result++) in usb_stor_BBB_comdat()
549 printf("cmd[%d] %#x ", result, srb->cmd[result]); in usb_stor_BBB_comdat()
554 if (!(srb->cmdlen <= CBWCDBLENGTH)) { in usb_stor_BBB_comdat()
564 cbw->dCBWDataTransferLength = cpu_to_le32(srb->datalen); in usb_stor_BBB_comdat()
566 cbw->bCBWLUN = srb->lun; in usb_stor_BBB_comdat()
567 cbw->bCDBLength = srb->cmdlen; in usb_stor_BBB_comdat()
571 memcpy(cbw->CBWCDB, srb->cmd, srb->cmdlen); in usb_stor_BBB_comdat()
582 static int usb_stor_CB_comdat(struct scsi_cmd *srb, struct us_data *us) in usb_stor_CB_comdat() argument
590 dir_in = US_DIRECTION(srb->cmd[0]); in usb_stor_CB_comdat()
600 usb_show_srb(srb); in usb_stor_CB_comdat()
608 srb->cmd, srb->cmdlen, in usb_stor_CB_comdat()
623 " Stat = %lX\n", srb->cmd[0], in usb_stor_CB_comdat()
631 dir_in ? "IN" : "OUT", srb->datalen); in usb_stor_CB_comdat()
632 if (srb->datalen) { in usb_stor_CB_comdat()
633 result = us_one_transfer(us, pipe, (char *)srb->pdata, in usb_stor_CB_comdat()
634 srb->datalen); in usb_stor_CB_comdat()
651 static int usb_stor_CBI_get_status(struct scsi_cmd *srb, struct us_data *us) in usb_stor_CBI_get_status() argument
674 if (srb->cmd[0] == SCSI_REQ_SENSE || in usb_stor_CBI_get_status()
675 srb->cmd[0] == SCSI_INQUIRY) in usb_stor_CBI_get_status()
706 static int usb_stor_BBB_transport(struct scsi_cmd *srb, struct us_data *us) in usb_stor_BBB_transport() argument
718 dir_in = US_DIRECTION(srb->cmd[0]); in usb_stor_BBB_transport()
722 result = usb_stor_BBB_comdat(srb, us); in usb_stor_BBB_transport()
736 if (srb->datalen == 0) in usb_stor_BBB_transport()
744 result = usb_bulk_msg(us->pusb_dev, pipe, srb->pdata, srb->datalen, in usb_stor_BBB_transport()
764 printf("pdata[%d] %#x ", index, srb->pdata[index]); in usb_stor_BBB_transport()
799 if (pipe == 0 && srb->datalen != 0 && srb->datalen - data_actlen != 0) in usb_stor_BBB_transport()
800 pipe = srb->datalen - data_actlen; in usb_stor_BBB_transport()
817 } else if (data_actlen > srb->datalen) { in usb_stor_BBB_transport()
819 data_actlen, srb->datalen); in usb_stor_BBB_transport()
829 static int usb_stor_CB_transport(struct scsi_cmd *srb, struct us_data *us) in usb_stor_CB_transport() argument
842 result = usb_stor_CB_comdat(srb, us); in usb_stor_CB_transport()
847 status = usb_stor_CBI_get_status(srb, us); in usb_stor_CB_transport()
853 srb->sense_buf[12] = (unsigned char)(us->ip_data >> 8); in usb_stor_CB_transport()
854 srb->sense_buf[13] = (unsigned char)(us->ip_data & 0xff); in usb_stor_CB_transport()
871 ((srb->cmd[0] == SCSI_REQ_SENSE) || in usb_stor_CB_transport()
872 (srb->cmd[0] == SCSI_INQUIRY))) { in usb_stor_CB_transport()
880 psrb->cmd[1] = srb->lun << 5; in usb_stor_CB_transport()
883 psrb->pdata = &srb->sense_buf[0]; in usb_stor_CB_transport()
898 srb->sense_buf[0], srb->sense_buf[2], in usb_stor_CB_transport()
899 srb->sense_buf[12], srb->sense_buf[13]); in usb_stor_CB_transport()
901 if ((srb->sense_buf[2] == 0) && in usb_stor_CB_transport()
902 (srb->sense_buf[12] == 0) && in usb_stor_CB_transport()
903 (srb->sense_buf[13] == 0)) { in usb_stor_CB_transport()
909 switch (srb->sense_buf[2]) { in usb_stor_CB_transport()
918 " 0x%02X (NOT READY)\n", srb->cmd[0], in usb_stor_CB_transport()
919 srb->sense_buf[0], srb->sense_buf[2], in usb_stor_CB_transport()
920 srb->sense_buf[12], srb->sense_buf[13]); in usb_stor_CB_transport()
930 " 0x%02X\n", srb->cmd[0], srb->sense_buf[0], in usb_stor_CB_transport()
931 srb->sense_buf[2], srb->sense_buf[12], in usb_stor_CB_transport()
932 srb->sense_buf[13]); in usb_stor_CB_transport()
974 static int usb_inquiry(struct scsi_cmd *srb, struct us_data *ss) in usb_inquiry() argument
979 memset(&srb->cmd[0], 0, 12); in usb_inquiry()
980 srb->cmd[0] = SCSI_INQUIRY; in usb_inquiry()
981 srb->cmd[1] = srb->lun << 5; in usb_inquiry()
982 srb->cmd[4] = 36; in usb_inquiry()
983 srb->datalen = 36; in usb_inquiry()
984 srb->cmdlen = 12; in usb_inquiry()
985 i = ss->transport(srb, ss); in usb_inquiry()
998 static int usb_request_sense(struct scsi_cmd *srb, struct us_data *ss) in usb_request_sense() argument
1002 ptr = (char *)srb->pdata; in usb_request_sense()
1003 memset(&srb->cmd[0], 0, 12); in usb_request_sense()
1004 srb->cmd[0] = SCSI_REQ_SENSE; in usb_request_sense()
1005 srb->cmd[1] = srb->lun << 5; in usb_request_sense()
1006 srb->cmd[4] = 18; in usb_request_sense()
1007 srb->datalen = 18; in usb_request_sense()
1008 srb->pdata = &srb->sense_buf[0]; in usb_request_sense()
1009 srb->cmdlen = 12; in usb_request_sense()
1010 ss->transport(srb, ss); in usb_request_sense()
1012 srb->sense_buf[2], srb->sense_buf[12], in usb_request_sense()
1013 srb->sense_buf[13]); in usb_request_sense()
1014 srb->pdata = (uchar *)ptr; in usb_request_sense()
1018 static int usb_test_unit_ready(struct scsi_cmd *srb, struct us_data *ss) in usb_test_unit_ready() argument
1023 memset(&srb->cmd[0], 0, 12); in usb_test_unit_ready()
1024 srb->cmd[0] = SCSI_TST_U_RDY; in usb_test_unit_ready()
1025 srb->cmd[1] = srb->lun << 5; in usb_test_unit_ready()
1026 srb->datalen = 0; in usb_test_unit_ready()
1027 srb->cmdlen = 12; in usb_test_unit_ready()
1028 if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) { in usb_test_unit_ready()
1032 usb_request_sense(srb, ss); in usb_test_unit_ready()
1040 if ((srb->sense_buf[2] == 0x02) && in usb_test_unit_ready()
1041 (srb->sense_buf[12] == 0x3a)) in usb_test_unit_ready()
1049 static int usb_read_capacity(struct scsi_cmd *srb, struct us_data *ss) in usb_read_capacity() argument
1055 memset(&srb->cmd[0], 0, 12); in usb_read_capacity()
1056 srb->cmd[0] = SCSI_RD_CAPAC; in usb_read_capacity()
1057 srb->cmd[1] = srb->lun << 5; in usb_read_capacity()
1058 srb->datalen = 8; in usb_read_capacity()
1059 srb->cmdlen = 12; in usb_read_capacity()
1060 if (ss->transport(srb, ss) == USB_STOR_TRANSPORT_GOOD) in usb_read_capacity()
1067 static int usb_read_10(struct scsi_cmd *srb, struct us_data *ss, in usb_read_10() argument
1070 memset(&srb->cmd[0], 0, 12); in usb_read_10()
1071 srb->cmd[0] = SCSI_READ10; in usb_read_10()
1072 srb->cmd[1] = srb->lun << 5; in usb_read_10()
1073 srb->cmd[2] = ((unsigned char) (start >> 24)) & 0xff; in usb_read_10()
1074 srb->cmd[3] = ((unsigned char) (start >> 16)) & 0xff; in usb_read_10()
1075 srb->cmd[4] = ((unsigned char) (start >> 8)) & 0xff; in usb_read_10()
1076 srb->cmd[5] = ((unsigned char) (start)) & 0xff; in usb_read_10()
1077 srb->cmd[7] = ((unsigned char) (blocks >> 8)) & 0xff; in usb_read_10()
1078 srb->cmd[8] = (unsigned char) blocks & 0xff; in usb_read_10()
1079 srb->cmdlen = 12; in usb_read_10()
1081 return ss->transport(srb, ss); in usb_read_10()
1084 static int usb_write_10(struct scsi_cmd *srb, struct us_data *ss, in usb_write_10() argument
1087 memset(&srb->cmd[0], 0, 12); in usb_write_10()
1088 srb->cmd[0] = SCSI_WRITE10; in usb_write_10()
1089 srb->cmd[1] = srb->lun << 5; in usb_write_10()
1090 srb->cmd[2] = ((unsigned char) (start >> 24)) & 0xff; in usb_write_10()
1091 srb->cmd[3] = ((unsigned char) (start >> 16)) & 0xff; in usb_write_10()
1092 srb->cmd[4] = ((unsigned char) (start >> 8)) & 0xff; in usb_write_10()
1093 srb->cmd[5] = ((unsigned char) (start)) & 0xff; in usb_write_10()
1094 srb->cmd[7] = ((unsigned char) (blocks >> 8)) & 0xff; in usb_write_10()
1095 srb->cmd[8] = (unsigned char) blocks & 0xff; in usb_write_10()
1096 srb->cmdlen = 12; in usb_write_10()
1098 return ss->transport(srb, ss); in usb_write_10()
1139 struct scsi_cmd *srb = &usb_ccb; in usb_stor_read() local
1162 srb->lun = block_dev->lun; in usb_stor_read()
1173 srb->pdata = (unsigned char *)buf_addr; in usb_stor_read()
1181 srb->datalen = block_dev->blksz * smallblks; in usb_stor_read()
1182 srb->pdata = (unsigned char *)buf_addr; in usb_stor_read()
1183 if (usb_read_10(srb, ss, start, smallblks)) { in usb_stor_read()
1185 usb_request_sense(srb, ss); in usb_stor_read()
1193 buf_addr += srb->datalen; in usb_stor_read()
1221 struct scsi_cmd *srb = &usb_ccb; in usb_stor_write() local
1246 srb->lun = block_dev->lun; in usb_stor_write()
1259 srb->pdata = (unsigned char *)buf_addr; in usb_stor_write()
1267 srb->datalen = block_dev->blksz * smallblks; in usb_stor_write()
1268 srb->pdata = (unsigned char *)buf_addr; in usb_stor_write()
1269 if (usb_write_10(srb, ss, start, smallblks)) { in usb_stor_write()
1271 usb_request_sense(srb, ss); in usb_stor_write()
1279 buf_addr += srb->datalen; in usb_stor_write()