FreeBSD/sys/dev/isci/scil/sati_mode_sense.c
/**
 * @brief This method performs the informational exceptions control mode
 *        page specific data translation based upon the contents of the
 *        remote device IDENTIFY DEVICE data.
 *        For more information on the parameters passed to this method,
 *        please reference sati_translate_command().
 *
 * @param[in] identify This parameter specifies the remote device's
 *            IDENTIFY DEVICE data received as part of the IO request.
 * @param[in] offset This parameter specifies the offset into the data
 *            buffer where the translated data is to be written.
 *
 * @return This method returns the size of the mode page data that was
 *         translated.
 */
@brief This method performs the informational exceptions control mode
page specific data translation based upon the contents of the
remote device IDENTIFY DEVICE data.
For more information on the parameters passed to this method,
please reference sati_translate_command().

@param[in] identify This parameter specifies the remote device's
IDENTIFY DEVICE data received as part of the IO request.
@param[in] offset This parameter specifies the offset into the data
buffer where the translated data is to be written.

@return This method returns the size of the mode page data that was
translated.
@brief This method performs the informational exceptions control mode page specific data translation based upon the contents of the remote device IDENTIFY DEVICE data . For more information on the parameters passed to this method please reference sati_translate_command () . @param [ in ] identify This parameter specifies the remote device ' s IDENTIFY DEVICE data received as part of the IO request . @param [ in ] offset This parameter specifies the offset into the data buffer where the translated data is to be written . @return This method returns the size of the mode page data that was translated .
U32 sati_mode_sense_informational_excp_control_translate_data(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * scsi_io,
   ATA_IDENTIFY_DEVICE_DATA_T * identify,
   U32                          offset
)
{
   U8 * cdb          = sati_cb_get_cdb_address(scsi_io);
   U8   page_control = sati_get_cdb_byte(cdb, 2) >> SCSI_MODE_SENSE_PC_SHIFT;
   U32  page_length;
   page_length = sati_mode_sense_copy_initial_data(
                    sequence,
                    scsi_io,
                    offset,
                    page_control,
                    SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL
                 );
   if (page_control == SCSI_MODE_SENSE_PC_CURRENT)
   {
      U8 value;
      sati_get_data_byte(sequence, scsi_io, offset+2, &value);
      if (  (identify->command_set_supported0
                & ATA_IDENTIFY_COMMAND_SET_SUPPORTED0_SMART_ENABLE)
         && (identify->command_set_enabled0
                & ATA_IDENTIFY_COMMAND_SET_ENABLED0_SMART_ENABLE) )
      {
         value &= ~SCSI_MODE_PAGE_INFORMATIONAL_EXCP_DXCPT_ENABLE;
      }
      else
      {
         value |= SCSI_MODE_PAGE_INFORMATIONAL_EXCP_DXCPT_ENABLE;
      }
      sati_set_data_byte(sequence, scsi_io, offset+2, value);
      sequence->number_data_bytes_set--;
   }
   return page_length;
}
U32 sati_mode_sense_informational_excp_control_translate_data ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , ATA_IDENTIFY_DEVICE_DATA_T * identify , U32 offset ) { U8 * cdb = sati_cb_get_cdb_address ( scsi_io ) ; U8 page_control = sati_get_cdb_byte ( cdb , 2 ) >> SCSI_MODE_SENSE_PC_SHIFT ; U32 page_length ; page_length = sati_mode_sense_copy_initial_data ( sequence , scsi_io , offset , page_control , SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL ) ; if ( page_control == SCSI_MODE_SENSE_PC_CURRENT ) { U8 value ; sati_get_data_byte ( sequence , scsi_io , offset + 2 , & value ) ; if ( ( identify -> command_set_supported0 & ATA_IDENTIFY_COMMAND_SET_SUPPORTED0_SMART_ENABLE ) && ( identify -> command_set_enabled0 & ATA_IDENTIFY_COMMAND_SET_ENABLED0_SMART_ENABLE ) ) { value &= ~ SCSI_MODE_PAGE_INFORMATIONAL_EXCP_DXCPT_ENABLE ; } else { value |= SCSI_MODE_PAGE_INFORMATIONAL_EXCP_DXCPT_ENABLE ; } sati_set_data_byte ( sequence , scsi_io , offset + 2 , value ) ; sequence -> number_data_bytes_set -- ; } return page_length ; }
@brief This method performs the informational exceptions control mode
        page specific data translation based upon the contents of the
        remote device IDENTIFY DEVICE data.
@brief This method performs the informational exceptions control mode page specific data translation based upon the contents of the remote device IDENTIFY DEVICE data .
// If the request queried for the current values, then // we need to translate the data from the IDENTIFY DEVICE request. // Determine if the SMART feature set is supported and enabled. // Clear the DXCPT field since the SMART feature is supported/enabled. // Set the Disable Exception Control (DXCPT) field since the SMART // feature is not supported or enabled. //This byte has been set twice, the first time in //sati_mode_sense_copy_initial_data. number_data_bytes_set //needs to be decremented