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
39 * * Neither the name of Intel Corporation nor the names of its
40 * contributors may be used to endorse or promote products derived
41 * from this software without specific prior written permission.
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
44 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
45 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
46 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
47 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
48 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
49 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
50 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
51 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
52 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
53 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 #ifndef _SATI_TRANSLATOR_SEQUENCE_H_
57 #define _SATI_TRANSLATOR_SEQUENCE_H_
60 * This file contains all of the defintions for the SATI translator sequence.
61 * A translator sequence is simply a defintion for the various sequences of
62 * commands that occur in this translator.
67 #include "sati_device.h"
70 * enum _SATI_TRANSLATOR_SEQUENCE_TYPE - This enumeration defines the possible
71 * sequence types for the translator.
75 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_BLOCK_DEVICE,
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_ALL_PAGES,
90 SATI_SEQUENCE_MODE_SENSE_10_CACHING,
91 SATI_SEQUENCE_MODE_SENSE_10_INFORMATIONAL_EXCP_CONTROL,
92 SATI_SEQUENCE_MODE_SENSE_10_READ_WRITE_ERROR,
93 SATI_SEQUENCE_MODE_SENSE_10_DISCONNECT_RECONNECT,
94 SATI_SEQUENCE_MODE_SENSE_10_CONTROL,
95 SATI_SEQUENCE_MODE_SENSE_10_ALL_PAGES,
96 SATI_SEQUENCE_MODE_SELECT_MODE_PAGE_CACHING,
97 SATI_SEQUENCE_MODE_SELECT_MODE_POWER_CONDITION,
98 SATI_SEQUENCE_MODE_SELECT_MODE_INFORMATION_EXCEPT_CONTROL,
100 /* Log Sense Sequences */
101 SATI_SEQUENCE_LOG_SENSE_SELF_TEST_LOG_PAGE,
102 SATI_SEQUENCE_LOG_SENSE_EXTENDED_SELF_TEST_LOG_PAGE,
103 SATI_SEQUENCE_LOG_SENSE_SUPPORTED_LOG_PAGE,
104 SATI_SEQUENCE_LOG_SENSE_INFO_EXCEPTION_LOG_PAGE,
106 /* SCSI Block Command (SBC) sequences. */
108 SATI_SEQUENCE_READ_6,
109 SATI_SEQUENCE_READ_10,
110 SATI_SEQUENCE_READ_12,
111 SATI_SEQUENCE_READ_16,
113 SATI_SEQUENCE_READ_CAPACITY_10,
114 SATI_SEQUENCE_READ_CAPACITY_16,
116 SATI_SEQUENCE_SYNCHRONIZE_CACHE,
118 SATI_SEQUENCE_VERIFY_10,
119 SATI_SEQUENCE_VERIFY_12,
120 SATI_SEQUENCE_VERIFY_16,
122 SATI_SEQUENCE_WRITE_6,
123 SATI_SEQUENCE_WRITE_10,
124 SATI_SEQUENCE_WRITE_12,
125 SATI_SEQUENCE_WRITE_16,
127 SATI_SEQUENCE_START_STOP_UNIT,
129 SATI_SEQUENCE_REASSIGN_BLOCKS,
131 /* SCSI Task Requests sequences */
133 SATI_SEQUENCE_LUN_RESET,
135 SATI_SEQUENCE_REQUEST_SENSE_SMART_RETURN_STATUS,
136 SATI_SEQUENCE_REQUEST_SENSE_CHECK_POWER_MODE,
138 SATI_SEQUENCE_WRITE_LONG
142 #define SATI_SEQUENCE_TYPE_READ_MIN SATI_SEQUENCE_READ_6
143 #define SATI_SEQUENCE_TYPE_READ_MAX SATI_SEQUENCE_READ_16
148 * SATI_SEQUENCE_STATES These constants depict the various state values
149 * associated with a translation sequence.
151 #define SATI_SEQUENCE_STATE_INITIAL 0
152 #define SATI_SEQUENCE_STATE_TRANSLATE_DATA 1
153 #define SATI_SEQUENCE_STATE_AWAIT_RESPONSE 2
154 #define SATI_SEQUENCE_STATE_FINAL 3
155 #define SATI_SEQUENCE_STATE_INCOMPLETE 4
160 * SATI_DATA_DIRECTIONS These constants depict the various types of data
161 * directions for a translation sequence. Data can flow in/out (read/write) or
164 #define SATI_DATA_DIRECTION_NONE 0
165 #define SATI_DATA_DIRECTION_IN 1
166 #define SATI_DATA_DIRECTION_OUT 2
169 * struct SATI_MODE_SELECT_PROCESSING_STATE - This structure contains all of
170 * the current processing states for processing mode select 6 and 10
171 * commands' parameter fields.
175 typedef struct SATI_MODE_SELECT_PROCESSING_STATE {
177 u32 mode_page_offset;
179 u32 size_of_data_processed;
180 u32 total_ata_command_sent;
181 u32 ata_command_sent_for_cmp; /* cmp: current mode page */
182 bool current_mode_page_processed;
184 } SATI_MODE_SELECT_PROCESSING_STATE_T;
187 enum SATI_REASSIGN_BLOCKS_ATA_COMMAND_STATUS {
188 SATI_REASSIGN_BLOCKS_READY_TO_SEND,
189 SATI_REASSIGN_BLOCKS_COMMAND_FAIL,
190 SATI_REASSIGN_BLOCKS_COMMAND_SUCCESS,
194 * struct sati_reassign_blocks_processing_state - This structure contains all
195 * of the current processing states for processing reassign block command's
200 struct sati_reassign_blocks_processing_state {
202 u32 block_lists_size;
204 u32 size_of_data_processed;
205 u32 ata_command_sent_for_current_lba;
206 bool current_lba_processed;
207 enum SATI_REASSIGN_BLOCKS_ATA_COMMAND_STATUS ata_command_status;
211 #define SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH 12
214 * struct sati_atapi_data - The SATI_ATAPI_DATA structure is for sati atapi IO
219 struct sati_atapi_data {
220 u8 request_sense_cdb[SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH];
224 * struct sati_translator_sequence - This structure contains all of the
225 * translation information associated with a particular request.
229 struct sati_translator_sequence {
231 * This field contains the sequence type determined by the SATI.
236 * This field indicates the current state for the sequence.
241 * This field indicates the data direction (none, read, or write) for
242 * the translated request.
247 * This field contains the SATA/ATA protocol to be utilized during
253 * This field is utilized for sequences requiring data translation.
254 * It specifies the amount of data requested by the caller from the
255 * operation. It's necessary, because at times the user requests less
256 * data than is available. Thus, we need to avoid overrunning the
259 u32 allocation_length;
262 * This field specifies the amount of data that will actually be
263 * transfered across the wire for this ATA request.
265 u32 ata_transfer_length;
268 * This field specifies the amount of data bytes that have been
269 * set in a translation sequence. It will be incremented every time
270 * a data byte has been set by a sati translation.
272 u16 number_data_bytes_set;
275 * This field indicates whether or not the sense response has been set
276 * by the translation sequence.
278 bool is_sense_response_set;
281 * This field specifies the remote device context for which this
282 * translator sequence is destined.
284 struct sati_device *device;
287 * This field is utilized to provide the translator with memory space
288 * required for translations that utilize multiple requests.
291 u32 translated_command;
292 u32 move_sector_count;
294 struct sati_reassign_blocks_processing_state reassign_blocks_process_state;
295 SATI_MODE_SELECT_PROCESSING_STATE_T process_state;
296 struct sati_atapi_data sati_atapi_data;
297 } command_specific_data;
303 #endif /* _SATI_TRANSLATOR_SEQUENCE_H_ */