Lines Matching +full:0 +full:us
58 static int isd200_Initialization(struct us_data *us);
106 #define DF_ATA_DEVICE 0x0001
107 #define DF_MEDIA_STATUS_ENABLED 0x0002
108 #define DF_REMOVABLE_MEDIA 0x0004
111 #define CAPABILITY_DMA 0x01
112 #define CAPABILITY_LBA 0x02
115 #define COMMANDSET_REMOVABLE 0x02
116 #define COMMANDSET_MEDIA_STATUS 0x10
119 #define ATA_ADDRESS_DEVHEAD_STD 0xa0
120 #define ATA_ADDRESS_DEVHEAD_LBA_MODE 0x40
121 #define ATA_ADDRESS_DEVHEAD_SLAVE 0x10
124 #define ACTION_SELECT_0 0x01
125 #define ACTION_SELECT_1 0x02
126 #define ACTION_SELECT_2 0x04
127 #define ACTION_SELECT_3 0x08
128 #define ACTION_SELECT_4 0x10
129 #define ACTION_SELECT_5 0x20
130 #define ACTION_SELECT_6 0x40
131 #define ACTION_SELECT_7 0x80
134 #define REG_ALTERNATE_STATUS 0x01
135 #define REG_DEVICE_CONTROL 0x01
136 #define REG_ERROR 0x02
137 #define REG_FEATURES 0x02
138 #define REG_SECTOR_COUNT 0x04
139 #define REG_SECTOR_NUMBER 0x08
140 #define REG_CYLINDER_LOW 0x10
141 #define REG_CYLINDER_HIGH 0x20
142 #define REG_DEVICE_HEAD 0x40
143 #define REG_STATUS 0x80
144 #define REG_COMMAND 0x80
153 #define ATA_ERROR_MEDIA_CHANGE 0x20
156 #define ATA_COMMAND_GET_MEDIA_STATUS 0xDA
157 #define ATA_COMMAND_MEDIA_EJECT 0xED
160 #define ATA_DC_DISABLE_INTERRUPTS 0x02
161 #define ATA_DC_RESET_CONTROLLER 0x04
162 #define ATA_DC_REENABLE_CONTROLLER 0x00
169 #define ISD200_GOOD 0
175 #define ISD200_TRANSPORT_GOOD 0 /* Transport good, command good */
180 #define ACTION_READ_STATUS 0
259 #define DIRECT_ACCESS_DEVICE 0x00 /* disks */
260 #define DEVICE_REMOVABLE 0x80
288 #define ATACFG_TIMING 0x0f
289 #define ATACFG_ATAPI_RESET 0x10
290 #define ATACFG_MASTER 0x20
291 #define ATACFG_BLOCKSIZE 0xa0
293 #define ATACFGE_LAST_LUN 0x07
294 #define ATACFGE_DESC_OVERRIDE 0x08
295 #define ATACFGE_STATE_SUSPEND 0x10
296 #define ATACFGE_SKIP_BOOT 0x20
297 #define ATACFGE_CONF_DESC2 0x40
298 #define ATACFGE_INIT_STATUS 0x80
300 #define CFG_CAPABILITY_SRST 0x01
361 #define SENSE_ERRCODE 0x7f
362 #define SENSE_ERRCODE_VALID 0x80
363 #define SENSE_FLAG_SENSE_KEY 0x0f
364 #define SENSE_FLAG_BAD_LENGTH 0x20
365 #define SENSE_FLAG_END_OF_MEDIA 0x40
366 #define SENSE_FLAG_FILE_MARK 0x80
399 static void isd200_build_sense(struct us_data *us, struct scsi_cmnd *srb) in isd200_build_sense() argument
401 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_build_sense()
402 struct sense_data *buf = (struct sense_data *) &srb->sense_buffer[0]; in isd200_build_sense()
406 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; in isd200_build_sense()
407 buf->AdditionalSenseLength = 0xb; in isd200_build_sense()
409 buf->AdditionalSenseCode = 0; in isd200_build_sense()
410 buf->AdditionalSenseCodeQualifier = 0; in isd200_build_sense()
412 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; in isd200_build_sense()
413 buf->AdditionalSenseLength = 0xb; in isd200_build_sense()
415 buf->AdditionalSenseCode = 0; in isd200_build_sense()
416 buf->AdditionalSenseCodeQualifier = 0; in isd200_build_sense()
418 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; in isd200_build_sense()
419 buf->AdditionalSenseLength = 0xb; in isd200_build_sense()
421 buf->AdditionalSenseCode = 0; in isd200_build_sense()
422 buf->AdditionalSenseCodeQualifier = 0; in isd200_build_sense()
424 buf->ErrorCode = 0x70 | SENSE_ERRCODE_VALID; in isd200_build_sense()
425 buf->AdditionalSenseLength = 0xb; in isd200_build_sense()
427 buf->AdditionalSenseCode = 0; in isd200_build_sense()
428 buf->AdditionalSenseCodeQualifier = 0; in isd200_build_sense()
430 buf->ErrorCode = 0; in isd200_build_sense()
431 buf->AdditionalSenseLength = 0; in isd200_build_sense()
432 buf->Flags = 0; in isd200_build_sense()
433 buf->AdditionalSenseCode = 0; in isd200_build_sense()
434 buf->AdditionalSenseCodeQualifier = 0; in isd200_build_sense()
460 srb->sdb.table.nents = buff ? 1 : 0; in isd200_set_srb()
477 static int isd200_action( struct us_data *us, int action, in isd200_action() argument
483 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_action()
487 memset(&ata, 0, sizeof(ata)); in isd200_action()
497 usb_stor_dbg(us, " isd200_action(READ_STATUS)\n"); in isd200_action()
506 usb_stor_dbg(us, " isd200_action(ENUM,0x%02x)\n", value); in isd200_action()
512 isd200_set_srb(info, DMA_NONE, NULL, 0); in isd200_action()
516 usb_stor_dbg(us, " isd200_action(RESET)\n"); in isd200_action()
521 isd200_set_srb(info, DMA_NONE, NULL, 0); in isd200_action()
525 usb_stor_dbg(us, " isd200_action(REENABLE)\n"); in isd200_action()
530 isd200_set_srb(info, DMA_NONE, NULL, 0); in isd200_action()
534 usb_stor_dbg(us, " isd200_action(SOFT_RESET)\n"); in isd200_action()
539 isd200_set_srb(info, DMA_NONE, NULL, 0); in isd200_action()
543 usb_stor_dbg(us, " isd200_action(IDENTIFY)\n"); in isd200_action()
551 usb_stor_dbg(us, "Error: Undefined action %d\n", action); in isd200_action()
557 status = usb_stor_Bulk_transport(srb, us); in isd200_action()
561 usb_stor_dbg(us, " isd200_action(0x%02x) error: %d\n", in isd200_action()
578 static int isd200_read_regs( struct us_data *us ) in isd200_read_regs() argument
580 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_read_regs()
584 usb_stor_dbg(us, "Entering isd200_IssueATAReadRegs\n"); in isd200_read_regs()
586 transferStatus = isd200_action( us, ACTION_READ_STATUS, in isd200_read_regs()
589 usb_stor_dbg(us, " Error reading ATA registers\n"); in isd200_read_regs()
593 usb_stor_dbg(us, " Got ATA Register[ATA_REG_ERROR_OFFSET] = 0x%x\n", in isd200_read_regs()
607 static void isd200_invoke_transport( struct us_data *us, in isd200_invoke_transport() argument
611 int need_auto_sense = 0; in isd200_invoke_transport()
618 transferStatus = usb_stor_Bulk_transport(srb, us); in isd200_invoke_transport()
624 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { in isd200_invoke_transport()
625 usb_stor_dbg(us, "-- command was aborted\n"); in isd200_invoke_transport()
637 usb_stor_dbg(us, "-- transport indicates protocol failure\n"); in isd200_invoke_transport()
642 usb_stor_dbg(us, "-- transport indicates command failure\n"); in isd200_invoke_transport()
647 usb_stor_dbg(us, "-- transport indicates transport error\n"); in isd200_invoke_transport()
653 usb_stor_dbg(us, "-- transport indicates unknown error\n"); in isd200_invoke_transport()
659 if ((scsi_get_resid(srb) > 0) && in isd200_invoke_transport()
660 !((srb->cmnd[0] == REQUEST_SENSE) || in isd200_invoke_transport()
661 (srb->cmnd[0] == INQUIRY) || in isd200_invoke_transport()
662 (srb->cmnd[0] == MODE_SENSE) || in isd200_invoke_transport()
663 (srb->cmnd[0] == LOG_SENSE) || in isd200_invoke_transport()
664 (srb->cmnd[0] == MODE_SENSE_10))) { in isd200_invoke_transport()
665 usb_stor_dbg(us, "-- unexpectedly short transfer\n"); in isd200_invoke_transport()
670 result = isd200_read_regs(us); in isd200_invoke_transport()
671 if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) { in isd200_invoke_transport()
672 usb_stor_dbg(us, "-- auto-sense aborted\n"); in isd200_invoke_transport()
676 isd200_build_sense(us, srb); in isd200_invoke_transport()
680 if ((srb->sense_buffer[2] & 0xf) == 0x0) in isd200_invoke_transport()
704 clear_bit(US_FLIDX_ABORTING, &us->dflags); in isd200_invoke_transport()
709 static void isd200_log_config(struct us_data *us, struct isd200_info *info) in isd200_log_config() argument
711 usb_stor_dbg(us, " Event Notification: 0x%x\n", in isd200_log_config()
713 usb_stor_dbg(us, " External Clock: 0x%x\n", in isd200_log_config()
715 usb_stor_dbg(us, " ATA Init Timeout: 0x%x\n", in isd200_log_config()
717 usb_stor_dbg(us, " ATAPI Command Block Size: 0x%x\n", in isd200_log_config()
719 usb_stor_dbg(us, " Master/Slave Selection: 0x%x\n", in isd200_log_config()
721 usb_stor_dbg(us, " ATAPI Reset: 0x%x\n", in isd200_log_config()
723 usb_stor_dbg(us, " ATA Timing: 0x%x\n", in isd200_log_config()
725 usb_stor_dbg(us, " ATA Major Command: 0x%x\n", in isd200_log_config()
727 usb_stor_dbg(us, " ATA Minor Command: 0x%x\n", in isd200_log_config()
729 usb_stor_dbg(us, " Init Status: 0x%x\n", in isd200_log_config()
731 usb_stor_dbg(us, " Config Descriptor 2: 0x%x\n", in isd200_log_config()
733 usb_stor_dbg(us, " Skip Device Boot: 0x%x\n", in isd200_log_config()
735 usb_stor_dbg(us, " ATA 3 State Suspend: 0x%x\n", in isd200_log_config()
737 usb_stor_dbg(us, " Descriptor Override: 0x%x\n", in isd200_log_config()
739 usb_stor_dbg(us, " Last LUN Identifier: 0x%x\n", in isd200_log_config()
741 usb_stor_dbg(us, " SRST Enable: 0x%x\n", in isd200_log_config()
754 static int isd200_write_config( struct us_data *us ) in isd200_write_config() argument
756 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_write_config()
761 usb_stor_dbg(us, "Entering isd200_write_config\n"); in isd200_write_config()
762 usb_stor_dbg(us, " Writing the following ISD200 Config Data:\n"); in isd200_write_config()
763 isd200_log_config(us, info); in isd200_write_config()
768 us, in isd200_write_config()
769 us->send_ctrl_pipe, in isd200_write_config()
770 0x01, in isd200_write_config()
772 0x0000, in isd200_write_config()
773 0x0002, in isd200_write_config()
777 if (result >= 0) { in isd200_write_config()
778 usb_stor_dbg(us, " ISD200 Config Data was written successfully\n"); in isd200_write_config()
780 usb_stor_dbg(us, " Request to write ISD200 Config Data failed!\n"); in isd200_write_config()
784 usb_stor_dbg(us, "Leaving isd200_write_config %08X\n", retStatus); in isd200_write_config()
797 static int isd200_read_config( struct us_data *us ) in isd200_read_config() argument
799 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_read_config()
803 usb_stor_dbg(us, "Entering isd200_read_config\n"); in isd200_read_config()
809 us, in isd200_read_config()
810 us->recv_ctrl_pipe, in isd200_read_config()
811 0x02, in isd200_read_config()
813 0x0000, in isd200_read_config()
814 0x0002, in isd200_read_config()
819 if (result >= 0) { in isd200_read_config()
820 usb_stor_dbg(us, " Retrieved the following ISD200 Config Data:\n"); in isd200_read_config()
822 isd200_log_config(us, info); in isd200_read_config()
825 usb_stor_dbg(us, " Request to get ISD200 Config Data failed!\n"); in isd200_read_config()
829 usb_stor_dbg(us, "Leaving isd200_read_config %08X\n", retStatus); in isd200_read_config()
842 static int isd200_atapi_soft_reset( struct us_data *us ) in isd200_atapi_soft_reset() argument
847 usb_stor_dbg(us, "Entering isd200_atapi_soft_reset\n"); in isd200_atapi_soft_reset()
849 transferStatus = isd200_action( us, ACTION_SOFT_RESET, NULL, 0 ); in isd200_atapi_soft_reset()
851 usb_stor_dbg(us, " Error issuing Atapi Soft Reset\n"); in isd200_atapi_soft_reset()
855 usb_stor_dbg(us, "Leaving isd200_atapi_soft_reset %08X\n", retStatus); in isd200_atapi_soft_reset()
868 static int isd200_srst( struct us_data *us ) in isd200_srst() argument
873 usb_stor_dbg(us, "Entering isd200_SRST\n"); in isd200_srst()
875 transferStatus = isd200_action( us, ACTION_RESET, NULL, 0 ); in isd200_srst()
879 usb_stor_dbg(us, " Error issuing SRST\n"); in isd200_srst()
885 transferStatus = isd200_action( us, ACTION_REENABLE, NULL, 0 ); in isd200_srst()
887 usb_stor_dbg(us, " Error taking drive out of reset\n"); in isd200_srst()
895 usb_stor_dbg(us, "Leaving isd200_srst %08X\n", retStatus); in isd200_srst()
909 static int isd200_try_enum(struct us_data *us, unsigned char master_slave, in isd200_try_enum() argument
914 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_try_enum()
916 int recheckAsMaster = 0; in isd200_try_enum()
926 status = isd200_action( us, ACTION_ENUM, NULL, master_slave ); in isd200_try_enum()
930 status = isd200_action( us, ACTION_READ_STATUS, in isd200_try_enum()
937 usb_stor_dbg(us, " %s status is still BSY, try again...\n", in isd200_try_enum()
941 usb_stor_dbg(us, " %s status !BSY, continue with next operation\n", in isd200_try_enum()
952 usb_stor_dbg(us, " Status indicates it is not ready, try again...\n"); in isd200_try_enum()
956 usb_stor_dbg(us, " Identified ATA device\n"); in isd200_try_enum()
965 else if (regs[ATA_REG_HCYL_OFFSET] == 0xEB && in isd200_try_enum()
966 regs[ATA_REG_LCYL_OFFSET] == 0x14) { in isd200_try_enum()
979 usb_stor_dbg(us, " Identified ATAPI device as slave. Rechecking again as master\n"); in isd200_try_enum()
983 usb_stor_dbg(us, " Identified ATAPI device\n"); in isd200_try_enum()
986 status = isd200_atapi_soft_reset(us); in isd200_try_enum()
990 usb_stor_dbg(us, " Not ATA, not ATAPI - Weird\n"); in isd200_try_enum()
997 usb_stor_dbg(us, " BSY check timeout, just continue with next operation...\n"); in isd200_try_enum()
999 usb_stor_dbg(us, " Device detect timeout!\n"); in isd200_try_enum()
1016 static int isd200_manual_enum(struct us_data *us) in isd200_manual_enum() argument
1018 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_manual_enum()
1021 usb_stor_dbg(us, "Entering isd200_manual_enum\n"); in isd200_manual_enum()
1023 retStatus = isd200_read_config(us); in isd200_manual_enum()
1027 retStatus = isd200_try_enum( us, ATA_ADDRESS_DEVHEAD_STD, 0); in isd200_manual_enum()
1029 retStatus = isd200_try_enum( us, ATA_ADDRESS_DEVHEAD_SLAVE, 0); in isd200_manual_enum()
1032 retStatus = isd200_srst(us); in isd200_manual_enum()
1035 retStatus = isd200_try_enum( us, ATA_ADDRESS_DEVHEAD_STD, 1); in isd200_manual_enum()
1038 isslave = (info->DeviceHead & ATA_ADDRESS_DEVHEAD_SLAVE) ? 1 : 0; in isd200_manual_enum()
1040 usb_stor_dbg(us, " Setting Master/Slave selection to %d\n", in isd200_manual_enum()
1042 info->ConfigData.ATAConfig &= 0x3f; in isd200_manual_enum()
1044 retStatus = isd200_write_config(us); in isd200_manual_enum()
1048 usb_stor_dbg(us, "Leaving isd200_manual_enum %08X\n", retStatus); in isd200_manual_enum()
1058 for (i = 0; i < ATA_ID_WORDS; i++) in isd200_fix_driveid()
1066 static void isd200_dump_driveid(struct us_data *us, u16 *id) in isd200_dump_driveid() argument
1068 usb_stor_dbg(us, " Identify Data Structure:\n"); in isd200_dump_driveid()
1069 usb_stor_dbg(us, " config = 0x%x\n", id[ATA_ID_CONFIG]); in isd200_dump_driveid()
1070 usb_stor_dbg(us, " cyls = 0x%x\n", id[ATA_ID_CYLS]); in isd200_dump_driveid()
1071 usb_stor_dbg(us, " heads = 0x%x\n", id[ATA_ID_HEADS]); in isd200_dump_driveid()
1072 usb_stor_dbg(us, " track_bytes = 0x%x\n", id[4]); in isd200_dump_driveid()
1073 usb_stor_dbg(us, " sector_bytes = 0x%x\n", id[5]); in isd200_dump_driveid()
1074 usb_stor_dbg(us, " sectors = 0x%x\n", id[ATA_ID_SECTORS]); in isd200_dump_driveid()
1075 usb_stor_dbg(us, " serial_no[0] = 0x%x\n", *(char *)&id[ATA_ID_SERNO]); in isd200_dump_driveid()
1076 usb_stor_dbg(us, " buf_type = 0x%x\n", id[20]); in isd200_dump_driveid()
1077 usb_stor_dbg(us, " buf_size = 0x%x\n", id[ATA_ID_BUF_SIZE]); in isd200_dump_driveid()
1078 usb_stor_dbg(us, " ecc_bytes = 0x%x\n", id[22]); in isd200_dump_driveid()
1079 usb_stor_dbg(us, " fw_rev[0] = 0x%x\n", *(char *)&id[ATA_ID_FW_REV]); in isd200_dump_driveid()
1080 usb_stor_dbg(us, " model[0] = 0x%x\n", *(char *)&id[ATA_ID_PROD]); in isd200_dump_driveid()
1081 usb_stor_dbg(us, " max_multsect = 0x%x\n", id[ATA_ID_MAX_MULTSECT] & 0xff); in isd200_dump_driveid()
1082 usb_stor_dbg(us, " dword_io = 0x%x\n", id[ATA_ID_DWORD_IO]); in isd200_dump_driveid()
1083 usb_stor_dbg(us, " capability = 0x%x\n", id[ATA_ID_CAPABILITY] >> 8); in isd200_dump_driveid()
1084 usb_stor_dbg(us, " tPIO = 0x%x\n", id[ATA_ID_OLD_PIO_MODES] >> 8); in isd200_dump_driveid()
1085 usb_stor_dbg(us, " tDMA = 0x%x\n", id[ATA_ID_OLD_DMA_MODES] >> 8); in isd200_dump_driveid()
1086 usb_stor_dbg(us, " field_valid = 0x%x\n", id[ATA_ID_FIELD_VALID]); in isd200_dump_driveid()
1087 usb_stor_dbg(us, " cur_cyls = 0x%x\n", id[ATA_ID_CUR_CYLS]); in isd200_dump_driveid()
1088 usb_stor_dbg(us, " cur_heads = 0x%x\n", id[ATA_ID_CUR_HEADS]); in isd200_dump_driveid()
1089 usb_stor_dbg(us, " cur_sectors = 0x%x\n", id[ATA_ID_CUR_SECTORS]); in isd200_dump_driveid()
1090 usb_stor_dbg(us, " cur_capacity = 0x%x\n", ata_id_u32(id, 57)); in isd200_dump_driveid()
1091 usb_stor_dbg(us, " multsect = 0x%x\n", id[ATA_ID_MULTSECT] & 0xff); in isd200_dump_driveid()
1092 usb_stor_dbg(us, " lba_capacity = 0x%x\n", ata_id_u32(id, ATA_ID_LBA_CAPACITY)); in isd200_dump_driveid()
1093 usb_stor_dbg(us, " command_set_1 = 0x%x\n", id[ATA_ID_COMMAND_SET_1]); in isd200_dump_driveid()
1094 usb_stor_dbg(us, " command_set_2 = 0x%x\n", id[ATA_ID_COMMAND_SET_2]); in isd200_dump_driveid()
1105 static int isd200_get_inquiry_data( struct us_data *us ) in isd200_get_inquiry_data() argument
1107 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_get_inquiry_data()
1111 usb_stor_dbg(us, "Entering isd200_get_inquiry_data\n"); in isd200_get_inquiry_data()
1117 retStatus = isd200_manual_enum(us); in isd200_get_inquiry_data()
1125 transferStatus = isd200_action( us, ACTION_IDENTIFY, in isd200_get_inquiry_data()
1129 usb_stor_dbg(us, " Error issuing ATA Command Identify\n"); in isd200_get_inquiry_data()
1138 isd200_dump_driveid(us, id); in isd200_get_inquiry_data()
1140 /* Prevent division by 0 in isd200_scsi_to_ata() */ in isd200_get_inquiry_data()
1141 if (id[ATA_ID_HEADS] == 0 || id[ATA_ID_SECTORS] == 0) { in isd200_get_inquiry_data()
1142 usb_stor_dbg(us, " Invalid ATA Identify data\n"); in isd200_get_inquiry_data()
1147 memset(&info->InquiryData, 0, sizeof(info->InquiryData)); in isd200_get_inquiry_data()
1153 info->InquiryData.AdditionalLength = 0x1F; in isd200_get_inquiry_data()
1164 for (i = 0; i < 4; i++) in isd200_get_inquiry_data()
1169 for (i=0;i<8;i++) in isd200_get_inquiry_data()
1174 for (i=0;i<2;i++) in isd200_get_inquiry_data()
1179 usb_stor_dbg(us, " Device supports Media Status Notification\n"); in isd200_get_inquiry_data()
1198 us->protocol_name = "Transparent SCSI"; in isd200_get_inquiry_data()
1199 us->proto_handler = usb_stor_transparent_scsi_command; in isd200_get_inquiry_data()
1201 usb_stor_dbg(us, "Protocol changed to: %s\n", in isd200_get_inquiry_data()
1202 us->protocol_name); in isd200_get_inquiry_data()
1205 us->extra_destructor(info); in isd200_get_inquiry_data()
1207 us->extra = NULL; in isd200_get_inquiry_data()
1208 us->extra_destructor = NULL; in isd200_get_inquiry_data()
1213 usb_stor_dbg(us, "Leaving isd200_get_inquiry_data %08X\n", retStatus); in isd200_get_inquiry_data()
1225 * 0 otherwise
1227 static int isd200_scsi_to_ata(struct scsi_cmnd *srb, struct us_data *us, in isd200_scsi_to_ata() argument
1230 struct isd200_info *info = (struct isd200_info *)us->extra; in isd200_scsi_to_ata()
1237 unsigned char senseData[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; in isd200_scsi_to_ata()
1239 memset(ataCdb, 0, sizeof(union ata_cdb)); in isd200_scsi_to_ata()
1242 switch (srb->cmnd[0]) { in isd200_scsi_to_ata()
1244 usb_stor_dbg(us, " ATA OUT - INQUIRY\n"); in isd200_scsi_to_ata()
1250 sendToTransport = 0; in isd200_scsi_to_ata()
1254 usb_stor_dbg(us, " ATA OUT - SCSIOP_MODE_SENSE\n"); in isd200_scsi_to_ata()
1266 isd200_srb_set_bufflen(srb, 0); in isd200_scsi_to_ata()
1268 usb_stor_dbg(us, " Media Status not supported, just report okay\n"); in isd200_scsi_to_ata()
1270 sendToTransport = 0; in isd200_scsi_to_ata()
1275 usb_stor_dbg(us, " ATA OUT - SCSIOP_TEST_UNIT_READY\n"); in isd200_scsi_to_ata()
1284 isd200_srb_set_bufflen(srb, 0); in isd200_scsi_to_ata()
1286 usb_stor_dbg(us, " Media Status not supported, just report okay\n"); in isd200_scsi_to_ata()
1288 sendToTransport = 0; in isd200_scsi_to_ata()
1297 usb_stor_dbg(us, " ATA OUT - SCSIOP_READ_CAPACITY\n"); in isd200_scsi_to_ata()
1306 readCapacityData.BytesPerBlock = cpu_to_be32(0x200); in isd200_scsi_to_ata()
1311 sendToTransport = 0; in isd200_scsi_to_ata()
1316 usb_stor_dbg(us, " ATA OUT - SCSIOP_READ\n"); in isd200_scsi_to_ata()
1324 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); in isd200_scsi_to_ata()
1348 usb_stor_dbg(us, " ATA OUT - SCSIOP_WRITE\n"); in isd200_scsi_to_ata()
1356 head = ATA_ADDRESS_DEVHEAD_LBA_MODE | (unsigned char)(lba>>24 & 0x0F); in isd200_scsi_to_ata()
1380 usb_stor_dbg(us, " ATA OUT - SCSIOP_MEDIUM_REMOVAL\n"); in isd200_scsi_to_ata()
1383 usb_stor_dbg(us, " srb->cmnd[4] = 0x%X\n", in isd200_scsi_to_ata()
1390 ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ? in isd200_scsi_to_ata()
1392 isd200_srb_set_bufflen(srb, 0); in isd200_scsi_to_ata()
1394 usb_stor_dbg(us, " Not removable media, just report okay\n"); in isd200_scsi_to_ata()
1396 sendToTransport = 0; in isd200_scsi_to_ata()
1401 usb_stor_dbg(us, " ATA OUT - SCSIOP_START_STOP_UNIT\n"); in isd200_scsi_to_ata()
1402 usb_stor_dbg(us, " srb->cmnd[4] = 0x%X\n", srb->cmnd[4]); in isd200_scsi_to_ata()
1404 if ((srb->cmnd[4] & 0x3) == 0x2) { in isd200_scsi_to_ata()
1405 usb_stor_dbg(us, " Media Eject\n"); in isd200_scsi_to_ata()
1408 ataCdb->generic.TransferBlockSize = 0; in isd200_scsi_to_ata()
1411 } else if ((srb->cmnd[4] & 0x3) == 0x1) { in isd200_scsi_to_ata()
1412 usb_stor_dbg(us, " Get Media Status\n"); in isd200_scsi_to_ata()
1418 isd200_srb_set_bufflen(srb, 0); in isd200_scsi_to_ata()
1420 usb_stor_dbg(us, " Nothing to do, just report okay\n"); in isd200_scsi_to_ata()
1422 sendToTransport = 0; in isd200_scsi_to_ata()
1427 usb_stor_dbg(us, "Unsupported SCSI command - 0x%X\n", in isd200_scsi_to_ata()
1428 srb->cmnd[0]); in isd200_scsi_to_ata()
1430 sendToTransport = 0; in isd200_scsi_to_ata()
1462 static int isd200_init_info(struct us_data *us) in isd200_init_info() argument
1480 us->extra = info; in isd200_init_info()
1481 us->extra_destructor = isd200_free_info_ptrs; in isd200_init_info()
1483 return 0; in isd200_init_info()
1490 static int isd200_Initialization(struct us_data *us) in isd200_Initialization() argument
1492 int rc = 0; in isd200_Initialization()
1494 usb_stor_dbg(us, "ISD200 Initialization...\n"); in isd200_Initialization()
1498 if (isd200_init_info(us) < 0) { in isd200_Initialization()
1499 usb_stor_dbg(us, "ERROR Initializing ISD200 Info struct\n"); in isd200_Initialization()
1504 if (isd200_get_inquiry_data(us) != ISD200_GOOD) { in isd200_Initialization()
1505 usb_stor_dbg(us, "ISD200 Initialization Failure\n"); in isd200_Initialization()
1508 usb_stor_dbg(us, "ISD200 Initialization complete\n"); in isd200_Initialization()
1526 static void isd200_ata_command(struct scsi_cmnd *srb, struct us_data *us) in isd200_ata_command() argument
1533 if (us->extra == NULL) { in isd200_ata_command()
1534 usb_stor_dbg(us, "ERROR Driver not initialized\n"); in isd200_ata_command()
1539 scsi_set_resid(srb, 0); in isd200_ata_command()
1542 sendToTransport = isd200_scsi_to_ata(srb, us, &ataCdb); in isd200_ata_command()
1546 isd200_invoke_transport(us, srb, &ataCdb); in isd200_ata_command()
1556 struct us_data *us; in isd200_probe() local
1559 result = usb_stor_probe1(&us, intf, id, in isd200_probe()
1565 us->protocol_name = "ISD200 ATA/ATAPI"; in isd200_probe()
1566 us->proto_handler = isd200_ata_command; in isd200_probe()
1568 result = usb_stor_probe2(us); in isd200_probe()