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.
54 #ifndef _SATI_TRANSLATOR_SEQUENCE_H_
55 #define _SATI_TRANSLATOR_SEQUENCE_H_
59 * @brief This file contains all of the defintions for the SATI translator
60 * sequence. A translator sequence is simply a defintion for the
61 * various sequences of commands that occur in this translator.
64 #include <dev/isci/scil/sati_device.h>
67 * @enum _SATI_TRANSLATOR_SEQUENCE_TYPE
69 * @brief This enumeration defines the possible sequence types for the
72 typedef enum _SATI_TRANSLATOR_SEQUENCE_TYPE
74 // SCSI Primary Command (SPC) sequences.
75 SATI_SEQUENCE_REPORT_LUNS,
76 SATI_SEQUENCE_TEST_UNIT_READY,
77 SATI_SEQUENCE_INQUIRY_STANDARD,
78 SATI_SEQUENCE_INQUIRY_SUPPORTED_PAGES,
79 SATI_SEQUENCE_INQUIRY_SERIAL_NUMBER,
80 SATI_SEQUENCE_INQUIRY_DEVICE_ID,
81 SATI_SEQUENCE_INQUIRY_ATA_INFORMATION,
82 SATI_SEQUENCE_INQUIRY_BLOCK_DEVICE,
83 SATI_SEQUENCE_INQUIRY_EXECUTE_DEVICE_DIAG,
84 SATI_SEQUENCE_MODE_SENSE_6_CACHING,
85 SATI_SEQUENCE_MODE_SENSE_6_INFORMATIONAL_EXCP_CONTROL,
86 SATI_SEQUENCE_MODE_SENSE_6_READ_WRITE_ERROR,
87 SATI_SEQUENCE_MODE_SENSE_6_DISCONNECT_RECONNECT,
88 SATI_SEQUENCE_MODE_SENSE_6_CONTROL,
89 SATI_SEQUENCE_MODE_SENSE_6_POWER_CONDITION,
90 SATI_SEQUENCE_MODE_SENSE_6_ALL_PAGES,
91 SATI_SEQUENCE_MODE_SENSE_10_CACHING,
92 SATI_SEQUENCE_MODE_SENSE_10_INFORMATIONAL_EXCP_CONTROL,
93 SATI_SEQUENCE_MODE_SENSE_10_READ_WRITE_ERROR,
94 SATI_SEQUENCE_MODE_SENSE_10_DISCONNECT_RECONNECT,
95 SATI_SEQUENCE_MODE_SENSE_10_CONTROL,
96 SATI_SEQUENCE_MODE_SENSE_10_POWER_CONDITION,
97 SATI_SEQUENCE_MODE_SENSE_10_ALL_PAGES,
98 SATI_SEQUENCE_MODE_SELECT_MODE_PAGE_CACHING,
99 SATI_SEQUENCE_MODE_SELECT_MODE_POWER_CONDITION,
100 SATI_SEQUENCE_MODE_SELECT_MODE_INFORMATION_EXCEPT_CONTROL,
102 //Log Sense Sequences
103 SATI_SEQUENCE_LOG_SENSE_SELF_TEST_LOG_PAGE,
104 SATI_SEQUENCE_LOG_SENSE_EXTENDED_SELF_TEST_LOG_PAGE,
105 SATI_SEQUENCE_LOG_SENSE_SUPPORTED_LOG_PAGE,
106 SATI_SEQUENCE_LOG_SENSE_INFO_EXCEPTION_LOG_PAGE,
108 // SCSI Block Command (SBC) sequences.
110 SATI_SEQUENCE_READ_6,
111 SATI_SEQUENCE_READ_10,
112 SATI_SEQUENCE_READ_12,
113 SATI_SEQUENCE_READ_16,
115 SATI_SEQUENCE_READ_CAPACITY_10,
116 SATI_SEQUENCE_READ_CAPACITY_16,
118 SATI_SEQUENCE_SYNCHRONIZE_CACHE,
120 SATI_SEQUENCE_VERIFY_10,
121 SATI_SEQUENCE_VERIFY_12,
122 SATI_SEQUENCE_VERIFY_16,
124 SATI_SEQUENCE_WRITE_6,
125 SATI_SEQUENCE_WRITE_10,
126 SATI_SEQUENCE_WRITE_12,
127 SATI_SEQUENCE_WRITE_16,
129 SATI_SEQUENCE_WRITE_AND_VERIFY,
131 SATI_SEQUENCE_START_STOP_UNIT,
133 SATI_SEQUENCE_REASSIGN_BLOCKS,
135 // SCSI Task Requests sequences
137 SATI_SEQUENCE_LUN_RESET,
138 SATI_SEQUENCE_ABORT_TASK_SET,
140 SATI_SEQUENCE_REQUEST_SENSE_SMART_RETURN_STATUS,
141 SATI_SEQUENCE_REQUEST_SENSE_CHECK_POWER_MODE,
143 SATI_SEQUENCE_WRITE_LONG,
147 SATI_SEQUENCE_ATA_PASSTHROUGH_12,
148 SATI_SEQUENCE_ATA_PASSTHROUGH_16,
150 SATI_SEQUENCE_READ_BUFFER,
151 SATI_SEQUENCE_WRITE_BUFFER,
152 SATI_SEQUENCE_WRITE_BUFFER_MICROCODE
154 } SATI_TRANSLATOR_SEQUENCE_TYPE;
156 #define SATI_SEQUENCE_TYPE_READ_MIN SATI_SEQUENCE_READ_6
157 #define SATI_SEQUENCE_TYPE_READ_MAX SATI_SEQUENCE_READ_16
160 * @name SATI_SEQUENCE_STATES
162 * These constants depict the various state values associated with a
163 * translation sequence.
166 #define SATI_SEQUENCE_STATE_INITIAL 0
167 #define SATI_SEQUENCE_STATE_TRANSLATE_DATA 1
168 #define SATI_SEQUENCE_STATE_AWAIT_RESPONSE 2
169 #define SATI_SEQUENCE_STATE_FINAL 3
170 #define SATI_SEQUENCE_STATE_INCOMPLETE 4
171 #define SATI_SEQUENCE_STATE_READ_ERROR 5
175 * @name SATI_DATA_DIRECTIONS
177 * These constants depict the various types of data directions for a
178 * translation sequence. Data can flow in/out (read/write) or no data at
182 #define SATI_DATA_DIRECTION_NONE 0
183 #define SATI_DATA_DIRECTION_IN 1
184 #define SATI_DATA_DIRECTION_OUT 2
188 * @struct SATI_MODE_SELECT_PROCESSING_STATE
190 * @brief This structure contains all of the current processing states
191 * for processing mode select 6 and 10 commands' parameter fields.
193 typedef struct SATI_MODE_SELECT_PROCESSING_STATE
196 U32 mode_page_offset;
198 U32 size_of_data_processed;
199 U32 total_ata_command_sent;
200 U32 ata_command_sent_for_cmp; // cmp: current mode page
201 BOOL current_mode_page_processed;
203 } SATI_MODE_SELECT_PROCESSING_STATE_T;
206 enum SATI_REASSIGN_BLOCKS_ATA_COMMAND_STATUS
208 SATI_REASSIGN_BLOCKS_READY_TO_SEND,
209 SATI_REASSIGN_BLOCKS_COMMAND_FAIL,
210 SATI_REASSIGN_BLOCKS_COMMAND_SUCCESS,
214 * @struct SATI_REASSIGN_BLOCKS_PROCESSING_STATE
216 * @brief This structure contains all of the current processing states
217 * for processing reassign block command's parameter fields.
219 typedef struct SATI_REASSIGN_BLOCKS_PROCESSING_STATE
222 U32 block_lists_size;
224 U32 size_of_data_processed;
225 U32 ata_command_sent_for_current_lba;
226 BOOL current_lba_processed;
227 enum SATI_REASSIGN_BLOCKS_ATA_COMMAND_STATUS ata_command_status;
229 }SATI_REASSIGN_BLOCKS_PROCESSING_STATE_T;
231 #define SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH 12
234 * @struct SATI_ATAPI_DATA
236 * @brief The SATI_ATAPI_DATA structure is for sati atapi IO specific data.
238 typedef struct SATI_ATAPI_DATA
240 U8 request_sense_cdb[SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH];
244 enum SATI_UNMAP_ATA_COMMAND_STATUS
246 SATI_UNMAP_READY_TO_SEND,
247 SATI_UNMAP_COMMAND_FAIL,
248 SATI_UNMAP_COMMAND_SUCCESS,
252 * @struct SATI_UNMAP_PROCESSING_STATE
254 * @brief This structure contains all of the current processing states
255 * for processing unmap command data translation.
257 typedef struct SATI_UNMAP_PROCESSING_STATE
259 U32 max_unmap_block_descriptors;
260 U32 current_unmap_block_descriptor_index;
261 U32 current_lba_count;
262 SATI_LBA current_lba;
264 U32 max_lba_range_entries;
265 void * current_dsm_descriptor;
266 void * virtual_unmap_buffer;
267 U32 physical_unmap_buffer_low;
268 U32 physical_unmap_buffer_high;
269 void * unmap_buffer_sgl_pair;
270 } SATI_UNMAP_PROCESSING_STATE_T;
273 * @struct SATI_TRANSLATOR_SEQUENCE
275 * @brief This structure contains all of the translation information
276 * associated with a particular request.
278 typedef struct SATI_TRANSLATOR_SEQUENCE
281 * This field contains the sequence type determined by the SATI.
286 * This field indicates the current state for the sequence.
291 * This field indicates the data direction (none, read, or write) for
292 * the translated request.
297 * This field contains the SATA/ATA protocol to be utilized during
303 * This field is utilized for sequences requiring data translation.
304 * It specifies the amount of data requested by the caller from the
305 * operation. It's necessary, because at times the user requests less
306 * data than is available. Thus, we need to avoid overrunning the
309 U32 allocation_length;
312 * This field specifies the amount of data that will actually be
313 * transfered across the wire for this ATA request.
315 U32 ata_transfer_length;
318 * This field specifies the amount of data bytes that have been
319 * set in a translation sequence. It will be incremented every time
320 * a data byte has been set by a sati translation.
322 U16 number_data_bytes_set;
325 * This field indicates whether or not the sense response has been set
326 * by the translation sequence.
328 BOOL is_sense_response_set;
331 * This field indicates whether or not the translation requires
332 * response translation.
334 BOOL is_translate_response_required;
337 * This field specifies the remote device context for which this
338 * translator sequence is destined.
340 SATI_DEVICE_T * device;
343 * This field is utilized to provide the translator with memory space
344 * required for translations that utilize multiple requests.
347 U32 translated_command;
348 U32 move_sector_count;
350 SATI_REASSIGN_BLOCKS_PROCESSING_STATE_T reassign_blocks_process_state;
351 SATI_MODE_SELECT_PROCESSING_STATE_T process_state;
352 SATI_UNMAP_PROCESSING_STATE_T unmap_process_state;
353 SATI_ATAPI_DATA_T sati_atapi_data;
354 } command_specific_data;
356 } SATI_TRANSLATOR_SEQUENCE_T;
360 #endif // _SATI_TRANSLATOR_SEQUENCE_H_