Lines Matching refs:command

75 static int issue_uscsi_cmd(int file, struct uscsi_cmd *command, int flag);
167 * Return a pointer to a string telling us the name of the command.
176 int command;
182 scsi_command_names[0].command = SCMD_TEST_UNIT_READY;
185 scsi_command_names[1].command = SCMD_FORMAT;
188 scsi_command_names[2].command = SCMD_REASSIGN_BLOCK;
191 scsi_command_names[3].command = SCMD_READ;
194 scsi_command_names[4].command = SCMD_WRITE;
197 scsi_command_names[5].command = SCMD_READ_G1;
200 scsi_command_names[6].command = SCMD_WRITE_G1;
203 scsi_command_names[7].command = SCMD_MODE_SELECT;
206 scsi_command_names[8].command = SCMD_MODE_SENSE;
209 scsi_command_names[9].command = SCMD_REASSIGN_BLOCK;
212 scsi_command_names[10].command = SCMD_REQUEST_SENSE;
215 scsi_command_names[11].command = SCMD_READ_DEFECT_LIST;
218 scsi_command_names[12].command = SCMD_INQUIRY;
221 scsi_command_names[13].command = SCMD_WRITE_BUFFER;
224 scsi_command_names[14].command = SCMD_READ_BUFFER;
227 scsi_command_names[15].command = SCMD_START_STOP;
230 scsi_command_names[16].command = SCMD_RESERVE;
233 scsi_command_names[17].command = SCMD_RELEASE;
236 scsi_command_names[18].command = SCMD_MODE_SENSE_G1;
239 scsi_command_names[19].command = SCMD_MODE_SELECT_G1;
242 scsi_command_names[20].command = SCMD_READ_CAPACITY;
245 scsi_command_names[21].command = SCMD_SYNC_CACHE;
248 scsi_command_names[22].command = SCMD_READ_DEFECT_LIST;
251 scsi_command_names[23].command = SCMD_GDIAG;
254 scsi_command_names[24].command = SCMD_SDIAG;
257 scsi_command_names[25].command = SCMD_PERS_RESERV_IN;
260 scsi_command_names[26].command = SCMD_PERS_RESERV_OUT;
263 scsi_command_names[27].command = SCMD_LOG_SENSE;
266 scsi_command_names[28].command = SCMD_UNKNOWN;
270 for (c = scsi_command_names; c->command != SCMD_UNKNOWN; c++)
271 if (c->command == cmd)
331 "Aborted command. Error: Random Retry Failed.\n"));
388 * Execute a command and determine the result.
391 issue_uscsi_cmd(int file, struct uscsi_cmd *command, int flag)
403 command->uscsi_flags = USCSI_RQENABLE;
404 command->uscsi_flags |= flag;
409 /* print command for debug */
411 if ((command->uscsi_cdb == NULL) ||
423 "SCSI command: %s\n",
424 scsi_find_command_name(command->uscsi_cdb[0]));
426 for (i = 0; i < (int)command->uscsi_cdblen; i++) {
427 (void) printf("%x ", *(command->uscsi_cdb + i));
431 command->uscsi_cdblen,
432 command->uscsi_bufaddr,
433 command->uscsi_buflen, command->uscsi_flags);
435 if ((command->uscsi_buflen > 0) &&
438 (uchar_t *)command->uscsi_bufaddr,
439 MIN(command->uscsi_buflen, 512), HEX_ASCII);
447 * Default command timeout in case command left it 0
449 if (command->uscsi_timeout == 0) {
450 command->uscsi_timeout = 60;
452 /* Issue command - finally */
455 status = ioctl(file, USCSICMD, command);
456 if (status == 0 && command->uscsi_status == 0) {
458 if ((command->uscsi_buflen > 0) &&
461 (uchar_t *)command->uscsi_bufaddr,
462 MIN(command->uscsi_buflen, 512), HEX_ASCII);
467 if ((status != 0) && (command->uscsi_status == 0)) {
481 if ((command->uscsi_rqbuf != NULL) &&
482 (((char)command->uscsi_rqlen - (char)command->uscsi_rqresid) > 0)) {
484 rqbuf = (struct scsi_extended_sense *)command->uscsi_rqbuf;
520 scsi_printerr(command,
521 (struct scsi_extended_sense *)command->uscsi_rqbuf,
522 (command->uscsi_rqlen - command->uscsi_rqresid),
536 * command queue has a depth of one command.
538 switch ((uchar_t)command->uscsi_status & STATUS_MASK) {
600 return (L_SCSI_ERROR | command->uscsi_status);
604 * MODE SENSE USCSI command