FreeBSD/sys/dev/isci/scil/sati_unmap.c
/**
 * @brief This method performs the SCSI Unmap command translation
 *        functionality.
 *        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 Unmap command translation
functionality.
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 Unmap command translation functionality . 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_unmap_construct(
   SATI_TRANSLATOR_SEQUENCE_T * sequence,
   void                       * scsi_io,
   void                       * ata_io,
   U32                          sector_count
)
{
   U8 * h2d_register_fis = sati_cb_get_h2d_register_fis_address(ata_io);
   U8 * d2h_register_fis = sati_cb_get_d2h_register_fis_address(ata_io);
   sati_set_ata_command(h2d_register_fis, ATA_DATA_SET_MANAGEMENT);
   sati_set_ata_features(h2d_register_fis, 0x01);
   sati_set_ata_sector_count(h2d_register_fis, (U8)sector_count);
   sati_set_ata_device_head(h2d_register_fis, ATA_DEV_HEAD_REG_LBA_MODE_ENABLE);
   sati_set_ata_status(d2h_register_fis, 0x00);
   sequence->data_direction                 = SATI_DATA_DIRECTION_OUT;
   sequence->protocol                       = SAT_PROTOCOL_UDMA_DATA_OUT;
   sequence->is_translate_response_required = TRUE;
   ASSERT(sector_count < 0x100);
   return SATI_SUCCESS;
}
SATI_STATUS sati_unmap_construct ( SATI_TRANSLATOR_SEQUENCE_T * sequence , void * scsi_io , void * ata_io , U32 sector_count ) { U8 * h2d_register_fis = sati_cb_get_h2d_register_fis_address ( ata_io ) ; U8 * d2h_register_fis = sati_cb_get_d2h_register_fis_address ( ata_io ) ; sati_set_ata_command ( h2d_register_fis , ATA_DATA_SET_MANAGEMENT ) ; sati_set_ata_features ( h2d_register_fis , 0x01 ) ; sati_set_ata_sector_count ( h2d_register_fis , ( U8 ) sector_count ) ; sati_set_ata_device_head ( h2d_register_fis , ATA_DEV_HEAD_REG_LBA_MODE_ENABLE ) ; sati_set_ata_status ( d2h_register_fis , 0x00 ) ; sequence -> data_direction = SATI_DATA_DIRECTION_OUT ; sequence -> protocol = SAT_PROTOCOL_UDMA_DATA_OUT ; sequence -> is_translate_response_required = TRUE ; ASSERT ( sector_count < 0x100 ) ; return SATI_SUCCESS ; }
@brief This method performs the SCSI Unmap command translation
        functionality.
@brief This method performs the SCSI Unmap command translation functionality .
// Set the completion status since the core will not do that for // the udma fast path. // Set up the direction and protocol for SCIC // The UNMAP translation will always require a callback // on every response so it can free memory if an error // occurs.