FreeBSD/sys/dev/isci/scil/sati_read_capacity.c
/**
 * @brief This method will translate the read capacity 10 SCSI command into
 *        an ATA IDENTIFY DEVICE command.
 *        For more information on the parameters passed to this method,
 *        please reference sati_translate_command().
 *
 * @return Indicate if the command translation succeeded.
 * @retval SCI_SUCCESS This is returned if the command translation was
 *         successful.
 * @retval SATI_FAILURE_CHECK_RESPONSE_DATA This value is returned if the
 *         LBA field is not 0, the PMI bit is not 0.
 */
@brief This method will translate the read capacity 10 SCSI command into
an ATA IDENTIFY DEVICE command.
For more information on the parameters passed to this method,
please reference sati_translate_command().

@return Indicate if the command translation succeeded.
@retval SCI_SUCCESS This is returned if the command translation was
successful.
@retval SATI_FAILURE_CHECK_RESPONSE_DATA This value is returned if the
LBA field is not 0, the PMI bit is not 0.
@brief This method will translate the read capacity 10 SCSI command into an ATA IDENTIFY DEVICE command . For more information on the parameters passed to this method please reference sati_translate_command () . @return Indicate if the command translation succeeded . @retval SCI_SUCCESS This is returned if the command translation was successful . @retval SATI_FAILURE_CHECK_RESPONSE_DATA This value is returned if the LBA field is not 0 the PMI bit is not 0 .
SATI_STATUS sati_read_capacity_10_translate_command(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * scsi_io,
   void                       * ata_io
)
{
   U8 * cdb = sati_cb_get_cdb_address(scsi_io);
   if (
         (
            (sati_get_cdb_byte(cdb, 2) != 0)
         || (sati_get_cdb_byte(cdb, 3) != 0)
         || (sati_get_cdb_byte(cdb, 4) != 0)
         || (sati_get_cdb_byte(cdb, 5) != 0)
         )
         || ((sati_get_cdb_byte(cdb, 8) & SCSI_READ_CAPACITY_PMI_BIT_ENABLE)
              == 1)
      )
   {
      sati_scsi_sense_data_construct(
         sequence,
         scsi_io,
         SCSI_STATUS_CHECK_CONDITION,
         SCSI_SENSE_ILLEGAL_REQUEST,
         SCSI_ASC_INVALID_FIELD_IN_CDB,
         SCSI_ASCQ_INVALID_FIELD_IN_CDB
      );
      return SATI_FAILURE_CHECK_RESPONSE_DATA;
   }
   sequence->allocation_length = SCSI_READ_CAPACITY_10_DATA_LENGTH;
   sequence->type              = SATI_SEQUENCE_READ_CAPACITY_10;
   sati_ata_identify_device_construct(ata_io, sequence);
   return SATI_SUCCESS;
}
SATI_STATUS sati_read_capacity_10_translate_command ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , void * ata_io ) { U8 * cdb = sati_cb_get_cdb_address ( scsi_io ) ; if ( ( ( sati_get_cdb_byte ( cdb , 2 ) != 0 ) || ( sati_get_cdb_byte ( cdb , 3 ) != 0 ) || ( sati_get_cdb_byte ( cdb , 4 ) != 0 ) || ( sati_get_cdb_byte ( cdb , 5 ) != 0 ) ) || ( ( sati_get_cdb_byte ( cdb , 8 ) & SCSI_READ_CAPACITY_PMI_BIT_ENABLE ) == 1 ) ) { sati_scsi_sense_data_construct ( sequence , scsi_io , SCSI_STATUS_CHECK_CONDITION , SCSI_SENSE_ILLEGAL_REQUEST , SCSI_ASC_INVALID_FIELD_IN_CDB , SCSI_ASCQ_INVALID_FIELD_IN_CDB ) ; return SATI_FAILURE_CHECK_RESPONSE_DATA ; } sequence -> allocation_length = SCSI_READ_CAPACITY_10_DATA_LENGTH ; sequence -> type = SATI_SEQUENCE_READ_CAPACITY_10 ; sati_ata_identify_device_construct ( ata_io , sequence ) ; return SATI_SUCCESS ; }
@brief This method will translate the read capacity 10 SCSI command into
        an ATA IDENTIFY DEVICE command.
@brief This method will translate the read capacity 10 SCSI command into an ATA IDENTIFY DEVICE command .
/**
    * SAT dictates:
    * - the LBA field must be 0
    * - the PMI bit must be 0
    */ // The CDB is properly formed.