FreeBSD/sys/dev/isci/scil/sati_mode_select.c
/**
 * @brief This method will check the validity of parameter data of Information Exception Control
 *            mode page and further processing the page data if necessary.
 *
 * @param[in] page_size This parameter specifies page size of current mode page.
 *
 * @return Indicate if the translation was successful.
 * @retval SATI_SUCCESS
 * @retval SATI_COMPLETE
 * @retval SATI_FAILURE_CHECK_RESPONSE_DATA
 */
@brief This method will check the validity of parameter data of Information Exception Control
mode page and further processing the page data if necessary.

@param[in] page_size This parameter specifies page size of current mode page.

@return Indicate if the translation was successful.
@brief This method will check the validity of parameter data of Information Exception Control mode page and further processing the page data if necessary . @param [ in ] page_size This parameter specifies page size of current mode page . @return Indicate if the translation was successful .
static
SATI_STATUS sati_mode_select_process_mode_page_informational_exception_control(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void     *  scsi_io,
   void     *  ata_io,
   U32 page_size
   )
{
   SATI_STATUS status = SATI_FAILURE_CHECK_RESPONSE_DATA;
   U8 current_mode_page[SCSI_MODE_PAGE_1C_LENGTH]={0,0,0,0,0,0,0,0,0,0,0,0};
   U32 mode_page_offset;
   U32 index;
   mode_page_offset = sequence->command_specific_data.process_state.mode_page_offset;
   sequence->type = SATI_SEQUENCE_MODE_SELECT_MODE_INFORMATION_EXCEPT_CONTROL;
   for(index = 0; index < 4; index++)
   {
      sati_get_data_byte(sequence, scsi_io, mode_page_offset+index, &current_mode_page[index]);
   }
   if (((current_mode_page[0] & SCSI_MODE_SELECT_MODE_PAGE_SPF_MASK)!= 0) ||
      (current_mode_page[1] != (SCSI_MODE_PAGE_1C_LENGTH - 2)) ||
      ((current_mode_page[2] & SCSI_MODE_SELECT_MODE_PAGE_1C_PERF_TEST)!= 0 ) ||
      ((current_mode_page[3] & SCSI_MODE_SELECT_MODE_PAGE_MRIE_MASK) !=
      SCSI_MODE_SELECT_MODE_PAGE_MRIE_BYTE ))
   {
      return SATI_FAILURE_CHECK_RESPONSE_DATA;
   }
   if ( (current_mode_page[2] & SCSI_MODE_PAGE_DEXCPT_ENABLE) == 0)
      sati_ata_smart_return_status_construct(ata_io, sequence, ATA_SMART_SUB_CMD_ENABLE);
   else
      sati_ata_smart_return_status_construct(ata_io, sequence, ATA_SMART_SUB_CMD_DISABLE);
   sequence->command_specific_data.process_state.size_of_data_processed += page_size;
   sequence->command_specific_data.process_state.mode_page_offset += page_size;
   sequence->command_specific_data.process_state.current_mode_page_processed = TRUE;
   status = SATI_SUCCESS;
   return status;
}
static SATI_STATUS sati_mode_select_process_mode_page_informational_exception_control ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , void * ata_io , U32 page_size ) { SATI_STATUS status = SATI_FAILURE_CHECK_RESPONSE_DATA ; U8 current_mode_page [ SCSI_MODE_PAGE_1C_LENGTH ] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; U32 mode_page_offset ; U32 index ; mode_page_offset = sequence -> command_specific_data . process_state . mode_page_offset ; sequence -> type = SATI_SEQUENCE_MODE_SELECT_MODE_INFORMATION_EXCEPT_CONTROL ; for ( index = 0 ; index < 4 ; index ++ ) { sati_get_data_byte ( sequence , scsi_io , mode_page_offset + index , & current_mode_page [ index ] ) ; } if ( ( ( current_mode_page [ 0 ] & SCSI_MODE_SELECT_MODE_PAGE_SPF_MASK ) != 0 ) || ( current_mode_page [ 1 ] != ( SCSI_MODE_PAGE_1C_LENGTH - 2 ) ) || ( ( current_mode_page [ 2 ] & SCSI_MODE_SELECT_MODE_PAGE_1C_PERF_TEST ) != 0 ) || ( ( current_mode_page [ 3 ] & SCSI_MODE_SELECT_MODE_PAGE_MRIE_MASK ) != SCSI_MODE_SELECT_MODE_PAGE_MRIE_BYTE ) ) { return SATI_FAILURE_CHECK_RESPONSE_DATA ; } if ( ( current_mode_page [ 2 ] & SCSI_MODE_PAGE_DEXCPT_ENABLE ) == 0 ) sati_ata_smart_return_status_construct ( ata_io , sequence , ATA_SMART_SUB_CMD_ENABLE ) ; else sati_ata_smart_return_status_construct ( ata_io , sequence , ATA_SMART_SUB_CMD_DISABLE ) ; sequence -> command_specific_data . process_state . size_of_data_processed += page_size ; sequence -> command_specific_data . process_state . mode_page_offset += page_size ; sequence -> command_specific_data . process_state . current_mode_page_processed = TRUE ; status = SATI_SUCCESS ; return status ; }
@brief This method will check the validity of parameter data of Information Exception Control
            mode page and further processing the page data if necessary.
@brief This method will check the validity of parameter data of Information Exception Control mode page and further processing the page data if necessary .
//SCSI_MODE_PAGE_1C_LENGTH 12 //Check for data validity //SPF(0b); Page length 0x0A; Byte2 0????0?? Byte3: ????1100 //SCSI_MODE_SELECT_MODE_PAGE_MRIE_BYTE same as REPORT_INFO_EXCEPTION_CONDITION_ON_REQUEST 0x6 //SCSI_MODE_PAGE_DEXCPT_ENABLE // DEXCPT bit is set to 0, enable SMART reporting D8h; // DEXCPT bit is set to 1, disable SMART reporting D9h // SCSI_MODE_PAGE_DEXCPT_ENABLE== 0x08 // No more ata commands to send