FreeBSD/sys/dev/isci/scil/sati_util.c
/**
 * @brief This method will construct the descriptors in the user's descriptor
 *           sense data buffer location.
 *
 * @param[in,out] scsi_io This parameter specifies the user's IO request
 *                for which to construct the sense data.
 * @param[in]     sense_data This parameter specifies the user SCSI IO request
 *                for which to set the sense data byte.
 * @param[in]     sense_len This parameter specifies length of the sense data
 *                to be returned by SATI.
 * @param[out]    descriptor_len This parameter returns the length of constructed
 *                descriptor.
 * @param[in]     information_buff This parameter specifies the address for which
 *                to set the information buffer.
 *
 * @return none
 */
@brief This method will construct the descriptors in the user's descriptor
sense data buffer location.

@param[in,out] scsi_io This parameter specifies the user's IO request
for which to construct the sense data.
@param[in]     sense_data This parameter specifies the user SCSI IO request
for which to set the sense data byte.
@param[in]     sense_len This parameter specifies length of the sense data
to be returned by SATI.
@param[out]    descriptor_len This parameter returns the length of constructed
descriptor.
@param[in]     information_buff This parameter specifies the address for which
to set the information buffer.

@return none
@brief This method will construct the descriptors in the user ' s descriptor sense data buffer location . @param [ in out ] scsi_io This parameter specifies the user ' s IO request for which to construct the sense data . @param [ in ] sense_data This parameter specifies the user SCSI IO request for which to set the sense data byte . @param [ in ] sense_len This parameter specifies length of the sense data to be returned by SATI . @param [ out ] descriptor_len This parameter returns the length of constructed descriptor . @param [ in ] information_buff This parameter specifies the address for which to set the information buffer . @return none
static
void sati_scsi_common_descriptors_construct(
    void    * scsi_io,
    U8      * sense_data,
    U32       sense_len,
    U8      * information_buff)
{
    U8 * cdb = sati_cb_get_cdb_address(scsi_io);
    U8 offset = 0;
    switch (sati_get_cdb_byte(cdb, 0))
    {
#if !defined(DISABLE_SATI_WRITE_LONG)
    case SCSI_WRITE_LONG_10:
    case SCSI_WRITE_LONG_16:
        sati_scsi_block_descriptor_construct(
                sense_data + offset,
                sense_len - offset);
        offset += SCSI_BLOCK_DESCRIPTOR_LENGTH;
        sati_scsi_information_descriptor_construct(
                  sense_data + offset,
                  sense_len - offset,
                  information_buff);
        offset += SCSI_INFORMATION_DESCRIPTOR_LENGTH;
        break;
#endif 
#if !defined(DISABLE_SATI_REASSIGN_BLOCKS)
    case SCSI_REASSIGN_BLOCKS:
        sati_scsi_command_specific_descriptor_construct(
          sense_data + offset,
          sense_len - offset,
          NULL);
        offset += SCSI_CMD_SPECIFIC_DESCRIPTOR_LENGTH;
        sati_scsi_information_descriptor_construct(
                  sense_data + offset,
                  sense_len - offset,
                  information_buff);
        offset += SCSI_INFORMATION_DESCRIPTOR_LENGTH;
        break;
#endif 
    case SCSI_READ_6:
    case SCSI_READ_10:
    case SCSI_READ_12:
    case SCSI_READ_16:
    case SCSI_WRITE_6:
    case SCSI_WRITE_10:
    case SCSI_WRITE_12:
    case SCSI_WRITE_16:
#if !defined(DISABLE_SATI_VERIFY)
    case SCSI_VERIFY_10:
    case SCSI_VERIFY_12:
    case SCSI_VERIFY_16:
#endif 
#if    !defined(DISABLE_SATI_WRITE_AND_VERIFY)  \
    && !defined(DISABLE_SATI_VERIFY)            \
    && !defined(DISABLE_SATI_WRITE)
    case SCSI_WRITE_AND_VERIFY_10:
    case SCSI_WRITE_AND_VERIFY_12:
    case SCSI_WRITE_AND_VERIFY_16:
#endif 
        sati_scsi_information_descriptor_construct(
                  sense_data + offset,
                  sense_len - offset,
                  information_buff);
        offset += SCSI_INFORMATION_DESCRIPTOR_LENGTH;
        break;
    }
}
static void sati_scsi_common_descriptors_construct ( void * scsi_io , U8 * sense_data , U32 sense_len , U8 * information_buff ) { U8 * cdb = sati_cb_get_cdb_address ( scsi_io ) ; U8 offset = 0 ; switch ( sati_get_cdb_byte ( cdb , 0 ) ) { #if ! defined ( DISABLE_SATI_WRITE_LONG ) case SCSI_WRITE_LONG_10 : case SCSI_WRITE_LONG_16 : sati_scsi_block_descriptor_construct ( sense_data + offset , sense_len - offset ) ; offset += SCSI_BLOCK_DESCRIPTOR_LENGTH ; sati_scsi_information_descriptor_construct ( sense_data + offset , sense_len - offset , information_buff ) ; offset += SCSI_INFORMATION_DESCRIPTOR_LENGTH ; break ; #endif #if ! defined ( DISABLE_SATI_REASSIGN_BLOCKS ) case SCSI_REASSIGN_BLOCKS : sati_scsi_command_specific_descriptor_construct ( sense_data + offset , sense_len - offset , NULL ) ; offset += SCSI_CMD_SPECIFIC_DESCRIPTOR_LENGTH ; sati_scsi_information_descriptor_construct ( sense_data + offset , sense_len - offset , information_buff ) ; offset += SCSI_INFORMATION_DESCRIPTOR_LENGTH ; break ; #endif case SCSI_READ_6 : case SCSI_READ_10 : case SCSI_READ_12 : case SCSI_READ_16 : case SCSI_WRITE_6 : case SCSI_WRITE_10 : case SCSI_WRITE_12 : case SCSI_WRITE_16 : #if ! defined ( DISABLE_SATI_VERIFY ) case SCSI_VERIFY_10 : case SCSI_VERIFY_12 : case SCSI_VERIFY_16 : #endif #if ! defined ( DISABLE_SATI_WRITE_AND_VERIFY ) && ! defined ( DISABLE_SATI_VERIFY ) && ! defined ( DISABLE_SATI_WRITE ) case SCSI_WRITE_AND_VERIFY_10 : case SCSI_WRITE_AND_VERIFY_12 : case SCSI_WRITE_AND_VERIFY_16 : #endif sati_scsi_information_descriptor_construct ( sense_data + offset , sense_len - offset , information_buff ) ; offset += SCSI_INFORMATION_DESCRIPTOR_LENGTH ; break ; } }
@brief This method will construct the descriptors in the user's descriptor
           sense data buffer location.
@brief This method will construct the descriptors in the user ' s descriptor sense data buffer location .
// !defined(DISABLE_SATI_WRITE_LONG) // !defined(DISABLE_SATI_REASSIGN_BLOCKS) // !defined(DISABLE_SATI_VERIFY) //    !defined(DISABLE_SATI_WRITE_AND_VERIFY) // && !defined(DISABLE_SATI_VERIFY) // && !defined(DISABLE_SATI_WRITE)