sati_lun_reset.c revision 230843
156746Sroberto/*- 256746Sroberto * This file is provided under a dual BSD/GPLv2 license. When using or 356746Sroberto * redistributing this file, you may do so under either license. 456746Sroberto * 556746Sroberto * GPL LICENSE SUMMARY 656746Sroberto * 756746Sroberto * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 8290001Sglebius * 9290001Sglebius * This program is free software; you can redistribute it and/or modify 10290001Sglebius * it under the terms of version 2 of the GNU General Public License as 11290001Sglebius * published by the Free Software Foundation. 12290001Sglebius * 13290001Sglebius * This program is distributed in the hope that it will be useful, but 1456746Sroberto * WITHOUT ANY WARRANTY; without even the implied warranty of 1556746Sroberto * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1656746Sroberto * General Public License for more details. 1756746Sroberto * 1856746Sroberto * You should have received a copy of the GNU General Public License 1982498Sroberto * along with this program; if not, write to the Free Software 20290001Sglebius * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. 21290001Sglebius * The full GNU General Public License is included in this distribution 22290001Sglebius * in the file called LICENSE.GPL. 23290001Sglebius * 24290001Sglebius * BSD LICENSE 25290001Sglebius * 2656746Sroberto * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved. 27290001Sglebius * All rights reserved. 28290001Sglebius * 29290001Sglebius * Redistribution and use in source and binary forms, with or without 30290001Sglebius * modification, are permitted provided that the following conditions 31290001Sglebius * are met: 32290001Sglebius * 33290001Sglebius * * Redistributions of source code must retain the above copyright 34290001Sglebius * notice, this list of conditions and the following disclaimer. 35290001Sglebius * * Redistributions in binary form must reproduce the above copyright 36290001Sglebius * notice, this list of conditions and the following disclaimer in 37290001Sglebius * the documentation and/or other materials provided with the 38290001Sglebius * distribution. 39290001Sglebius * 40290001Sglebius * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 41290001Sglebius * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 42290001Sglebius * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 43290001Sglebius * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 44290001Sglebius * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 45290001Sglebius * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 46290001Sglebius * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 47290001Sglebius * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 48290001Sglebius * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 49290001Sglebius * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 50290001Sglebius * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 51290001Sglebius */ 52290001Sglebius 5356746Sroberto#include <sys/cdefs.h> 5456746Sroberto__FBSDID("$FreeBSD$"); 5556746Sroberto 5656746Sroberto/** 5756746Sroberto * @file 5856746Sroberto * 5956746Sroberto * @brief This file contains the method implementations required to 60290001Sglebius * translate the SCSI lun reset command. 6156746Sroberto */ 6256746Sroberto 6356746Sroberto#if !defined(DISABLE_SATI_TASK_MANAGEMENT) 6456746Sroberto 65290001Sglebius#include <dev/isci/scil/sati_lun_reset.h> 66290001Sglebius#include <dev/isci/scil/sati_callbacks.h> 67290001Sglebius#include <dev/isci/scil/sati_util.h> 68290001Sglebius#include <dev/isci/scil/intel_ata.h> 69290001Sglebius#include <dev/isci/scil/intel_scsi.h> 7056746Sroberto#include <dev/isci/scil/intel_sat.h> 7156746Sroberto 72290001Sglebius//****************************************************************************** 7356746Sroberto//* P U B L I C M E T H O D S 7456746Sroberto//****************************************************************************** 7556746Sroberto 7656746Sroberto/** 7756746Sroberto * @brief This method will translate the lun reset SCSI task request into an 78290001Sglebius * ATA SOFT RESET command. For more information on the parameters 79290001Sglebius * passed to this method, please reference sati_translate_command(). 8056746Sroberto * 81290001Sglebius * @return Indicate if the command translation succeeded. 82290001Sglebius * @retval SCI_SUCCESS This is returned if the command translation was 83290001Sglebius * successful. 8456746Sroberto * 8556746Sroberto * @note It is up to the user of the sata translator to set the command bit 8656746Sroberto * and clear the control softreset bit and send the second register fis. 8756746Sroberto */ 88290001SglebiusSATI_STATUS sati_lun_reset_translate_command( 89290001Sglebius SATI_TRANSLATOR_SEQUENCE_T * sequence, 90290001Sglebius void * scsi_io, 91290001Sglebius void * ata_io 92290001Sglebius) 93290001Sglebius{ 94290001Sglebius U8* register_fis = sati_cb_get_h2d_register_fis_address(ata_io); 95290001Sglebius 96290001Sglebius sati_set_ata_command(register_fis, ATA_NOP); 97290001Sglebius sati_set_ata_control(register_fis, ATA_CONTROL_REG_SOFT_RESET_BIT); 98290001Sglebius 99290001Sglebius //set all other fields to zero. 10056746Sroberto sati_clear_sata_command_flag(register_fis); 10156746Sroberto sati_set_ata_features(register_fis, 0); 10256746Sroberto sati_set_ata_features_exp(register_fis, 0); 10356746Sroberto sati_set_ata_sector_count(register_fis, 0); 10456746Sroberto sati_set_ata_sector_count_exp(register_fis, 0); 10556746Sroberto sati_set_ata_lba_low(register_fis, 0); 10656746Sroberto sati_set_ata_lba_mid(register_fis, 0); 10756746Sroberto sati_set_ata_lba_high(register_fis, 0); 10856746Sroberto sati_set_ata_lba_low_exp(register_fis, 0); 10956746Sroberto sati_set_ata_lba_mid_exp(register_fis, 0); 11056746Sroberto sati_set_ata_lba_high_exp(register_fis, 0); 11156746Sroberto sati_set_ata_device_head(register_fis, 0); 11256746Sroberto 11356746Sroberto sequence->type = SATI_SEQUENCE_LUN_RESET; 114290001Sglebius sequence->data_direction = SATI_DATA_DIRECTION_NONE; 11556746Sroberto sequence->protocol = SAT_PROTOCOL_SOFT_RESET; 11656746Sroberto sequence->ata_transfer_length = 0; 117290001Sglebius 11856746Sroberto return SATI_SUCCESS; 11956746Sroberto} 12056746Sroberto 12156746Sroberto#endif // !defined(DISABLE_SATI_TASK_MANAGEMENT) 12256746Sroberto 12356746Sroberto