FreeBSD/sys/dev/isci/scil/sati_mode_select.c
/**
 * @brief This method will process the 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 process the mode page.
@return Indicate if the translation was successful.
@brief This method will process the mode page . @return Indicate if the translation was successful .
static
SATI_STATUS sati_mode_select_process_mode_page(
   SATI_TRANSLATOR_SEQUENCE_T* sequence,
   void                      * scsi_io,
   void                      * ata_io
)
{
   SATI_STATUS status = SATI_FAILURE_CHECK_RESPONSE_DATA;
   U8 page_code;
   U32 page_size = 0; 
   U32 size_of_data_to_be_processed;
   U8 page_code_byte;
   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, &page_code_byte);
   if(sequence->command_specific_data.process_state.mode_pages_size >
      sequence->command_specific_data.process_state.size_of_data_processed)
   {
      page_code = page_code_byte & SCSI_MODE_SENSE_PAGE_CODE_ENABLE;
      page_size = sati_mode_select_get_mode_page_size(page_code);
      size_of_data_to_be_processed = sequence->command_specific_data.process_state.mode_pages_size
         - sequence->command_specific_data.process_state.size_of_data_processed;
      if( page_size == 0 )
      {
         status = SATI_FAILURE_CHECK_RESPONSE_DATA;
      }
      else
      {
         switch(page_code)
         {
         case SCSI_MODE_PAGE_READ_WRITE_ERROR:
            status = sati_mode_select_process_mode_page_read_write_error_recovery(
                        sequence,
                        scsi_io,
                        page_size
                     );
            break;
         case SCSI_MODE_PAGE_DISCONNECT_RECONNECT:
            status = sati_mode_select_process_mode_page_disconnect_reconnect(
                        &sequence->command_specific_data.process_state,
                        page_size
                     );
            break;
         case SCSI_MODE_PAGE_CACHING:
            status = sati_mode_select_process_mode_page_caching(
                        sequence,
                        scsi_io,
                        ata_io,
                        page_size
                     );
            break;
         case SCSI_MODE_PAGE_CONTROL:
            status = sati_mode_select_process_mode_page_control(
                        sequence,
                        scsi_io,
                        ata_io,
                        page_size
                     );
            break;
         case SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL:
            status = sati_mode_select_process_mode_page_informational_exception_control(
                        sequence,
                        scsi_io,
                        ata_io,
                        page_size
                     );
            break;
         case SCSI_MODE_PAGE_POWER_CONDITION:
            status = sati_mode_select_process_mode_page_power_condition(
                        sequence,
                        scsi_io,
                        ata_io,
                        page_size
                     );
            break;
         default:
            break;
         }
      }
   }
   return status;
}
static SATI_STATUS sati_mode_select_process_mode_page ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , void * ata_io ) { SATI_STATUS status = SATI_FAILURE_CHECK_RESPONSE_DATA ; U8 page_code ; U32 page_size = 0 ; U32 size_of_data_to_be_processed ; U8 page_code_byte ; 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 , & page_code_byte ) ; if ( sequence -> command_specific_data . process_state . mode_pages_size > sequence -> command_specific_data . process_state . size_of_data_processed ) { page_code = page_code_byte & SCSI_MODE_SENSE_PAGE_CODE_ENABLE ; page_size = sati_mode_select_get_mode_page_size ( page_code ) ; size_of_data_to_be_processed = sequence -> command_specific_data . process_state . mode_pages_size - sequence -> command_specific_data . process_state . size_of_data_processed ; if ( page_size == 0 ) { status = SATI_FAILURE_CHECK_RESPONSE_DATA ; } else { switch ( page_code ) { case SCSI_MODE_PAGE_READ_WRITE_ERROR : status = sati_mode_select_process_mode_page_read_write_error_recovery ( sequence , scsi_io , page_size ) ; break ; case SCSI_MODE_PAGE_DISCONNECT_RECONNECT : status = sati_mode_select_process_mode_page_disconnect_reconnect ( & sequence -> command_specific_data . process_state , page_size ) ; break ; case SCSI_MODE_PAGE_CACHING : status = sati_mode_select_process_mode_page_caching ( sequence , scsi_io , ata_io , page_size ) ; break ; case SCSI_MODE_PAGE_CONTROL : status = sati_mode_select_process_mode_page_control ( sequence , scsi_io , ata_io , page_size ) ; break ; case SCSI_MODE_PAGE_INFORMATIONAL_EXCP_CONTROL : status = sati_mode_select_process_mode_page_informational_exception_control ( sequence , scsi_io , ata_io , page_size ) ; break ; case SCSI_MODE_PAGE_POWER_CONDITION : status = sati_mode_select_process_mode_page_power_condition ( sequence , scsi_io , ata_io , page_size ) ; break ; default : break ; } } } return status ; }
@brief This method will process the mode page.
@brief This method will process the mode page .
// in bytes // No more pages. //SCSI_MODE_SENSE_PAGE_CODE_ENABLE==0x3f same for Mode Select // process mode page