FreeBSD/sys/dev/isci/scil/sati_log_sense.c
/**
 * @brief This method will translate the response to the SATI Log Sense
 *        translation. ATA command responses will be translated into the
 *        correct SCSI log pages to be returned by SATI.
 *
 * @return SATI_STATUS Indicates if the response translation succeeded.
 *
 */
@brief This method will translate the response to the SATI Log Sense
translation. ATA command responses will be translated into the
correct SCSI log pages to be returned by SATI.

@return SATI_STATUS Indicates if the response translation succeeded.
@brief This method will translate the response to the SATI Log Sense translation . ATA command responses will be translated into the correct SCSI log pages to be returned by SATI . @return SATI_STATUS Indicates if the response translation succeeded .
SATI_STATUS sati_log_sense_translate_response(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * scsi_io,
   void                       * ata_io
)
{
   U8 * register_fis = sati_cb_get_d2h_register_fis_address(ata_io);
   SATI_STATUS status = SATI_FAILURE;
   if(sati_get_ata_status(register_fis) & ATA_STATUS_REG_ERROR_BIT)
   {
      sati_scsi_sense_data_construct(
         sequence,
         scsi_io,
         SCSI_STATUS_CHECK_CONDITION,
         SCSI_SENSE_ABORTED_COMMAND,
         SCSI_ASC_NO_ADDITIONAL_SENSE ,
         SCSI_ASCQ_NO_ADDITIONAL_SENSE
      );
      status = SATI_FAILURE_CHECK_RESPONSE_DATA;
   }
   else
   {
      void * ata_data = sati_cb_get_ata_data_address(ata_io);
      if(ata_data == NULL)
      {
         return SATI_FAILURE;
      }
      switch(sequence->type)
      {
         case SATI_SEQUENCE_LOG_SENSE_EXTENDED_SELF_TEST_LOG_PAGE:
            sati_extended_self_test_log_page_construct(
                                 sequence, scsi_io, ata_data
            );
            status = SATI_COMPLETE;
            break;
         case SATI_SEQUENCE_LOG_SENSE_SELF_TEST_LOG_PAGE:
            sati_self_test_log_page_construct(sequence, scsi_io, ata_data);
            status = SATI_COMPLETE;
            break;
         case SATI_SEQUENCE_LOG_SENSE_INFO_EXCEPTION_LOG_PAGE:
            sati_information_exception_log_page_contruct(
                                 sequence, scsi_io, ata_io
            );
            status = SATI_COMPLETE;
            break;
         default:
            sati_scsi_sense_data_construct(
               sequence,
               scsi_io,
               SCSI_STATUS_CHECK_CONDITION,
               SCSI_SENSE_ABORTED_COMMAND,
               SCSI_ASC_NO_ADDITIONAL_SENSE ,
               SCSI_ASCQ_NO_ADDITIONAL_SENSE
            );
            status = SATI_FAILURE_CHECK_RESPONSE_DATA;
            break;
      }
   }
   return status;
}
SATI_STATUS sati_log_sense_translate_response ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , void * ata_io ) { U8 * register_fis = sati_cb_get_d2h_register_fis_address ( ata_io ) ; SATI_STATUS status = SATI_FAILURE ; if ( sati_get_ata_status ( register_fis ) & ATA_STATUS_REG_ERROR_BIT ) { sati_scsi_sense_data_construct ( sequence , scsi_io , SCSI_STATUS_CHECK_CONDITION , SCSI_SENSE_ABORTED_COMMAND , SCSI_ASC_NO_ADDITIONAL_SENSE , SCSI_ASCQ_NO_ADDITIONAL_SENSE ) ; status = SATI_FAILURE_CHECK_RESPONSE_DATA ; } else { void * ata_data = sati_cb_get_ata_data_address ( ata_io ) ; if ( ata_data == NULL ) { return SATI_FAILURE ; } switch ( sequence -> type ) { case SATI_SEQUENCE_LOG_SENSE_EXTENDED_SELF_TEST_LOG_PAGE : sati_extended_self_test_log_page_construct ( sequence , scsi_io , ata_data ) ; status = SATI_COMPLETE ; break ; case SATI_SEQUENCE_LOG_SENSE_SELF_TEST_LOG_PAGE : sati_self_test_log_page_construct ( sequence , scsi_io , ata_data ) ; status = SATI_COMPLETE ; break ; case SATI_SEQUENCE_LOG_SENSE_INFO_EXCEPTION_LOG_PAGE : sati_information_exception_log_page_contruct ( sequence , scsi_io , ata_io ) ; status = SATI_COMPLETE ; break ; default : sati_scsi_sense_data_construct ( sequence , scsi_io , SCSI_STATUS_CHECK_CONDITION , SCSI_SENSE_ABORTED_COMMAND , SCSI_ASC_NO_ADDITIONAL_SENSE , SCSI_ASCQ_NO_ADDITIONAL_SENSE ) ; status = SATI_FAILURE_CHECK_RESPONSE_DATA ; break ; } } return status ; }
@brief This method will translate the response to the SATI Log Sense
        translation.
@brief This method will translate the response to the SATI Log Sense translation .
//This function needs a d->h register fis, not ata data