SATI_STATUS sati_abort_task_set_translate_data( SATI_TRANSLATOR_SEQUENCE_T * sequence, void * ata_input_data, void * scsi_task ) { ATA_NCQ_COMMAND_ERROR_LOG_T * log = (ATA_NCQ_COMMAND_ERROR_LOG_T *)ata_input_data; U8 tag_index; sequence->state = SATI_SEQUENCE_STATE_TRANSLATE_DATA; for (tag_index = 0; tag_index < 32; tag_index++) { void * matching_command; SCI_IO_STATUS completion_status; sati_cb_device_get_request_by_ncq_tag( scsi_task, tag_index, matching_command ); if (matching_command != NULL) { if ( (log->ncq_tag == tag_index) && (log->nq == 0) // nq==1 means a non-queued command // caused this failure ) { sati_translate_error(sequence, matching_command, log->error); completion_status = SCI_IO_FAILURE_RESPONSE_VALID; if(sequence->state == SATI_SEQUENCE_STATE_READ_ERROR) { //Uncorrectable read error, return additional sense data sati_scsi_read_ncq_error_sense_construct( sequence, matching_command, ata_input_data, SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_MEDIUM_ERROR, SCSI_ASC_UNRECOVERED_READ_ERROR, SCSI_ASCQ_UNRECOVERED_READ_ERROR ); } } else { completion_status = SCI_IO_FAILURE_TERMINATED; } sati_cb_io_request_complete(matching_command, completion_status); } } sequence->state = SATI_SEQUENCE_STATE_FINAL; return SATI_COMPLETE; }
/** * @brief This method will translate the ATA command * response * * @return Indicate if the command translation succeeded. * @retval SATI_COMPLETE This is returned if the command translation was * successful. * @retval SATI_FAILURE This is returned if the command translation was * unsuccessful */ SATI_STATUS sati_passthrough_translate_response( SATI_TRANSLATOR_SEQUENCE_T * sequence, void * scsi_io, void * ata_io ) { U8 * cdb; U8 * register_fis; cdb = sati_cb_get_cdb_address(scsi_io); register_fis = sati_cb_get_d2h_register_fis_address(ata_io); // Check for device errors if (sati_get_ata_status(register_fis) & ATA_STATUS_REG_ERROR_BIT) { sati_translate_error(sequence, scsi_io, (U8)sati_get_ata_error(register_fis)); return SATI_FAILURE_CHECK_RESPONSE_DATA; } sequence->state = SATI_SEQUENCE_STATE_FINAL; // If the user set the check condition bit, fill out the sense data if (PASSTHROUGH_CDB_CK_COND(cdb) || PASSTHROUGH_CDB_PROTOCOL(cdb) == PASSTHROUGH_RETURN_RESPONSE) { sati_passthrough_construct_sense( sequence, register_fis, scsi_io, SCSI_STATUS_CHECK_CONDITION, SCSI_SENSE_RECOVERED_ERROR, SCSI_ASC_NO_ADDITIONAL_SENSE, SCSI_ASCQ_ATA_PASS_THROUGH_INFORMATION_AVAILABLE ); return SATI_FAILURE_CHECK_RESPONSE_DATA; } return SATI_COMPLETE; }