FreeBSD/sys/dev/isci/scil/sati_mode_sense_6.c
/**
 * @brief This method builds the mode parameter header for a 6-byte SCSI
 *        mode sense data response.  The parameter header is 4 bytes in
 *        size.
 *        For more information on the parameters passed to this method,
 *        please reference sati_translate_command().
 *
 * @param[in] identify This parameter specifies the ATA remote device's
 *            received IDENTIFY DEVICE data.
 * @param[in] mode_data_length This parameter specifies the amount of data
 *            to be returned as part of this mode sense request.
 *
 * @return This method returns the number of bytes written into the
 *         data buffer.
 */
@brief This method builds the mode parameter header for a 6-byte SCSI
mode sense data response.  The parameter header is 4 bytes in
size.
For more information on the parameters passed to this method,
please reference sati_translate_command().

@param[in] identify This parameter specifies the ATA remote device's
received IDENTIFY DEVICE data.
@param[in] mode_data_length This parameter specifies the amount of data
to be returned as part of this mode sense request.

@return This method returns the number of bytes written into the
data buffer.
@brief This method builds the mode parameter header for a 6 - byte SCSI mode sense data response . The parameter header is 4 bytes in size . For more information on the parameters passed to this method please reference sati_translate_command () . @param [ in ] identify This parameter specifies the ATA remote device ' s received IDENTIFY DEVICE data . @param [ in ] mode_data_length This parameter specifies the amount of data to be returned as part of this mode sense request . @return This method returns the number of bytes written into the data buffer .
static
U32 sati_mode_sense_6_build_header(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * scsi_io,
   ATA_IDENTIFY_DEVICE_DATA_T * identify,
   U8                           mode_data_length
)
{
   U8 * cdb = sati_cb_get_cdb_address(scsi_io);
   sati_set_data_byte(sequence, scsi_io, 0, (U8)mode_data_length-1);
   sati_set_data_byte(sequence, scsi_io, 1, SCSI_MODE_HEADER_MEDIUM_TYPE_SBC);
   if (sequence->device->capabilities & SATI_DEVICE_CAP_DMA_FUA_ENABLE)
      sati_set_data_byte(sequence,scsi_io,2,SCSI_MODE_SENSE_HEADER_FUA_ENABLE);
   else
      sati_set_data_byte(sequence, scsi_io, 2, 0);
   if (sati_get_cdb_byte(cdb, 1) & SCSI_MODE_SENSE_DBD_ENABLE)
      sati_set_data_byte(sequence, scsi_io, 3, 0);
   else
      sati_set_data_byte(
         sequence, scsi_io, 3, SCSI_MODE_SENSE_STD_BLOCK_DESCRIPTOR_LENGTH
      );
   return SCSI_MODE_SENSE_6_HEADER_LENGTH;
}
static U32 sati_mode_sense_6_build_header ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , ATA_IDENTIFY_DEVICE_DATA_T * identify , U8 mode_data_length ) { U8 * cdb = sati_cb_get_cdb_address ( scsi_io ) ; sati_set_data_byte ( sequence , scsi_io , 0 , ( U8 ) mode_data_length - 1 ) ; sati_set_data_byte ( sequence , scsi_io , 1 , SCSI_MODE_HEADER_MEDIUM_TYPE_SBC ) ; if ( sequence -> device -> capabilities & SATI_DEVICE_CAP_DMA_FUA_ENABLE ) sati_set_data_byte ( sequence , scsi_io , 2 , SCSI_MODE_SENSE_HEADER_FUA_ENABLE ) ; else sati_set_data_byte ( sequence , scsi_io , 2 , 0 ) ; if ( sati_get_cdb_byte ( cdb , 1 ) & SCSI_MODE_SENSE_DBD_ENABLE ) sati_set_data_byte ( sequence , scsi_io , 3 , 0 ) ; else sati_set_data_byte ( sequence , scsi_io , 3 , SCSI_MODE_SENSE_STD_BLOCK_DESCRIPTOR_LENGTH ) ; return SCSI_MODE_SENSE_6_HEADER_LENGTH ; }
@brief This method builds the mode parameter header for a 6-byte SCSI
        mode sense data response.
@brief This method builds the mode parameter header for a 6 - byte SCSI mode sense data response .
// Fill in the length of the mode parameter data returned (do not include // the size of the mode data length field in the total). // Medium Type is 0 for SBC devices // Write Protect (WP), Rsvd, DPOFUA, Rsvd // Set the block descriptor length if block descriptors are utilized.