2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
4 * This file is provided under a dual BSD/GPLv2 license. When using or
5 * redistributing this file, you may do so under either license.
9 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of version 2 of the GNU General Public License as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
23 * The full GNU General Public License is included in this distribution
24 * in the file called LICENSE.GPL.
28 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
29 * All rights reserved.
31 * Redistribution and use in source and binary forms, with or without
32 * modification, are permitted provided that the following conditions
35 * * Redistributions of source code must retain the above copyright
36 * notice, this list of conditions and the following disclaimer.
37 * * Redistributions in binary form must reproduce the above copyright
38 * notice, this list of conditions and the following disclaimer in
39 * the documentation and/or other materials provided with the
42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _SATI_TRANSLATOR_SEQUENCE_H_
57 #define _SATI_TRANSLATOR_SEQUENCE_H_
61 * @brief This file contains all of the defintions for the SATI translator
62 * sequence. A translator sequence is simply a definition for the
63 * various sequences of commands that occur in this translator.
66 #include <dev/isci/scil/sati_device.h>
69 * @enum _SATI_TRANSLATOR_SEQUENCE_TYPE
71 * @brief This enumeration defines the possible sequence types for the
74 typedef enum _SATI_TRANSLATOR_SEQUENCE_TYPE
76 // SCSI Primary Command (SPC) sequences.
77 SATI_SEQUENCE_REPORT_LUNS,
78 SATI_SEQUENCE_TEST_UNIT_READY,
79 SATI_SEQUENCE_INQUIRY_STANDARD,
80 SATI_SEQUENCE_INQUIRY_SUPPORTED_PAGES,
81 SATI_SEQUENCE_INQUIRY_SERIAL_NUMBER,
82 SATI_SEQUENCE_INQUIRY_DEVICE_ID,
83 SATI_SEQUENCE_INQUIRY_ATA_INFORMATION,
84 SATI_SEQUENCE_INQUIRY_BLOCK_DEVICE,
85 SATI_SEQUENCE_INQUIRY_EXECUTE_DEVICE_DIAG,
86 SATI_SEQUENCE_MODE_SENSE_6_CACHING,
87 SATI_SEQUENCE_MODE_SENSE_6_INFORMATIONAL_EXCP_CONTROL,
88 SATI_SEQUENCE_MODE_SENSE_6_READ_WRITE_ERROR,
89 SATI_SEQUENCE_MODE_SENSE_6_DISCONNECT_RECONNECT,
90 SATI_SEQUENCE_MODE_SENSE_6_CONTROL,
91 SATI_SEQUENCE_MODE_SENSE_6_POWER_CONDITION,
92 SATI_SEQUENCE_MODE_SENSE_6_ALL_PAGES,
93 SATI_SEQUENCE_MODE_SENSE_10_CACHING,
94 SATI_SEQUENCE_MODE_SENSE_10_INFORMATIONAL_EXCP_CONTROL,
95 SATI_SEQUENCE_MODE_SENSE_10_READ_WRITE_ERROR,
96 SATI_SEQUENCE_MODE_SENSE_10_DISCONNECT_RECONNECT,
97 SATI_SEQUENCE_MODE_SENSE_10_CONTROL,
98 SATI_SEQUENCE_MODE_SENSE_10_POWER_CONDITION,
99 SATI_SEQUENCE_MODE_SENSE_10_ALL_PAGES,
100 SATI_SEQUENCE_MODE_SELECT_MODE_PAGE_CACHING,
101 SATI_SEQUENCE_MODE_SELECT_MODE_POWER_CONDITION,
102 SATI_SEQUENCE_MODE_SELECT_MODE_INFORMATION_EXCEPT_CONTROL,
104 //Log Sense Sequences
105 SATI_SEQUENCE_LOG_SENSE_SELF_TEST_LOG_PAGE,
106 SATI_SEQUENCE_LOG_SENSE_EXTENDED_SELF_TEST_LOG_PAGE,
107 SATI_SEQUENCE_LOG_SENSE_SUPPORTED_LOG_PAGE,
108 SATI_SEQUENCE_LOG_SENSE_INFO_EXCEPTION_LOG_PAGE,
110 // SCSI Block Command (SBC) sequences.
112 SATI_SEQUENCE_READ_6,
113 SATI_SEQUENCE_READ_10,
114 SATI_SEQUENCE_READ_12,
115 SATI_SEQUENCE_READ_16,
117 SATI_SEQUENCE_READ_CAPACITY_10,
118 SATI_SEQUENCE_READ_CAPACITY_16,
120 SATI_SEQUENCE_SYNCHRONIZE_CACHE,
122 SATI_SEQUENCE_VERIFY_10,
123 SATI_SEQUENCE_VERIFY_12,
124 SATI_SEQUENCE_VERIFY_16,
126 SATI_SEQUENCE_WRITE_6,
127 SATI_SEQUENCE_WRITE_10,
128 SATI_SEQUENCE_WRITE_12,
129 SATI_SEQUENCE_WRITE_16,
131 SATI_SEQUENCE_WRITE_AND_VERIFY,
133 SATI_SEQUENCE_START_STOP_UNIT,
135 SATI_SEQUENCE_REASSIGN_BLOCKS,
137 // SCSI Task Requests sequences
139 SATI_SEQUENCE_LUN_RESET,
140 SATI_SEQUENCE_ABORT_TASK_SET,
142 SATI_SEQUENCE_REQUEST_SENSE_SMART_RETURN_STATUS,
143 SATI_SEQUENCE_REQUEST_SENSE_CHECK_POWER_MODE,
145 SATI_SEQUENCE_WRITE_LONG,
149 SATI_SEQUENCE_ATA_PASSTHROUGH_12,
150 SATI_SEQUENCE_ATA_PASSTHROUGH_16,
152 SATI_SEQUENCE_READ_BUFFER,
153 SATI_SEQUENCE_WRITE_BUFFER,
154 SATI_SEQUENCE_WRITE_BUFFER_MICROCODE
156 } SATI_TRANSLATOR_SEQUENCE_TYPE;
158 #define SATI_SEQUENCE_TYPE_READ_MIN SATI_SEQUENCE_READ_6
159 #define SATI_SEQUENCE_TYPE_READ_MAX SATI_SEQUENCE_READ_16
162 * @name SATI_SEQUENCE_STATES
164 * These constants depict the various state values associated with a
165 * translation sequence.
168 #define SATI_SEQUENCE_STATE_INITIAL 0
169 #define SATI_SEQUENCE_STATE_TRANSLATE_DATA 1
170 #define SATI_SEQUENCE_STATE_AWAIT_RESPONSE 2
171 #define SATI_SEQUENCE_STATE_FINAL 3
172 #define SATI_SEQUENCE_STATE_INCOMPLETE 4
173 #define SATI_SEQUENCE_STATE_READ_ERROR 5
177 * @name SATI_DATA_DIRECTIONS
179 * These constants depict the various types of data directions for a
180 * translation sequence. Data can flow in/out (read/write) or no data at
184 #define SATI_DATA_DIRECTION_NONE 0
185 #define SATI_DATA_DIRECTION_IN 1
186 #define SATI_DATA_DIRECTION_OUT 2
190 * @struct SATI_MODE_SELECT_PROCESSING_STATE
192 * @brief This structure contains all of the current processing states
193 * for processing mode select 6 and 10 commands' parameter fields.
195 typedef struct SATI_MODE_SELECT_PROCESSING_STATE
198 U32 mode_page_offset;
200 U32 size_of_data_processed;
201 U32 total_ata_command_sent;
202 U32 ata_command_sent_for_cmp; // cmp: current mode page
203 BOOL current_mode_page_processed;
205 } SATI_MODE_SELECT_PROCESSING_STATE_T;
208 enum SATI_REASSIGN_BLOCKS_ATA_COMMAND_STATUS
210 SATI_REASSIGN_BLOCKS_READY_TO_SEND,
211 SATI_REASSIGN_BLOCKS_COMMAND_FAIL,
212 SATI_REASSIGN_BLOCKS_COMMAND_SUCCESS,
216 * @struct SATI_REASSIGN_BLOCKS_PROCESSING_STATE
218 * @brief This structure contains all of the current processing states
219 * for processing reassign block command's parameter fields.
221 typedef struct SATI_REASSIGN_BLOCKS_PROCESSING_STATE
224 U32 block_lists_size;
226 U32 size_of_data_processed;
227 U32 ata_command_sent_for_current_lba;
228 BOOL current_lba_processed;
229 enum SATI_REASSIGN_BLOCKS_ATA_COMMAND_STATUS ata_command_status;
231 }SATI_REASSIGN_BLOCKS_PROCESSING_STATE_T;
233 #define SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH 12
236 * @struct SATI_ATAPI_DATA
238 * @brief The SATI_ATAPI_DATA structure is for sati atapi IO specific data.
240 typedef struct SATI_ATAPI_DATA
242 U8 request_sense_cdb[SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH];
246 enum SATI_UNMAP_ATA_COMMAND_STATUS
248 SATI_UNMAP_READY_TO_SEND,
249 SATI_UNMAP_COMMAND_FAIL,
250 SATI_UNMAP_COMMAND_SUCCESS,
254 * @struct SATI_UNMAP_PROCESSING_STATE
256 * @brief This structure contains all of the current processing states
257 * for processing unmap command data translation.
259 typedef struct SATI_UNMAP_PROCESSING_STATE
261 U32 max_unmap_block_descriptors;
262 U32 current_unmap_block_descriptor_index;
263 U32 current_lba_count;
264 SATI_LBA current_lba;
266 U32 max_lba_range_entries;
267 void * current_dsm_descriptor;
268 void * virtual_unmap_buffer;
269 U32 physical_unmap_buffer_low;
270 U32 physical_unmap_buffer_high;
271 void * unmap_buffer_sgl_pair;
272 } SATI_UNMAP_PROCESSING_STATE_T;
275 * @struct SATI_TRANSLATOR_SEQUENCE
277 * @brief This structure contains all of the translation information
278 * associated with a particular request.
280 typedef struct SATI_TRANSLATOR_SEQUENCE
283 * This field contains the sequence type determined by the SATI.
288 * This field indicates the current state for the sequence.
293 * This field indicates the data direction (none, read, or write) for
294 * the translated request.
299 * This field contains the SATA/ATA protocol to be utilized during
305 * This field is utilized for sequences requiring data translation.
306 * It specifies the amount of data requested by the caller from the
307 * operation. It's necessary, because at times the user requests less
308 * data than is available. Thus, we need to avoid overrunning the
311 U32 allocation_length;
314 * This field specifies the amount of data that will actually be
315 * transferred across the wire for this ATA request.
317 U32 ata_transfer_length;
320 * This field specifies the amount of data bytes that have been
321 * set in a translation sequence. It will be incremented every time
322 * a data byte has been set by a sati translation.
324 U16 number_data_bytes_set;
327 * This field indicates whether or not the sense response has been set
328 * by the translation sequence.
330 BOOL is_sense_response_set;
333 * This field indicates whether or not the translation requires
334 * response translation.
336 BOOL is_translate_response_required;
339 * This field specifies the remote device context for which this
340 * translator sequence is destined.
342 SATI_DEVICE_T * device;
345 * This field is utilized to provide the translator with memory space
346 * required for translations that utilize multiple requests.
349 U32 translated_command;
350 U32 move_sector_count;
352 SATI_REASSIGN_BLOCKS_PROCESSING_STATE_T reassign_blocks_process_state;
353 SATI_MODE_SELECT_PROCESSING_STATE_T process_state;
354 SATI_UNMAP_PROCESSING_STATE_T unmap_process_state;
355 SATI_ATAPI_DATA_T sati_atapi_data;
356 } command_specific_data;
358 } SATI_TRANSLATOR_SEQUENCE_T;
362 #endif // _SATI_TRANSLATOR_SEQUENCE_H_