FreeBSD/sys/dev/isci/scil/sati_mode_select.c
/**
 * @brief This method will retrieve Block Descriptor Length.
 *
 * @param[in] mode_parameters This parameter contains the address to the mode parameters.
 * @param[in] cdb_size This parameter specifies the number of bytes
 *            associated with the CDB for which to process the block descriptor.
 *
 * @return This method returns the size, in bytes, for the mode parameter block descriptor.
 */
@brief This method will retrieve Block Descriptor Length.
@param[in] mode_parameters This parameter contains the address to the mode parameters.
@param[in] cdb_size This parameter specifies the number of bytes
associated with the CDB for which to process the block descriptor.

@return This method returns the size, in bytes, for the mode parameter block descriptor.
@brief This method will retrieve Block Descriptor Length . @param [ in ] mode_parameters This parameter contains the address to the mode parameters . @param [ in ] cdb_size This parameter specifies the number of bytes associated with the CDB for which to process the block descriptor . @return This method returns the size in bytes for the mode parameter block descriptor .
static
U32 sati_mode_select_get_mode_block_descriptor_length(
   U8 * mode_parameters,
   U32  cdb_size
)
{
   U32 mode_block_descriptor_length = 0;
   SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_6_T * mode_parameters_6;
   SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_10_T * mode_parameters_10;
   if(cdb_size == 6)
   {
      mode_parameters_6 = (SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_6_T *) mode_parameters;
      mode_block_descriptor_length = mode_parameters_6->block_descriptor_length;
   }
   else if(cdb_size == 10)
   {
      mode_parameters_10 = (SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_10_T *) mode_parameters;
      mode_block_descriptor_length =(((U16)mode_parameters_10->block_descriptor_length[0]) << 8) +
         mode_parameters_10->block_descriptor_length[1];
   }
   return mode_block_descriptor_length;
}
static U32 sati_mode_select_get_mode_block_descriptor_length ( U8 * mode_parameters , U32 cdb_size ) { U32 mode_block_descriptor_length = 0 ; SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_6_T * mode_parameters_6 ; SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_10_T * mode_parameters_10 ; if ( cdb_size == 6 ) { mode_parameters_6 = ( SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_6_T * ) mode_parameters ; mode_block_descriptor_length = mode_parameters_6 -> block_descriptor_length ; } else if ( cdb_size == 10 ) { mode_parameters_10 = ( SCSI_MODE_SELECT_MODE_PARAMETER_HEADER_10_T * ) mode_parameters ; mode_block_descriptor_length = ( ( ( U16 ) mode_parameters_10 -> block_descriptor_length [ 0 ] ) << 8 ) + mode_parameters_10 -> block_descriptor_length [ 1 ] ; } return mode_block_descriptor_length ; }
@brief This method will retrieve Block Descriptor Length.
@brief This method will retrieve Block Descriptor Length .
//Long LBA bit is the bit0 of the byte //Spec says another way to get the block descriptor length to multiply the block number //   with block length (8 or 16), but we can get it directly.