2 * This file is provided under a dual BSD/GPLv2 license. When using or
3 * redistributing this file, you may do so under either license.
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of version 2 of the GNU General Public License as
11 * published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
33 * * Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * * Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in
37 * the documentation and/or other materials provided with the
40 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
59 * @brief This file contains all of the interface methods, macros, structures
60 * that can be utilized by a user to perform SCSI-to-ATA Translation.
61 * SATI adheres to the www.t10.org SAT specification.
63 * For specific compliance information please refer to:
64 * - sati_get_sat_compliance_version() and
65 * - sati_get_sat_compliance_version_revision()
67 * For situations where compliance is not observed, the SATI will
68 * return an error indication (most likely INVALID FIELD IN CDB sense).
71 #include <dev/isci/scil/sati_types.h>
72 #include <dev/isci/scil/sati_translator_sequence.h>
75 * @brief This method will be called by the core to indicate the start of a
76 * new translation sequence. Set up the initial sequence state.
80 void sati_sequence_construct(
81 SATI_TRANSLATOR_SEQUENCE_T * sequence
85 * @brief This method will be called by the core to request the current translation
86 * sequence be terminated.
88 * @param[in] sequence This parameter specifies the sequence
89 * data associated with the translation.
90 * @param[in,out] scsi_io This parameter specifies the user's SCSI IO request
91 * object. SATI expects that the user can access the SCSI CDB,
92 * response, and data from this pointer. For example, if there
93 * is a failure in translation resulting in sense data, then
94 * SATI will call sati_cb_set_status() and pass the scsi_io
95 * pointer as a parameter.
96 * @param[out] ata_io This parameter specifies the location of the
97 * ATA register FIS into which the translator can write the
98 * resultant ATA command if translation is successful. This
99 * parameter is passed back to the user through the
100 * SATI_SATA_CALLBACKS when it is necessary to write fields
105 void sati_sequence_terminate(
106 SATI_TRANSLATOR_SEQUENCE_T * sequence,
112 * @brief This method translates the supplied SCSI command into a
113 * corresponding ATA command.
115 * @param[in] sequence This parameter specifies the sequence
116 * data associated with the translation.
117 * @param[in] sati_device This parameter specifies the remote device
118 * for which the translated request is destined.
119 * @param[in,out] scsi_io This parameter specifies the user's SCSI IO request
120 * object. SATI expects that the user can access the SCSI CDB,
121 * response, and data from this pointer. For example, if there
122 * is a failure in translation resulting in sense data, then
123 * SATI will call sati_cb_set_status() and pass the scsi_io
124 * pointer as a parameter.
125 * @param[out] ata_io This parameter specifies the location of the
126 * ATA register FIS into which the translator can write the
127 * resultant ATA command if translation is successful. This
128 * parameter is passed back to the user through the
129 * SATI_SATA_CALLBACKS when it is necessary to write fields
132 * @return Indicate if the translation was successful.
133 * @retval SATI_SUCCESS
134 * @retval SATI_FAILURE_CHECK_RESPONSE_DATA
136 SATI_STATUS sati_translate_command(
137 SATI_TRANSLATOR_SEQUENCE_T * sequence,
138 SATI_DEVICE_T * sati_device,
144 * @brief This method translates the supplied SCSI task management request
145 * into a corresponding ATA command/control FIS.
147 * @param[in] sequence This parameter specifies the sequence
148 * data associated with the translation.
149 * @param[in] sati_device This parameter specifies the remote device
150 * for which the translated request is destined.
151 * @param[in,out] scsi_io This parameter specifies the user's SCSI IO request
152 * object. SATI expects that the user can access the SCSI CDB,
153 * response, and data from this pointer. For example, if there
154 * is a failure in translation resulting in sense data, then
155 * SATI will call sati_cb_set_status() and pass the scsi_io
156 * pointer as a parameter.
157 * @param[out] ata_io This parameter specifies the location of the
158 * ATA register FIS into which the translator can write the
159 * resultant ATA command if translation is successful. This
160 * parameter is passed back to the user through the
161 * SATI_SATA_CALLBACKS when it is necessary to write fields
164 * @return Indicate if the translation was successful.
165 * @retval SATI_SUCCESS
166 * @retval SATI_FAILURE_CHECK_RESPONSE_DATA
168 SATI_STATUS sati_translate_task_management(
169 SATI_TRANSLATOR_SEQUENCE_T * sequence,
170 SATI_DEVICE_T * sati_device,
176 * @brief This method translates the supplied ATA response into the
177 * corresponding SCSI command response.
179 * @param[in] sequence This parameter specifies the sequence
180 * data associated with the translation.
181 * @param[out] scsi_io This parameter specifies the user's SCSI IO request
182 * object. SATI expects that the user can access the SCSI CDB,
183 * response, and data from this pointer. For example, if there
184 * is a failure in translation resulting in sense data, then
185 * SATI will call sati_cb_set_status() and pass the scsi_io
186 * pointer as a parameter.
187 * @param[out] ata_io This parameter specifies the location of the
188 * ATA IO request (e.g. register FIS, PIO Setup etc.) from which
189 * the translator can read the received ATA status and error
192 * @return Indicate if the translation was successful.
193 * @retval SATI_SUCCESS
194 * @retval SATI_FAILURE_CHECK_RESPONSE_DATA
196 SATI_STATUS sati_translate_command_response(
197 SATI_TRANSLATOR_SEQUENCE_T * sequence,
203 * @brief This method translates the supplied ATA response into the
204 * corresponding SCSI task response.
206 * @param[in] sequence This parameter specifies the sequence
207 * data associated with the translation.
208 * @param[out] scsi_io This parameter specifies the user's SCSI IO request
209 * object. SATI expects that the user can access the SCSI CDB,
210 * response, and data from this pointer. For example, if there
211 * is a failure in translation resulting in sense data, then
212 * SATI will call sati_cb_set_status() and pass the scsi_io
213 * pointer as a parameter.
214 * @param[out] ata_io This parameter specifies the location of the
215 * ATA IO request (e.g. register FIS, PIO Setup etc.) from which
216 * the translator can read the received ATA status and error
219 * @return Indicate if the translation was successful.
220 * @retval SATI_FAILURE_CHECK_RESPONSE_DATA
222 SATI_STATUS sati_translate_task_response(
223 SATI_TRANSLATOR_SEQUENCE_T * sequence,
229 * @brief This method simply returns the SAT major compliance version number
230 * for which the implementation is compliant.
232 * @return Return the specification identifier with which this translator
235 U32 sati_get_sat_compliance_version(
240 * @brief This method simply returns the SAT version revision identifier
241 * for which the implementation is compliant.
243 * @return Return the specification revision identifier with which this
244 * translator is compliant.
246 U32 sati_get_sat_compliance_version_revision(
251 * @brief This method returns the number of data bytes written
252 * by the translation sequence.
254 * @param[in] sequence This parameter specifies the sequence data
255 * associated with the translation.
257 * @return Return the U16 number_data_bytes_set in the
258 * SATI_TRANSLATOR_SEQUENCE.
260 U16 sati_get_number_data_bytes_set(
261 SATI_TRANSLATOR_SEQUENCE_T * sequence
264 void sati_translate_error(
265 SATI_TRANSLATOR_SEQUENCE_T * sequence,