FreeBSD/sys/dev/isci/scil/sati_passthrough.c
/**
 * @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
 */
@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
@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);
   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 (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;
}
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 ) ; 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 ( 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 ; }
@brief This method will translate the ATA command
        response
@brief This method will translate the ATA command response
// Check for device errors // If the user set the check condition bit, fill out the sense data