FreeBSD/sys/dev/isci/scil/sati_mode_sense.c
/**
 * @brief This method will calculate the size of the mode sense data header.
 *        This includes the block descriptor if one is requested.
 *
 * @param[in] scsi_io This parameter specifies the user's SCSI IO object
 *            for which to calculate the mode page header.
 * @param[in] cdb_size This parameter specifies the number of bytes
 *            associated with the CDB for which to calculate the header.
 *
 * @return This method returns the size, in bytes, for the mode page header.
 */
@brief This method will calculate the size of the mode sense data header.
This includes the block descriptor if one is requested.

@param[in] scsi_io This parameter specifies the user's SCSI IO object
for which to calculate the mode page header.
@param[in] cdb_size This parameter specifies the number of bytes
associated with the CDB for which to calculate the header.

@return This method returns the size, in bytes, for the mode page header.
@brief This method will calculate the size of the mode sense data header . This includes the block descriptor if one is requested . @param [ in ] scsi_io This parameter specifies the user ' s SCSI IO object for which to calculate the mode page header . @param [ in ] cdb_size This parameter specifies the number of bytes associated with the CDB for which to calculate the header . @return This method returns the size in bytes for the mode page header .
U16 sati_mode_sense_calculate_page_header(
   void * scsi_io,
   U8     cdb_size
)
{
   U8 * cdb         = sati_cb_get_cdb_address(scsi_io);
   U16  page_length = 0;
   if (cdb_size == 6)
      page_length += SCSI_MODE_SENSE_6_HEADER_LENGTH;
   else
      page_length += SCSI_MODE_SENSE_10_HEADER_LENGTH;
   if ((sati_get_cdb_byte(cdb, 1) & SCSI_MODE_SENSE_DBD_ENABLE) == 0)
   {
      if (  (cdb_size == 10)
         && (sati_get_cdb_byte(cdb, 1) & SCSI_MODE_SENSE_LLBAA_ENABLE) )
         page_length += SCSI_MODE_SENSE_LLBA_BLOCK_DESCRIPTOR_LENGTH;
      else
         page_length += SCSI_MODE_SENSE_STD_BLOCK_DESCRIPTOR_LENGTH;
   }
   return page_length;
}
U16 sati_mode_sense_calculate_page_header ( void * scsi_io , U8 cdb_size ) { U8 * cdb = sati_cb_get_cdb_address ( scsi_io ) ; U16 page_length = 0 ; if ( cdb_size == 6 ) page_length += SCSI_MODE_SENSE_6_HEADER_LENGTH ; else page_length += SCSI_MODE_SENSE_10_HEADER_LENGTH ; if ( ( sati_get_cdb_byte ( cdb , 1 ) & SCSI_MODE_SENSE_DBD_ENABLE ) == 0 ) { if ( ( cdb_size == 10 ) && ( sati_get_cdb_byte ( cdb , 1 ) & SCSI_MODE_SENSE_LLBAA_ENABLE ) ) page_length += SCSI_MODE_SENSE_LLBA_BLOCK_DESCRIPTOR_LENGTH ; else page_length += SCSI_MODE_SENSE_STD_BLOCK_DESCRIPTOR_LENGTH ; } return page_length ; }
@brief This method will calculate the size of the mode sense data header.
@brief This method will calculate the size of the mode sense data header .
// The Mode page header length is different for 6-byte vs. 10-byte CDBs. // Are block descriptors disabled (DBD)?  0 indicates they are enabled. // The LLBAA bit is not defined for 6-byte mode sense requests.