FreeBSD/sys/dev/isci/scil/sati_synchronize_cache.c
/**
 * @brief This method performs the SCSI SYNCHRONIZE_CACHE 10 and 16 command translation
 *        functionality common to all SYNCHRONIZE_CACHE command sizes.
 *        This includes:
 *        - setting the command register
 *        - setting the device head register
 *        - filling in fields in the SATI_TRANSLATOR_SEQUENCE object.
 *        For more information on the parameters passed to this method,
 *        please reference sati_translate_command().
 *
 * @return Indicate if the method was successfully completed.
 * @retval SATI_SUCCESS This is returned in all other cases.
 */
@brief This method performs the SCSI SYNCHRONIZE_CACHE 10 and 16 command translation
functionality common to all SYNCHRONIZE_CACHE command sizes.
This includes:
- setting the command register
- setting the device head register
- filling in fields in the SATI_TRANSLATOR_SEQUENCE object.
For more information on the parameters passed to this method,
please reference sati_translate_command().

@return Indicate if the method was successfully completed.
@retval SATI_SUCCESS This is returned in all other cases.
@brief This method performs the SCSI SYNCHRONIZE_CACHE 10 and 16 command translation functionality common to all SYNCHRONIZE_CACHE command sizes . This includes : - setting the command register - setting the device head register - filling in fields in the SATI_TRANSLATOR_SEQUENCE object . For more information on the parameters passed to this method please reference sati_translate_command () . @return Indicate if the method was successfully completed . @retval SATI_SUCCESS This is returned in all other cases .
SATI_STATUS sati_synchronize_cache_translate_command(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * scsi_io,
   void                       * ata_io
)
{
   U8 * cdb          = sati_cb_get_cdb_address(scsi_io);
   U8 * register_fis = sati_cb_get_h2d_register_fis_address(ata_io);
   sequence->type           = SATI_SEQUENCE_SYNCHRONIZE_CACHE;
   sequence->protocol       = SAT_PROTOCOL_NON_DATA;
   sequence->data_direction = SATI_DATA_DIRECTION_NONE;
   if (sati_get_cdb_byte(cdb, 1) & SCSI_SYNCHRONIZE_CACHE_IMMED_ENABLED)
   {
      ;
   }
   if (sequence->device->capabilities & SATI_DEVICE_CAP_48BIT_ENABLE)
      sati_set_ata_command(register_fis, ATA_FLUSH_CACHE_EXT);
   else
      sati_set_ata_command(register_fis, ATA_FLUSH_CACHE);
   return SATI_SUCCESS;
}
SATI_STATUS sati_synchronize_cache_translate_command ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , void * ata_io ) { U8 * cdb = sati_cb_get_cdb_address ( scsi_io ) ; U8 * register_fis = sati_cb_get_h2d_register_fis_address ( ata_io ) ; sequence -> type = SATI_SEQUENCE_SYNCHRONIZE_CACHE ; sequence -> protocol = SAT_PROTOCOL_NON_DATA ; sequence -> data_direction = SATI_DATA_DIRECTION_NONE ; if ( sati_get_cdb_byte ( cdb , 1 ) & SCSI_SYNCHRONIZE_CACHE_IMMED_ENABLED ) { ; } if ( sequence -> device -> capabilities & SATI_DEVICE_CAP_48BIT_ENABLE ) sati_set_ata_command ( register_fis , ATA_FLUSH_CACHE_EXT ) ; else sati_set_ata_command ( register_fis , ATA_FLUSH_CACHE ) ; return SATI_SUCCESS ; }
@brief This method performs the SCSI SYNCHRONIZE_CACHE 10 and 16 command translation
        functionality common to all SYNCHRONIZE_CACHE command sizes.
@brief This method performs the SCSI SYNCHRONIZE_CACHE 10 and 16 command translation functionality common to all SYNCHRONIZE_CACHE command sizes .
//currently we ignore immed bit. // Ensure the device supports the 48 bit feature set.