FreeBSD/sys/dev/isci/scil/sati_mode_select.c
/**
 * @brief This method will check the validity of parameter data of Read Write Error Recovery
 *            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 Read Write Error Recovery
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 Read Write Error Recovery 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_read_write_error_recovery(
   SATI_TRANSLATOR_SEQUENCE_T* sequence,
   void     *  scsi_io,
   U32   page_size
   )
{
   SATI_STATUS status = SATI_FAILURE_CHECK_RESPONSE_DATA;
   U8 current_mode_page[SCSI_MODE_PAGE_01_LENGTH]={0,0,0,0,0,0,0,0,0,0,0,0};
   U32 mode_page_offset;
   mode_page_offset = sequence->command_specific_data.process_state.mode_page_offset;
   sati_get_data_byte(sequence, scsi_io, mode_page_offset,   &current_mode_page[0]);
   sati_get_data_byte(sequence, scsi_io, mode_page_offset+1, &current_mode_page[1]);
   sati_get_data_byte(sequence, scsi_io, mode_page_offset+2, &current_mode_page[2]);
   sati_get_data_byte(sequence, scsi_io, mode_page_offset+10, &current_mode_page[10]);
   sati_get_data_byte(sequence, scsi_io, mode_page_offset+11, &current_mode_page[11]);
   if ( ((current_mode_page[0] & SCSI_MODE_SELECT_MODE_PAGE_SPF_MASK)!= 0) ||
      (current_mode_page[1] != (SCSI_MODE_PAGE_01_LENGTH - 2)) ||
      ((current_mode_page[2] & SCSI_MODE_SELECT_MODE_PAGE_01_AWRE_MASK) == 0) ||
      ((current_mode_page[2] & SCSI_MODE_SELECT_MODE_PAGE_01_ARRE_MASK) != 0) ||
      ((current_mode_page[2] & SCSI_MODE_SELECT_MODE_PAGE_01_RC_ERBITS_MASK) != 0) ||
      (current_mode_page[10] != 0 ) ||
      (current_mode_page[11] != 0 ) )
   {
      status = SATI_FAILURE_CHECK_RESPONSE_DATA;
      return status;
   }
   {
      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_COMPLETE;
   return status;
}
static SATI_STATUS sati_mode_select_process_mode_page_read_write_error_recovery ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , U32 page_size ) { SATI_STATUS status = SATI_FAILURE_CHECK_RESPONSE_DATA ; U8 current_mode_page [ SCSI_MODE_PAGE_01_LENGTH ] = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ; U32 mode_page_offset ; mode_page_offset = sequence -> command_specific_data . process_state . mode_page_offset ; sati_get_data_byte ( sequence , scsi_io , mode_page_offset , & current_mode_page [ 0 ] ) ; sati_get_data_byte ( sequence , scsi_io , mode_page_offset + 1 , & current_mode_page [ 1 ] ) ; sati_get_data_byte ( sequence , scsi_io , mode_page_offset + 2 , & current_mode_page [ 2 ] ) ; sati_get_data_byte ( sequence , scsi_io , mode_page_offset + 10 , & current_mode_page [ 10 ] ) ; sati_get_data_byte ( sequence , scsi_io , mode_page_offset + 11 , & current_mode_page [ 11 ] ) ; if ( ( ( current_mode_page [ 0 ] & SCSI_MODE_SELECT_MODE_PAGE_SPF_MASK ) != 0 ) || ( current_mode_page [ 1 ] != ( SCSI_MODE_PAGE_01_LENGTH - 2 ) ) || ( ( current_mode_page [ 2 ] & SCSI_MODE_SELECT_MODE_PAGE_01_AWRE_MASK ) == 0 ) || ( ( current_mode_page [ 2 ] & SCSI_MODE_SELECT_MODE_PAGE_01_ARRE_MASK ) != 0 ) || ( ( current_mode_page [ 2 ] & SCSI_MODE_SELECT_MODE_PAGE_01_RC_ERBITS_MASK ) != 0 ) || ( current_mode_page [ 10 ] != 0 ) || ( current_mode_page [ 11 ] != 0 ) ) { status = SATI_FAILURE_CHECK_RESPONSE_DATA ; return status ; } { 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_COMPLETE ; return status ; }
@brief This method will check the validity of parameter data of Read Write Error Recovery
            page and further processing the page data if necessary.
@brief This method will check the validity of parameter data of Read Write Error Recovery page and further processing the page data if necessary .
//Check all the defined bits for this page //SPF(0b); Page length 0x0A;AWRE 1; ARRE 0; Error recovery bits 0; RC 0; //Recovery time limit last two bytes 0 //no need to send any command