FreeBSD/sys/dev/isci/scil/sati_read_capacity.c
/**
 * @brief This method will translate the ATA Identify Device data into
 *        SCSI read capacity 10 data.
 *        For more information on the parameters passed to this method,
 *        please reference sati_translate_data().
 *
 * @return none
 */
@brief This method will translate the ATA Identify Device data into
SCSI read capacity 10 data.
For more information on the parameters passed to this method,
please reference sati_translate_data().

@return none
@brief This method will translate the ATA Identify Device data into SCSI read capacity 10 data . For more information on the parameters passed to this method please reference sati_translate_data () . @return none
void sati_read_capacity_10_translate_data(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * ata_input_data,
   void                       * scsi_io
)
{
   U32  lba_low     = 0;
   U32  lba_high    = 0;
   U32  sector_size = 0;
   sati_ata_identify_device_get_sector_info(
      (ATA_IDENTIFY_DEVICE_DATA_T*)ata_input_data,
      &lba_high,
      &lba_low,
      &sector_size
   );
   if ((lba_low == 0) && (lba_high == 0))
      lba_high -= 1;
   lba_low -= 1;
   if(lba_high != 0)
   {
      sati_set_data_byte(sequence, scsi_io, 0, 0xFF);
      sati_set_data_byte(sequence, scsi_io, 1, 0xFF);
      sati_set_data_byte(sequence, scsi_io, 2, 0xFF);
      sati_set_data_byte(sequence, scsi_io, 3, 0xFF);
   }
   else
   {
      sati_set_data_byte(sequence, scsi_io, 0, (U8)((lba_low >> 24) & 0xFF));
      sati_set_data_byte(sequence, scsi_io, 1, (U8)((lba_low >> 16) & 0xFF));
      sati_set_data_byte(sequence, scsi_io, 2, (U8)((lba_low >> 8)  & 0xFF));
      sati_set_data_byte(sequence, scsi_io, 3, (U8)(lba_low & 0xFF));
   }
   sati_set_data_byte(sequence, scsi_io, 4, (U8)((sector_size >> 24) & 0xFF));
   sati_set_data_byte(sequence, scsi_io, 5, (U8)((sector_size >> 16) & 0xFF));
   sati_set_data_byte(sequence, scsi_io, 6, (U8)((sector_size >> 8)  & 0xFF));
   sati_set_data_byte(sequence, scsi_io, 7, (U8)(sector_size & 0xFF));
}
void sati_read_capacity_10_translate_data ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * ata_input_data , void * scsi_io ) { U32 lba_low = 0 ; U32 lba_high = 0 ; U32 sector_size = 0 ; sati_ata_identify_device_get_sector_info ( ( ATA_IDENTIFY_DEVICE_DATA_T * ) ata_input_data , & lba_high , & lba_low , & sector_size ) ; if ( ( lba_low == 0 ) && ( lba_high == 0 ) ) lba_high -= 1 ; lba_low -= 1 ; if ( lba_high != 0 ) { sati_set_data_byte ( sequence , scsi_io , 0 , 0xFF ) ; sati_set_data_byte ( sequence , scsi_io , 1 , 0xFF ) ; sati_set_data_byte ( sequence , scsi_io , 2 , 0xFF ) ; sati_set_data_byte ( sequence , scsi_io , 3 , 0xFF ) ; } else { sati_set_data_byte ( sequence , scsi_io , 0 , ( U8 ) ( ( lba_low >> 24 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , 1 , ( U8 ) ( ( lba_low >> 16 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , 2 , ( U8 ) ( ( lba_low >> 8 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , 3 , ( U8 ) ( lba_low & 0xFF ) ) ; } sati_set_data_byte ( sequence , scsi_io , 4 , ( U8 ) ( ( sector_size >> 24 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , 5 , ( U8 ) ( ( sector_size >> 16 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , 6 , ( U8 ) ( ( sector_size >> 8 ) & 0xFF ) ) ; sati_set_data_byte ( sequence , scsi_io , 7 , ( U8 ) ( sector_size & 0xFF ) ) ; }
@brief This method will translate the ATA Identify Device data into
        SCSI read capacity 10 data.
@brief This method will translate the ATA Identify Device data into SCSI read capacity 10 data .
// Extract the sector information (sector size, logical blocks) from // the retrieved ATA identify device data. // SATA drives report a value that is one LBA larger than the last LBA. // SCSI wants the last LBA.  Make the correction here.  lba_low is // always decremented since it is an unsigned long the value 0 will // wrap to 0xFFFFFFFF. // Build CDB for Read Capacity 10 // Fill in the Logical Block Address bytes. // Fill in the sector size field.