FreeBSD/sys/dev/isci/scil/sati_mode_sense.c
/**
 * @brief This method will build the standard block descriptor for a MODE
 *        SENSE 6 or 10 byte request.
 *        For more information on the parameters passed to this method,
 *        please reference sati_translate_command().
 *
 * @param[in] identify This parameter specifies the IDENTIFY DEVICE data
 *            associated with the SCSI IO.
 * @param[in] offset This parameter specifies the offset into the data
 *            buffer at which to build the block descriptor.
 *
 * @return This method returns the size of the block descriptor built.
 */
@brief This method will build the standard block descriptor for a MODE
SENSE 6 or 10 byte request.
For more information on the parameters passed to this method,
please reference sati_translate_command().

@param[in] identify This parameter specifies the IDENTIFY DEVICE data
associated with the SCSI IO.
@param[in] offset This parameter specifies the offset into the data
buffer at which to build the block descriptor.

@return This method returns the size of the block descriptor built.
@brief This method will build the standard block descriptor for a MODE SENSE 6 or 10 byte request . For more information on the parameters passed to this method please reference sati_translate_command () . @param [ in ] identify This parameter specifies the IDENTIFY DEVICE data associated with the SCSI IO . @param [ in ] offset This parameter specifies the offset into the data buffer at which to build the block descriptor . @return This method returns the size of the block descriptor built .
U32 sati_mode_sense_build_std_block_descriptor(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * scsi_io,
   ATA_IDENTIFY_DEVICE_DATA_T * identify,
   U32                          offset
)
{
   U32  lba_low     = 0;
   U32  lba_high    = 0;
   U32  sector_size = 0;
   sati_ata_identify_device_get_sector_info(
      identify, &lba_high, &lba_low, &sector_size
   );
   sati_set_data_byte(sequence, scsi_io, offset,   (U8)((lba_low>>24) & 0xFF));
   sati_set_data_byte(sequence, scsi_io, offset+1, (U8)((lba_low>>16) & 0xFF));
   sati_set_data_byte(sequence, scsi_io, offset+2, (U8)((lba_low>>8)  & 0xFF));
   sati_set_data_byte(sequence, scsi_io, offset+3, (U8)(lba_low & 0xFF));
   sati_set_data_byte(sequence, scsi_io, offset+4, 0);
   sati_set_data_byte(sequence,scsi_io, offset+5, (U8)((sector_size>>16) & 0xFF));
   sati_set_data_byte(sequence,scsi_io, offset+6, (U8)((sector_size>>8)  & 0xFF));
   sati_set_data_byte(sequence,scsi_io, offset+7, (U8)(sector_size & 0xFF));
   return SCSI_MODE_SENSE_STD_BLOCK_DESCRIPTOR_LENGTH;
}
U32 sati_mode_sense_build_std_block_descriptor ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , ATA_IDENTIFY_DEVICE_DATA_T * identify , U32 offset ) { U32 lba_low = 0 ; U32 lba_high = 0 ; U32 sector_size = 0 ; sati_ata_identify_device_get_sector_info ( identify , & lba_high , & lba_low , & sector_size ) ; sati_set_data_byte ( sequence , scsi_io , offset , ( U8 ) ( ( lba_low >> 24 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , offset + 1 , ( U8 ) ( ( lba_low >> 16 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , offset + 2 , ( U8 ) ( ( lba_low >> 8 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , offset + 3 , ( U8 ) ( lba_low & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , offset + 4 , 0 ) ; sati_set_data_byte ( sequence , scsi_io , offset + 5 , ( U8 ) ( ( sector_size >> 16 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , offset + 6 , ( U8 ) ( ( sector_size >> 8 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , offset + 7 , ( U8 ) ( sector_size & 0xFF ) ) ; return SCSI_MODE_SENSE_STD_BLOCK_DESCRIPTOR_LENGTH ; }
@brief This method will build the standard block descriptor for a MODE
        SENSE 6 or 10 byte request.
@brief This method will build the standard block descriptor for a MODE SENSE 6 or 10 byte request .
// Extract the sector information (sector size, logical blocks) from // the retrieved ATA identify device data. // Fill in the 4-byte logical block address field. // Clear the reserved field. // Fill in the three byte Block Length field