FreeBSD/sys/dev/isci/scil/sati_mode_select.c
/**
 * @brief This method will check the validity of parameter data of Control mode
 *            page and further processing the page data if necessary.
 *
 * @param[in] mode_select_process_state This parameter points to the processing state fields
 *            of current mode page.
 * @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 Control mode
page and further processing the page data if necessary.

@param[in] mode_select_process_state This parameter points to the processing state fields
of current mode page.
@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 Control mode page and further processing the page data if necessary . @param [ in ] mode_select_process_state This parameter points to the processing state fields of current mode page . @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_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_0A_LENGTH]={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;
   for(index = 0; index < SCSI_MODE_PAGE_0A_LENGTH; 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_0A_LENGTH - 2)) ||
      ((current_mode_page[2] & SCSI_MODE_SELECT_MODE_PAGE_0A_TST_TMF_RLEC) != 0) ||
      ((current_mode_page[3] & SCSI_MODE_SELECT_MODE_PAGE_0A_MODIFIER) != 0) ||
      ((current_mode_page[4] & SCSI_MODE_SELECT_MODE_PAGE_0A_UA_SWP ) != 0) ||
      ((current_mode_page[5] & SCSI_MODE_SELECT_MODE_PAGE_0A_TAS_AUTO ) != 0 ) )
   {
      return SATI_FAILURE_CHECK_RESPONSE_DATA;
   }
   if ((current_mode_page[2] & SCSI_MODE_SELECT_MODE_PAGE_D_SENSE) != 0)
       sequence->device->descriptor_sense_enable = SCSI_MODE_PAGE_CONTROL_D_SENSE_ENABLE;
   else
       sequence->device->descriptor_sense_enable = SCSI_MODE_PAGE_CONTROL_D_SENSE_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_COMPLETE;
   return status;
}
static SATI_STATUS sati_mode_select_process_mode_page_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_0A_LENGTH ] = { 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 ; for ( index = 0 ; index < SCSI_MODE_PAGE_0A_LENGTH ; 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_0A_LENGTH - 2 ) ) || ( ( current_mode_page [ 2 ] & SCSI_MODE_SELECT_MODE_PAGE_0A_TST_TMF_RLEC ) != 0 ) || ( ( current_mode_page [ 3 ] & SCSI_MODE_SELECT_MODE_PAGE_0A_MODIFIER ) != 0 ) || ( ( current_mode_page [ 4 ] & SCSI_MODE_SELECT_MODE_PAGE_0A_UA_SWP ) != 0 ) || ( ( current_mode_page [ 5 ] & SCSI_MODE_SELECT_MODE_PAGE_0A_TAS_AUTO ) != 0 ) ) { return SATI_FAILURE_CHECK_RESPONSE_DATA ; } if ( ( current_mode_page [ 2 ] & SCSI_MODE_SELECT_MODE_PAGE_D_SENSE ) != 0 ) sequence -> device -> descriptor_sense_enable = SCSI_MODE_PAGE_CONTROL_D_SENSE_ENABLE ; else sequence -> device -> descriptor_sense_enable = SCSI_MODE_PAGE_CONTROL_D_SENSE_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_COMPLETE ; return status ; }
@brief This method will check the validity of parameter data of Control mode
            page and further processing the page data if necessary.
@brief This method will check the validity of parameter data of Control mode page and further processing the page data if necessary .
//SCSI_MODE_PAGE_0A_LENGTH 12 //bit 1 and 2 of byte3 Qerr full task management model etc. then both bits 0 //byte 8 and 9 busy time out period variable if not ffff setable? //check for page data validity //Byte2: 0000???0b  Byte3: Queued Algorithm Modifier should be set to 1 QErr? //Byte4: ??000???   Byte5: ?0???000 // no ata command need to be comfirmed