aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2011-04-26 15:31:37 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:00:38 -0400
commit3d6e428c0cd8d234bab0ac93aff9ccffacc8bc7e (patch)
tree7184ff4ef4e5420e1f8bd06ec6676c59c9dd6ba5 /drivers
parent1f4fa1f958ca678ea021b95c2799b018b2cebc9c (diff)
isci: removing non-working ATAPI code
Removing not used / bit-rotten ATAPI code. This needs to go back and debugged at a later date. Signed-off-by: Dave Jiang <dave.jiang@intel.com> [reflow against devel, delete dead sati headers] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/Makefile4
-rw-r--r--drivers/scsi/isci/core/sati_device.h156
-rw-r--r--drivers/scsi/isci/core/sati_translator_sequence.h304
-rw-r--r--drivers/scsi/isci/core/sati_types.h145
-rw-r--r--drivers/scsi/isci/core/scic_sds_request.c14
-rw-r--r--drivers/scsi/isci/core/scic_sds_stp_packet_request.c805
-rw-r--r--drivers/scsi/isci/core/scic_sds_stp_packet_request.h39
-rw-r--r--drivers/scsi/isci/remote_device.c60
-rw-r--r--drivers/scsi/isci/remote_device.h38
-rw-r--r--drivers/scsi/isci/stp_remote_device.c94
10 files changed, 0 insertions, 1659 deletions
diff --git a/drivers/scsi/isci/Makefile b/drivers/scsi/isci/Makefile
index ccc8c53f501d..fc50ba34b13d 100644
--- a/drivers/scsi/isci/Makefile
+++ b/drivers/scsi/isci/Makefile
@@ -2,9 +2,6 @@
2#generation of silicon 2#generation of silicon
3EXTRA_CFLAGS += -DSCIC_SDS_4_ENABLED 3EXTRA_CFLAGS += -DSCIC_SDS_4_ENABLED
4 4
5#temporary until atapi support ready
6EXTRA_CFLAGS += -DDISABLE_ATAPI
7
8EXTRA_CFLAGS += -Idrivers/scsi/isci/core/ -Idrivers/scsi/isci/ 5EXTRA_CFLAGS += -Idrivers/scsi/isci/core/ -Idrivers/scsi/isci/
9obj-$(CONFIG_SCSI_ISCI) += isci.o 6obj-$(CONFIG_SCSI_ISCI) += isci.o
10isci-objs := init.o phy.o request.o sata.o \ 7isci-objs := init.o phy.o request.o sata.o \
@@ -17,7 +14,6 @@ isci-objs := init.o phy.o request.o sata.o \
17 core/scic_sds_controller.o \ 14 core/scic_sds_controller.o \
18 core/scic_sds_request.o \ 15 core/scic_sds_request.o \
19 core/scic_sds_stp_request.o \ 16 core/scic_sds_stp_request.o \
20 core/scic_sds_stp_packet_request.o \
21 core/scic_sds_port.o \ 17 core/scic_sds_port.o \
22 core/scic_sds_port_configuration_agent.o \ 18 core/scic_sds_port_configuration_agent.o \
23 core/scic_sds_phy.o \ 19 core/scic_sds_phy.o \
diff --git a/drivers/scsi/isci/core/sati_device.h b/drivers/scsi/isci/core/sati_device.h
deleted file mode 100644
index 4d1cfde12cae..000000000000
--- a/drivers/scsi/isci/core/sati_device.h
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
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.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *
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.
12 *
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.
17 *
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.
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
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
38 * distribution.
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.
42 *
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.
54 */
55
56#ifndef _SATI_DEVICE_H_
57#define _SATI_DEVICE_H_
58
59/**
60 * This file contains all of the defintions for the SATI remote device object.
61 * Some translations require information to be remembered on a per device
62 * basis. This information is stored in the object defined in this file.
63 *
64 *
65 */
66
67#include "sati_types.h"
68#include "intel_ata.h"
69
70/**
71 * enum _SATI_DEVICE_STATE - This enumeration depicts the various states
72 * possible for the a translation remote device object.
73 *
74 *
75 */
76enum sati_device_state {
77 SATI_DEVICE_STATE_OPERATIONAL,
78 SATI_DEVICE_STATE_STOPPED,
79 SATI_DEVICE_STATE_STANDBY,
80 SATI_DEVICE_STATE_IDLE,
81 SATI_DEVICE_STATE_DEVICE_FAULT_OCCURRED,
82 SATI_DEVICE_STATE_FORMAT_UNIT_IN_PROGRESS,
83 SATI_DEVICE_STATE_SELF_TEST_IN_PROGRESS,
84 SATI_DEVICE_STATE_SEQUENCE_INCOMPLETE,
85 SATI_DEVICE_STATE_UNIT_ATTENTION_CONDITION
86
87};
88
89/**
90 *
91 *
92 * SATI_DEVICE_CAPABILITIES These constants define the various capabilities
93 * that a remote device may support for which there is an impact on translation.
94 */
95#define SATI_DEVICE_CAP_UDMA_ENABLE 0x00000001
96#define SATI_DEVICE_CAP_NCQ_REQUESTED_ENABLE 0x00000002
97#define SATI_DEVICE_CAP_NCQ_SUPPORTED_ENABLE 0x00000004
98#define SATI_DEVICE_CAP_48BIT_ENABLE 0x00000008
99#define SATI_DEVICE_CAP_DMA_FUA_ENABLE 0x00000010
100#define SATI_DEVICE_CAP_SMART_SUPPORT 0x00000020
101#define SATI_DEVICE_CAP_REMOVABLE_MEDIA 0x00000040
102#define SATI_DEVICE_CAP_SMART_ENABLE 0x00000080
103#define SATI_DEVICE_CAP_WRITE_UNCORRECTABLE_ENABLE 0x00000100
104#define SATI_DEVICE_CAP_MULTIPLE_SECTORS_PER_PHYSCIAL_SECTOR 0x00000200
105#define SATI_DEVICE_CAP_SMART_SELF_TEST_SUPPORT 0x00000400
106
107
108/**
109 * struct sati_device - The SATI_DEVICE structure define the state of the
110 * remote device with respect to translation.
111 *
112 *
113 */
114struct sati_device {
115 /**
116 * This field simply dictates the state of the SATI device.
117 */
118 enum sati_device_state state;
119
120 /**
121 * This field indicates features supported by the remote device that
122 * impact translation execution.
123 */
124 u16 capabilities;
125
126 /**
127 * This field indicates the depth of the native command queue supported
128 * by the device.
129 */
130 u8 ncq_depth;
131
132 /**
133 * This field stores the additional sense code for a unit attention
134 * condition.
135 */
136 u8 unit_attention_asc;
137
138 /**
139 * This field indicates the additional sense code qualifier for a unit
140 * attention condition.
141 */
142 u8 unit_attention_ascq;
143
144};
145
146void sati_device_construct(
147 struct sati_device *device,
148 bool is_ncq_enabled,
149 u8 max_ncq_depth);
150
151void sati_device_update_capabilities(
152 struct sati_device *device,
153 struct ata_identify_device_data *identify);
154
155#endif /* _SATI_TRANSLATOR_SEQUENCE_H_ */
156
diff --git a/drivers/scsi/isci/core/sati_translator_sequence.h b/drivers/scsi/isci/core/sati_translator_sequence.h
deleted file mode 100644
index 915724c380d9..000000000000
--- a/drivers/scsi/isci/core/sati_translator_sequence.h
+++ /dev/null
@@ -1,304 +0,0 @@
1/*
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.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *
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.
12 *
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.
17 *
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.
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
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
38 * distribution.
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.
42 *
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.
54 */
55
56#ifndef _SATI_TRANSLATOR_SEQUENCE_H_
57#define _SATI_TRANSLATOR_SEQUENCE_H_
58
59/**
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.
63 *
64 *
65 */
66
67#include "sati_device.h"
68
69/**
70 * enum _sati_translator_sequence_type - This enumeration defines the possible
71 * sequence types for the translator.
72 *
73 *
74 */
75enum 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,
99
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,
105
106 /* SCSI Block Command (SBC) sequences. */
107
108 SATI_SEQUENCE_READ_6,
109 SATI_SEQUENCE_READ_10,
110 SATI_SEQUENCE_READ_12,
111 SATI_SEQUENCE_READ_16,
112
113 SATI_SEQUENCE_READ_CAPACITY_10,
114 SATI_SEQUENCE_READ_CAPACITY_16,
115
116 SATI_SEQUENCE_SYNCHRONIZE_CACHE,
117
118 SATI_SEQUENCE_VERIFY_10,
119 SATI_SEQUENCE_VERIFY_12,
120 SATI_SEQUENCE_VERIFY_16,
121
122 SATI_SEQUENCE_WRITE_6,
123 SATI_SEQUENCE_WRITE_10,
124 SATI_SEQUENCE_WRITE_12,
125 SATI_SEQUENCE_WRITE_16,
126
127 SATI_SEQUENCE_START_STOP_UNIT,
128
129 SATI_SEQUENCE_REASSIGN_BLOCKS,
130
131 /* SCSI Task Requests sequences */
132
133 SATI_SEQUENCE_LUN_RESET,
134
135 SATI_SEQUENCE_REQUEST_SENSE_SMART_RETURN_STATUS,
136 SATI_SEQUENCE_REQUEST_SENSE_CHECK_POWER_MODE,
137
138 SATI_SEQUENCE_WRITE_LONG
139
140};
141
142#define SATI_SEQUENCE_TYPE_READ_MIN SATI_SEQUENCE_READ_6
143#define SATI_SEQUENCE_TYPE_READ_MAX SATI_SEQUENCE_READ_16
144
145/**
146 *
147 *
148 * SATI_SEQUENCE_STATES These constants depict the various state values
149 * associated with a translation sequence.
150 */
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
156
157/**
158 *
159 *
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
162 * no data at all.
163 */
164#define SATI_DATA_DIRECTION_NONE 0
165#define SATI_DATA_DIRECTION_IN 1
166#define SATI_DATA_DIRECTION_OUT 2
167
168/**
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.
172 *
173 *
174 */
175struct sati_mode_select_processing_state {
176 u8 *mode_pages;
177 u32 mode_page_offset;
178 u32 mode_pages_size;
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;
183};
184
185
186enum sati_reassign_blocks_ata_command_status {
187 SATI_REASSIGN_BLOCKS_READY_TO_SEND,
188 SATI_REASSIGN_BLOCKS_COMMAND_FAIL,
189 SATI_REASSIGN_BLOCKS_COMMAND_SUCCESS,
190};
191
192/**
193 * struct sati_reassign_blocks_processing_state - This structure contains all
194 * of the current processing states for processing reassign block command's
195 * parameter fields.
196 *
197 *
198 */
199struct sati_reassign_blocks_processing_state {
200 u32 lba_offset;
201 u32 block_lists_size;
202 u8 lba_size;
203 u32 size_of_data_processed;
204 u32 ata_command_sent_for_current_lba;
205 bool current_lba_processed;
206 enum sati_reassign_blocks_ata_command_status ata_command_status;
207
208};
209
210#define SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH 12
211
212/**
213 * struct sati_atapi_data - The SATI_ATAPI_DATA structure is for sati atapi IO
214 * specific data.
215 *
216 *
217 */
218struct sati_atapi_data {
219 u8 request_sense_cdb[SATI_ATAPI_REQUEST_SENSE_CDB_LENGTH];
220};
221
222/**
223 * struct sati_translator_sequence - This structure contains all of the
224 * translation information associated with a particular request.
225 *
226 *
227 */
228struct sati_translator_sequence {
229 /**
230 * This field contains the sequence type determined by the SATI.
231 */
232 u8 type;
233
234 /**
235 * This field indicates the current state for the sequence.
236 */
237 u8 state;
238
239 /**
240 * This field indicates the data direction (none, read, or write) for
241 * the translated request.
242 */
243 u8 data_direction;
244
245 /**
246 * This field contains the SATA/ATA protocol to be utilized during
247 * the IO transfer.
248 */
249 u8 protocol;
250
251 /**
252 * This field is utilized for sequences requiring data translation.
253 * It specifies the amount of data requested by the caller from the
254 * operation. It's necessary, because at times the user requests less
255 * data than is available. Thus, we need to avoid overrunning the
256 * buffer.
257 */
258 u32 allocation_length;
259
260 /**
261 * This field specifies the amount of data that will actually be
262 * transfered across the wire for this ATA request.
263 */
264 u32 ata_transfer_length;
265
266 /**
267 * This field specifies the amount of data bytes that have been
268 * set in a translation sequence. It will be incremented every time
269 * a data byte has been set by a sati translation.
270 */
271 u16 number_data_bytes_set;
272
273 /**
274 * This field indicates whether or not the sense response has been set
275 * by the translation sequence.
276 */
277 bool is_sense_response_set;
278
279 /**
280 * This field specifies the remote device context for which this
281 * translator sequence is destined.
282 */
283 struct sati_device *device;
284
285 /**
286 * This field is utilized to provide the translator with memory space
287 * required for translations that utilize multiple requests.
288 */
289 union {
290 u32 translated_command;
291 u32 move_sector_count;
292 u32 scratch;
293 struct sati_reassign_blocks_processing_state
294 reassign_blocks_process_state;
295 struct sati_mode_select_processing_state process_state;
296 struct sati_atapi_data sati_atapi_data;
297 } command_specific_data;
298
299};
300
301
302
303#endif /* _SATI_TRANSLATOR_SEQUENCE_H_ */
304
diff --git a/drivers/scsi/isci/core/sati_types.h b/drivers/scsi/isci/core/sati_types.h
deleted file mode 100644
index b6159e06c280..000000000000
--- a/drivers/scsi/isci/core/sati_types.h
+++ /dev/null
@@ -1,145 +0,0 @@
1/*
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.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *
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.
12 *
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.
17 *
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.
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
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
38 * distribution.
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.
42 *
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.
54 */
55
56#ifndef _SATI_TYPES_H_
57#define _SATI_TYPES_H_
58
59/**
60 * This file contains various type definitions to be utilized with SCSI to ATA
61 * Translation Implementation.
62 *
63 *
64 */
65
66/**
67 * enum _SATI_STATUS - This enumeration defines the possible return values from
68 * the SATI translation methods.
69 *
70 *
71 */
72enum sati_status {
73 /**
74 * This indicates that the translation was supported and occurred
75 * without error.
76 */
77 SATI_SUCCESS,
78
79 /**
80 * This indicates that the translation was supported, occurred without
81 * error, and no additional translation is necessary. This is done in
82 * conditions where the SCSI command doesn't require any interaction with
83 * the remote device.
84 */
85 SATI_COMPLETE,
86
87 /**
88 * This indicated everything SATI_COMPLETE does in addition to the response data
89 * not using all the memory allocated by the OS.
90 */
91 SATI_COMPLETE_IO_DONE_EARLY,
92
93 /**
94 * This indicates that translator sequence has finished some specific
95 * command in the sequence, but additional commands are necessary.
96 */
97 SATI_SEQUENCE_INCOMPLETE,
98
99 /**
100 * This indicates a general failure has occurred for which no further
101 * specification information is available.
102 */
103 SATI_FAILURE,
104
105 /**
106 * This indicates that the result of the IO request indicates a
107 * failure. The caller should reference the corresponding response
108 * data for further details.
109 */
110 SATI_FAILURE_CHECK_RESPONSE_DATA,
111
112 /**
113 * This status indicates that the supplied sequence type doesn't map
114 * to an existing definition.
115 */
116 SATI_FAILURE_INVALID_SEQUENCE_TYPE,
117
118 /**
119 * This status indicates that the supplied sequence state doesn't match
120 * the operation being requested by the user.
121 */
122 SATI_FAILURE_INVALID_STATE
123
124};
125
126#if (!defined(DISABLE_SATI_MODE_SENSE) \
127 || !defined(DISABLE_SATI_MODE_SELECT) \
128 || !defined(DISABLE_SATI_REQUEST_SENSE)) \
129
130#if !defined(ENABLE_SATI_MODE_PAGES)
131/**
132 *
133 *
134 * This macro enables the common mode page data structures and code. Currently,
135 * MODE SENSE, MODE SELECT, and REQUEST SENSE all make reference to this common
136 * code. As a result, enable the common mode page code if any of these 3 are
137 * being translated.
138 */
139#define ENABLE_SATI_MODE_PAGES
140#endif /* !defined(ENABLE_SATI_MODE_PAGES) */
141
142#endif /* MODE_SENSE/SELECT/REQUEST_SENSE */
143
144#endif /* _SATI_TYPES_H_ */
145
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c
index a66e7b248b24..395080d0fc53 100644
--- a/drivers/scsi/isci/core/scic_sds_request.c
+++ b/drivers/scsi/isci/core/scic_sds_request.c
@@ -73,10 +73,6 @@
73#include "scu_constants.h" 73#include "scu_constants.h"
74#include "scu_task_context.h" 74#include "scu_task_context.h"
75 75
76#if !defined(DISABLE_ATAPI)
77#include "scic_sds_stp_packet_request.h"
78#endif
79
80/* 76/*
81 * **************************************************************************** 77 * ****************************************************************************
82 * * SCIC SDS IO REQUEST CONSTANTS 78 * * SCIC SDS IO REQUEST CONSTANTS
@@ -670,16 +666,6 @@ static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *s
670 status = scic_sds_stp_ncq_request_construct(sci_req, len, dir); 666 status = scic_sds_stp_ncq_request_construct(sci_req, len, dir);
671 break; 667 break;
672 668
673#if !defined(DISABLE_ATAPI)
674 case SAT_PROTOCOL_PACKET_NON_DATA:
675 case SAT_PROTOCOL_PACKET_DMA_DATA_IN:
676 case SAT_PROTOCOL_PACKET_DMA_DATA_OUT:
677 case SAT_PROTOCOL_PACKET_PIO_DATA_IN:
678 case SAT_PROTOCOL_PACKET_PIO_DATA_OUT:
679 status = scic_sds_stp_packet_request_construct(sci_req);
680 break;
681#endif
682
683 case SAT_PROTOCOL_DMA_QUEUED: 669 case SAT_PROTOCOL_DMA_QUEUED:
684 case SAT_PROTOCOL_DMA: 670 case SAT_PROTOCOL_DMA:
685 case SAT_PROTOCOL_DEVICE_DIAGNOSTIC: 671 case SAT_PROTOCOL_DEVICE_DIAGNOSTIC:
diff --git a/drivers/scsi/isci/core/scic_sds_stp_packet_request.c b/drivers/scsi/isci/core/scic_sds_stp_packet_request.c
deleted file mode 100644
index 1cb77bbb7485..000000000000
--- a/drivers/scsi/isci/core/scic_sds_stp_packet_request.c
+++ /dev/null
@@ -1,805 +0,0 @@
1/*
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.
4 *
5 * GPL LICENSE SUMMARY
6 *
7 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
8 *
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.
12 *
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.
17 *
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.
23 *
24 * BSD LICENSE
25 *
26 * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
27 * All rights reserved.
28 *
29 * Redistribution and use in source and binary forms, with or without
30 * modification, are permitted provided that the following conditions
31 * are met:
32 *
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
38 * distribution.
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.
42 *
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.
54 */
55#if !defined(DISABLE_ATAPI)
56
57#include "intel_ata.h"
58#include "intel_sas.h"
59#include "intel_sata.h"
60#include "intel_sat.h"
61#include "sati_translator_sequence.h"
62#include "sci_base_state.h"
63#include "scic_controller.h"
64#include "scic_sds_controller.h"
65#include "remote_device.h"
66#include "scic_sds_request.h"
67#include "scic_sds_stp_packet_request.h"
68#include "scic_user_callback.h"
69#include "sci_util.h"
70#include "scu_completion_codes.h"
71#include "scu_task_context.h"
72
73
74/**
75 * This method will fill in the SCU Task Context for a PACKET fis. And
76 * construct the request STARTED sub-state machine for Packet Protocol IO.
77 * @sci_req: This parameter specifies the stp packet request object being
78 * constructed.
79 *
80 */
81enum sci_status scic_sds_stp_packet_request_construct(
82 struct scic_sds_request *sci_req)
83{
84 struct sata_fis_reg_h2d *h2d_fis =
85 scic_stp_io_request_get_h2d_reg_address(
86 sci_req
87 );
88
89 /*
90 * Work around, we currently only support PACKET DMA protocol, so we
91 * need to make change to Packet Fis features field. */
92 h2d_fis->features = h2d_fis->features | ATA_PACKET_FEATURE_DMA;
93
94 scic_sds_stp_non_ncq_request_construct(sci_req);
95
96 /* Build the Packet Fis task context structure */
97 scu_stp_raw_request_construct_task_context(
98 (struct scic_sds_stp_request *)sci_req,
99 sci_req->task_context_buffer
100 );
101
102 sci_base_state_machine_construct(
103 &sci_req->started_substate_machine,
104 &sci_req->parent.parent,
105 scic_sds_stp_packet_request_started_substate_table,
106 SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
107 );
108
109 return SCI_SUCCESS;
110}
111
112
113/**
114 * This method will fill in the SCU Task Context for a Packet request command
115 * phase in PACKET DMA DATA (IN/OUT) type. The following important settings
116 * are utilized: -# task_type == SCU_TASK_TYPE_PACKET_DMA. This simply
117 * indicates that a normal request type (i.e. non-raw frame) is being
118 * utilized to perform task management. -# control_frame == 1. This ensures
119 * that the proper endianess is set so that the bytes are transmitted in the
120 * right order for a smp request frame.
121 * @sci_req: This parameter specifies the smp request object being
122 * constructed.
123 * @task_context: The task_context to be reconstruct for packet request command
124 * phase.
125 *
126 */
127void scu_stp_packet_request_command_phase_construct_task_context(
128 struct scic_sds_request *sci_req,
129 struct scu_task_context *task_context)
130{
131 void *atapi_cdb;
132 u32 atapi_cdb_length;
133 struct scic_sds_stp_request *stp_request = (struct scic_sds_stp_request *)sci_req;
134
135 /*
136 * reference: SSTL 1.13.4.2
137 * task_type, sata_direction */
138 if (scic_cb_io_request_get_data_direction(sci_req->user_request)
139 == SCI_IO_REQUEST_DATA_OUT) {
140 task_context->task_type = SCU_TASK_TYPE_PACKET_DMA_OUT;
141 task_context->sata_direction = 0;
142 } else { /* todo: for NO_DATA command, we need to send out raw frame. */
143 task_context->task_type = SCU_TASK_TYPE_PACKET_DMA_IN;
144 task_context->sata_direction = 1;
145 }
146
147 /* sata header */
148 memset(&(task_context->type.stp), 0, sizeof(struct stp_task_context));
149 task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA;
150
151 /*
152 * Copy in the command IU with CDB so that the commandIU address doesn't
153 * change. */
154 memset(sci_req->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
155
156 atapi_cdb =
157 scic_cb_stp_packet_io_request_get_cdb_address(sci_req->user_request);
158
159 atapi_cdb_length =
160 scic_cb_stp_packet_io_request_get_cdb_length(sci_req->user_request);
161
162 memcpy(((u8 *)sci_req->command_buffer + sizeof(u32)), atapi_cdb, atapi_cdb_length);
163
164 atapi_cdb_length =
165 max(atapi_cdb_length, stp_request->type.packet.device_preferred_cdb_length);
166
167 task_context->ssp_command_iu_length =
168 ((atapi_cdb_length % 4) == 0) ?
169 (atapi_cdb_length / 4) : ((atapi_cdb_length / 4) + 1);
170
171 /* task phase is set to TX_CMD */
172 task_context->task_phase = 0x1;
173
174 /* retry counter */
175 task_context->stp_retry_count = 0;
176
177 if (scic_cb_request_is_initial_construction(sci_req->user_request)) {
178 /* data transfer size. */
179 task_context->transfer_length_bytes =
180 scic_cb_io_request_get_transfer_length(sci_req->user_request);
181
182 /* setup sgl */
183 scic_sds_request_build_sgl(sci_req);
184 } else {
185 /* data transfer size, need to be 4 bytes aligned. */
186 task_context->transfer_length_bytes = (SCSI_FIXED_SENSE_DATA_BASE_LENGTH + 2);
187
188 scic_sds_stp_packet_internal_request_sense_build_sgl(sci_req);
189 }
190}
191
192/**
193 * This method will fill in the SCU Task Context for a DATA fis containing CDB
194 * in Raw Frame type. The TC for previous Packet fis was already there, we
195 * only need to change the H2D fis content.
196 * @sci_req: This parameter specifies the smp request object being
197 * constructed.
198 * @task_context: The task_context to be reconstruct for packet request command
199 * phase.
200 *
201 */
202void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
203 struct scic_sds_request *sci_req,
204 struct scu_task_context *task_context)
205{
206 void *atapi_cdb =
207 scic_cb_stp_packet_io_request_get_cdb_address(sci_req->user_request);
208
209 u32 atapi_cdb_length =
210 scic_cb_stp_packet_io_request_get_cdb_length(sci_req->user_request);
211
212 memset(sci_req->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
213 memcpy(((u8 *)sci_req->command_buffer + sizeof(u32)), atapi_cdb, atapi_cdb_length);
214
215 memset(&(task_context->type.stp), 0, sizeof(struct stp_task_context));
216 task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA;
217
218 /*
219 * Note the data send out has to be 4 bytes aligned. Or else out hardware will
220 * patch non-zero bytes and cause the target device unhappy. */
221 task_context->transfer_length_bytes = 12;
222}
223
224
225/*
226 * *@brief This methods decode the D2H status FIS and retrieve the sense data,
227 * then pass the sense data to user request.
228 *
229 ***@param[in] sci_req The request receive D2H status FIS.
230 ***@param[in] status_fis The D2H status fis to be processed.
231 *
232 */
233enum sci_status scic_sds_stp_packet_request_process_status_fis(
234 struct scic_sds_request *sci_req,
235 struct sata_fis_reg_d2h *status_fis)
236{
237 enum sci_status status = SCI_SUCCESS;
238
239 /* TODO: Process the error status fis, retrieve sense data. */
240 if (status_fis->status & ATA_STATUS_REG_ERROR_BIT)
241 status = SCI_FAILURE_IO_RESPONSE_VALID;
242
243 return status;
244}
245
246/*
247 * *@brief This methods builds sgl for internal REQUEST SENSE stp packet
248 * command using this request response buffer, only one sge is
249 * needed.
250 *
251 ***@param[in] sci_req The request receive request sense data.
252 *
253 */
254void scic_sds_stp_packet_internal_request_sense_build_sgl(
255 struct scic_sds_request *sds_request)
256{
257 void *sge;
258 struct scu_sgl_element_pair *scu_sgl_list = NULL;
259 struct scu_task_context *task_context;
260 dma_addr_t dma_addr;
261
262 struct sci_ssp_response_iu *rsp_iu =
263 (struct sci_ssp_response_iu *)sds_request->response_buffer;
264
265 sge = (void *)&rsp_iu->data[0];
266
267 task_context =
268 (struct scu_task_context *)sds_request->task_context_buffer;
269 scu_sgl_list = &task_context->sgl_pair_ab;
270
271 dma_addr = scic_io_request_get_dma_addr(sds_request, sge);
272
273 scu_sgl_list->A.address_upper = upper_32_bits(dma_addr);
274 scu_sgl_list->A.address_lower = lower_32_bits(dma_addr);
275 scu_sgl_list->A.length = task_context->transfer_length_bytes;
276 scu_sgl_list->A.address_modifier = 0;
277
278 SCU_SGL_ZERO(scu_sgl_list->B);
279}
280
281/**
282 * This method processes the completions transport layer (TL) status to
283 * determine if the Packet FIS was sent successfully. If the Packet FIS was
284 * sent successfully, then the state for the Packet request transits to
285 * waiting for a PIO SETUP frame.
286 * @sci_req: This parameter specifies the request for which the TC
287 * completion was received.
288 * @completion_code: This parameter indicates the completion status information
289 * for the TC.
290 *
291 * Indicate if the tc completion handler was successful. SCI_SUCCESS currently
292 * this method always returns success.
293 */
294enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_completion_handler(
295 struct scic_sds_request *sci_req,
296 u32 completion_code)
297{
298 enum sci_status status = SCI_SUCCESS;
299
300 switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
301 case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
302 scic_sds_request_set_status(
303 sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
304 );
305
306 sci_base_state_machine_change_state(
307 &sci_req->started_substate_machine,
308 SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE
309 );
310 break;
311
312 default:
313 /*
314 * All other completion status cause the IO to be complete. If a NAK
315 * was received, then it is up to the user to retry the request. */
316 scic_sds_request_set_status(
317 sci_req,
318 SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
319 SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
320 );
321
322 sci_base_state_machine_change_state(
323 &sci_req->parent.state_machine,
324 SCI_BASE_REQUEST_STATE_COMPLETED
325 );
326 break;
327 }
328
329 return status;
330}
331
332
333/**
334 * This method processes an unsolicited frame while the Packet request is
335 * waiting for a PIO SETUP FIS. It will release the unsolicited frame, and
336 * transition the request to the COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
337 * state.
338 * @sci_req: This parameter specifies the request for which the
339 * unsolicited frame was received.
340 * @frame_index: This parameter indicates the unsolicited frame index that
341 * should contain the response.
342 *
343 * This method returns an indication of whether the pio setup frame was handled
344 * successfully or not. SCI_SUCCESS Currently this value is always returned and
345 * indicates successful processing of the TC response.
346 */
347enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_handler(
348 struct scic_sds_request *request,
349 u32 frame_index)
350{
351 enum sci_status status;
352 struct sata_fis_header *frame_header;
353 u32 *frame_buffer;
354 struct scic_sds_stp_request *sci_req;
355
356 sci_req = (struct scic_sds_stp_request *)request;
357
358 status = scic_sds_unsolicited_frame_control_get_header(
359 &(sci_req->parent.owning_controller->uf_control),
360 frame_index,
361 (void **)&frame_header
362 );
363
364 if (status == SCI_SUCCESS) {
365 BUG_ON(frame_header->fis_type != SATA_FIS_TYPE_PIO_SETUP);
366
367 /*
368 * Get from the frame buffer the PIO Setup Data, although we don't need
369 * any info from this pio setup fis. */
370 scic_sds_unsolicited_frame_control_get_buffer(
371 &(sci_req->parent.owning_controller->uf_control),
372 frame_index,
373 (void **)&frame_buffer
374 );
375
376 /*
377 * Get the data from the PIO Setup
378 * The SCU Hardware returns first word in the frame_header and the rest
379 * of the data is in the frame buffer so we need to back up one dword */
380 sci_req->type.packet.device_preferred_cdb_length =
381 (u16)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->transfter_count;
382
383 /* Frame has been decoded return it to the controller */
384 scic_sds_controller_release_frame(
385 sci_req->parent.owning_controller, frame_index
386 );
387
388 sci_base_state_machine_change_state(
389 &sci_req->parent.started_substate_machine,
390 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
391 );
392 } else
393 dev_err(scic_to_dev(request->owning_controller),
394 "%s: SCIC IO Request 0x%p could not get frame header "
395 "for frame index %d, status %x\n",
396 __func__, sci_req, frame_index, status);
397
398 return status;
399}
400
401
402/**
403 * This method processes the completions transport layer (TL) status to
404 * determine if the PACKET command data FIS was sent successfully. If
405 * successfully, then the state for the packet request transits to COMPLETE
406 * state. If not successfuly, the request transits to
407 * COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE.
408 * @sci_req: This parameter specifies the request for which the TC
409 * completion was received.
410 * @completion_code: This parameter indicates the completion status information
411 * for the TC.
412 *
413 * Indicate if the tc completion handler was successful. SCI_SUCCESS currently
414 * this method always returns success.
415 */
416enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_tc_completion_handler(
417 struct scic_sds_request *sci_req,
418 u32 completion_code)
419{
420 enum sci_status status = SCI_SUCCESS;
421 u8 sat_packet_protocol =
422 scic_cb_request_get_sat_protocol(sci_req->user_request);
423
424 switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
425 case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT):
426 scic_sds_request_set_status(
427 sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
428 );
429
430 if (sat_packet_protocol == SAT_PROTOCOL_PACKET_DMA_DATA_IN
431 || sat_packet_protocol == SAT_PROTOCOL_PACKET_DMA_DATA_OUT
432 )
433 sci_base_state_machine_change_state(
434 &sci_req->parent.state_machine,
435 SCI_BASE_REQUEST_STATE_COMPLETED
436 );
437 else
438 sci_base_state_machine_change_state(
439 &sci_req->started_substate_machine,
440 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE
441 );
442 break;
443
444 case (SCU_TASK_DONE_UNEXP_FIS << SCU_COMPLETION_TL_STATUS_SHIFT):
445 if (scic_io_request_get_number_of_bytes_transferred(sci_req) <
446 scic_cb_io_request_get_transfer_length(sci_req->user_request)) {
447 scic_sds_request_set_status(
448 sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS_IO_DONE_EARLY
449 );
450
451 sci_base_state_machine_change_state(
452 &sci_req->parent.state_machine,
453 SCI_BASE_REQUEST_STATE_COMPLETED
454 );
455
456 status = sci_req->sci_status;
457 }
458 break;
459
460 case (SCU_TASK_DONE_EXCESS_DATA << SCU_COMPLETION_TL_STATUS_SHIFT):
461 /* In this case, there is no UF coming after. compelte the IO now. */
462 scic_sds_request_set_status(
463 sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
464 );
465
466 sci_base_state_machine_change_state(
467 &sci_req->parent.state_machine,
468 SCI_BASE_REQUEST_STATE_COMPLETED
469 );
470
471 break;
472
473 default:
474 if (sci_req->sci_status != SCI_SUCCESS) { /* The io status was set already. This means an UF for the status
475 * fis was received already.
476 */
477
478 /*
479 * A device suspension event is expected, we need to have the device
480 * coming out of suspension, then complete the IO. */
481 sci_base_state_machine_change_state(
482 &sci_req->started_substate_machine,
483 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE
484 );
485
486 /* change the device state to ATAPI_ERROR. */
487 sci_base_state_machine_change_state(
488 &sci_req->target_device->ready_substate_machine,
489 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR
490 );
491
492 status = sci_req->sci_status;
493 } else { /* If receiving any non-sucess TC status, no UF received yet, then an UF for
494 * the status fis is coming after.
495 */
496 scic_sds_request_set_status(
497 sci_req,
498 SCU_TASK_DONE_CHECK_RESPONSE,
499 SCI_FAILURE_IO_RESPONSE_VALID
500 );
501
502 sci_base_state_machine_change_state(
503 &sci_req->started_substate_machine,
504 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE
505 );
506 }
507 break;
508 }
509
510 return status;
511}
512
513
514/**
515 * This method processes an unsolicited frame.
516 * @sci_req: This parameter specifies the request for which the
517 * unsolicited frame was received.
518 * @frame_index: This parameter indicates the unsolicited frame index that
519 * should contain the response.
520 *
521 * This method returns an indication of whether the UF frame was handled
522 * successfully or not. SCI_SUCCESS Currently this value is always returned and
523 * indicates successful processing of the TC response.
524 */
525enum sci_status scic_sds_stp_packet_request_command_phase_common_frame_handler(
526 struct scic_sds_request *request,
527 u32 frame_index)
528{
529 enum sci_status status;
530 struct sata_fis_header *frame_header;
531 u32 *frame_buffer;
532 struct scic_sds_stp_request *sci_req;
533
534 sci_req = (struct scic_sds_stp_request *)request;
535
536 status = scic_sds_unsolicited_frame_control_get_header(
537 &(sci_req->parent.owning_controller->uf_control),
538 frame_index,
539 (void **)&frame_header
540 );
541
542 if (status == SCI_SUCCESS) {
543 BUG_ON(frame_header->fis_type != SATA_FIS_TYPE_REGD2H);
544
545 /*
546 * Get from the frame buffer the PIO Setup Data, although we don't need
547 * any info from this pio setup fis. */
548 scic_sds_unsolicited_frame_control_get_buffer(
549 &(sci_req->parent.owning_controller->uf_control),
550 frame_index,
551 (void **)&frame_buffer
552 );
553
554 scic_sds_controller_copy_sata_response(
555 &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer
556 );
557
558 /* Frame has been decoded return it to the controller */
559 scic_sds_controller_release_frame(
560 sci_req->parent.owning_controller, frame_index
561 );
562 }
563
564 return status;
565}
566
567/**
568 * This method processes an unsolicited frame while the packet request is
569 * expecting TC completion. It will process the FIS and construct sense data.
570 * @sci_req: This parameter specifies the request for which the
571 * unsolicited frame was received.
572 * @frame_index: This parameter indicates the unsolicited frame index that
573 * should contain the response.
574 *
575 * This method returns an indication of whether the UF frame was handled
576 * successfully or not. SCI_SUCCESS Currently this value is always returned and
577 * indicates successful processing of the TC response.
578 */
579enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_frame_handler(
580 struct scic_sds_request *request,
581 u32 frame_index)
582{
583 struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request;
584
585 enum sci_status status =
586 scic_sds_stp_packet_request_command_phase_common_frame_handler(
587 request, frame_index);
588
589 if (status == SCI_SUCCESS) {
590 /* The command has completed with error status from target device. */
591 status = scic_sds_stp_packet_request_process_status_fis(
592 request, &sci_req->d2h_reg_fis);
593
594 if (status != SCI_SUCCESS) {
595 scic_sds_request_set_status(
596 &sci_req->parent,
597 SCU_TASK_DONE_CHECK_RESPONSE,
598 status
599 );
600 } else
601 scic_sds_request_set_status(
602 &sci_req->parent, SCU_TASK_DONE_GOOD, SCI_SUCCESS
603 );
604 }
605
606 return status;
607}
608
609
610/**
611 * This method processes an unsolicited frame while the packet request is
612 * expecting TC completion. It will process the FIS and construct sense data.
613 * @sci_req: This parameter specifies the request for which the
614 * unsolicited frame was received.
615 * @frame_index: This parameter indicates the unsolicited frame index that
616 * should contain the response.
617 *
618 * This method returns an indication of whether the UF frame was handled
619 * successfully or not. SCI_SUCCESS Currently this value is always returned and
620 * indicates successful processing of the TC response.
621 */
622enum sci_status scic_sds_stp_packet_request_command_phase_await_d2h_fis_frame_handler(
623 struct scic_sds_request *request,
624 u32 frame_index)
625{
626 enum sci_status status =
627 scic_sds_stp_packet_request_command_phase_common_frame_handler(
628 request, frame_index);
629
630 struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request;
631
632 if (status == SCI_SUCCESS) {
633 /* The command has completed with error status from target device. */
634 status = scic_sds_stp_packet_request_process_status_fis(
635 request, &sci_req->d2h_reg_fis);
636
637 if (status != SCI_SUCCESS) {
638 scic_sds_request_set_status(
639 request,
640 SCU_TASK_DONE_CHECK_RESPONSE,
641 status
642 );
643 } else
644 scic_sds_request_set_status(
645 request, SCU_TASK_DONE_GOOD, SCI_SUCCESS
646 );
647
648 /*
649 * Always complete the NON_DATA command right away, no need to delay completion
650 * even an error status fis came from target device. */
651 sci_base_state_machine_change_state(
652 &request->parent.state_machine,
653 SCI_BASE_REQUEST_STATE_COMPLETED
654 );
655 }
656
657 return status;
658}
659
660enum sci_status scic_sds_stp_packet_request_started_completion_delay_complete_handler(
661 struct scic_sds_request *request)
662{
663 sci_base_state_machine_change_state(&request->parent.state_machine,
664 SCI_BASE_REQUEST_STATE_COMPLETED);
665
666 return request->sci_status;
667}
668
669/* --------------------------------------------------------------------------- */
670
671const struct scic_sds_io_request_state_handler scic_sds_stp_packet_request_started_substate_handler_table[] = {
672 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE] = {
673 .parent.abort_handler = scic_sds_request_started_state_abort_handler,
674 .tc_completion_handler = scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_completion_handler,
675 },
676 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE] = {
677 .parent.abort_handler = scic_sds_request_started_state_abort_handler,
678 .frame_handler = scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_handler
679 },
680 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE] = {
681 .parent.abort_handler = scic_sds_request_started_state_abort_handler,
682 .tc_completion_handler = scic_sds_stp_packet_request_command_phase_await_tc_completion_tc_completion_handler,
683 .frame_handler = scic_sds_stp_packet_request_command_phase_await_tc_completion_frame_handler
684 },
685 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE] = {
686 .parent.abort_handler = scic_sds_request_started_state_abort_handler,
687 .frame_handler = scic_sds_stp_packet_request_command_phase_await_d2h_fis_frame_handler
688 },
689 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE] = {
690 .parent.abort_handler = scic_sds_request_started_state_abort_handler,
691 .parent.complete_handler = scic_sds_stp_packet_request_started_completion_delay_complete_handler,
692 },
693};
694
695void scic_sds_stp_packet_request_started_packet_phase_await_tc_completion_enter(
696 struct sci_base_object *object)
697{
698 struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
699
700 SET_STATE_HANDLER(
701 sci_req,
702 scic_sds_stp_packet_request_started_substate_handler_table,
703 SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
704 );
705
706 scic_sds_remote_device_set_working_request(
707 sci_req->target_device, sci_req
708 );
709}
710
711void scic_sds_stp_packet_request_started_packet_phase_await_pio_setup_enter(
712 struct sci_base_object *object)
713{
714 struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
715
716 SET_STATE_HANDLER(
717 sci_req,
718 scic_sds_stp_packet_request_started_substate_handler_table,
719 SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE
720 );
721}
722
723void scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter(
724 struct sci_base_object *object)
725{
726 struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
727 u8 sat_packet_protocol =
728 scic_cb_request_get_sat_protocol(sci_req->user_request);
729
730 struct scu_task_context *task_context;
731 enum sci_status status;
732
733 /*
734 * Recycle the TC and reconstruct it for sending out data fis containing
735 * CDB. */
736 task_context = scic_sds_controller_get_task_context_buffer(
737 sci_req->owning_controller, sci_req->io_tag);
738
739 if (sat_packet_protocol == SAT_PROTOCOL_PACKET_NON_DATA)
740 scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
741 sci_req, task_context);
742 else
743 scu_stp_packet_request_command_phase_construct_task_context(
744 sci_req, task_context);
745
746 /* send the new TC out. */
747 status = sci_req->owning_controller->state_handlers->parent.continue_io_handler(
748 &sci_req->owning_controller->parent,
749 &sci_req->target_device->parent,
750 &sci_req->parent
751 );
752
753 if (status == SCI_SUCCESS)
754 SET_STATE_HANDLER(
755 sci_req,
756 scic_sds_stp_packet_request_started_substate_handler_table,
757 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
758 );
759}
760
761void scic_sds_stp_packet_request_started_command_phase_await_d2h_fis_enter(
762 struct sci_base_object *object)
763{
764 struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
765
766 SET_STATE_HANDLER(
767 sci_req,
768 scic_sds_stp_packet_request_started_substate_handler_table,
769 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE
770 );
771}
772
773void scic_sds_stp_packet_request_started_completion_delay_enter(
774 struct sci_base_object *object)
775{
776 struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
777
778 SET_STATE_HANDLER(
779 sci_req,
780 scic_sds_stp_packet_request_started_substate_handler_table,
781 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE
782 );
783}
784
785
786/* --------------------------------------------------------------------------- */
787const struct sci_base_state scic_sds_stp_packet_request_started_substate_table[] = {
788 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE] = {
789 .enter_state = scic_sds_stp_packet_request_started_packet_phase_await_tc_completion_enter,
790 },
791 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE] = {
792 .enter_state = scic_sds_stp_packet_request_started_packet_phase_await_pio_setup_enter,
793 },
794 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE] = {
795 .enter_state = scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter,
796 },
797 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE] = {
798 .enter_state = scic_sds_stp_packet_request_started_command_phase_await_d2h_fis_enter,
799 },
800 [SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE] = {
801 .enter_state scic_sds_stp_packet_request_started_completion_delay_enter,
802 }
803};
804
805#endif /* !defined(DISABLE_ATAPI) */
diff --git a/drivers/scsi/isci/core/scic_sds_stp_packet_request.h b/drivers/scsi/isci/core/scic_sds_stp_packet_request.h
index f6ff5a6f6645..5d45ef6c2511 100644
--- a/drivers/scsi/isci/core/scic_sds_stp_packet_request.h
+++ b/drivers/scsi/isci/core/scic_sds_stp_packet_request.h
@@ -104,50 +104,11 @@ enum _scic_sds_stp_packet_request_started_substates {
104 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE, 104 SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE,
105}; 105};
106 106
107
108
109#if !defined(DISABLE_ATAPI)
110extern const struct sci_base_state scic_sds_stp_packet_request_started_substate_table[];
111extern const struct scic_sds_io_request_state_handler scic_sds_stp_packet_request_started_substate_handler_table[];
112#endif /* !defined(DISABLE_ATAPI) */
113
114#if !defined(DISABLE_ATAPI)
115enum sci_status scic_sds_stp_packet_request_construct(
116 struct scic_sds_request *sci_req);
117#else /* !defined(DISABLE_ATAPI) */
118#define scic_sds_stp_packet_request_construct(request) SCI_FAILURE 107#define scic_sds_stp_packet_request_construct(request) SCI_FAILURE
119#endif /* !defined(DISABLE_ATAPI) */
120
121#if !defined(DISABLE_ATAPI)
122void scu_stp_packet_request_command_phase_construct_task_context(
123 struct scic_sds_request *sci_req,
124 struct scu_task_context *task_context);
125#else /* !defined(DISABLE_ATAPI) */
126#define scu_stp_packet_request_command_phase_construct_task_context(reqeust, tc) 108#define scu_stp_packet_request_command_phase_construct_task_context(reqeust, tc)
127#endif /* !defined(DISABLE_ATAPI) */
128
129#if !defined(DISABLE_ATAPI)
130void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
131 struct scic_sds_request *sci_req,
132 struct scu_task_context *task_context);
133#else /* !defined(DISABLE_ATAPI) */
134#define scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(reqeust, tc) 109#define scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(reqeust, tc)
135#endif /* !defined(DISABLE_ATAPI) */
136
137#if !defined(DISABLE_ATAPI)
138enum sci_status scic_sds_stp_packet_request_process_status_fis(
139 struct scic_sds_request *sci_req,
140 struct sata_fis_reg_d2h *status_fis);
141#else /* !defined(DISABLE_ATAPI) */
142#define scic_sds_stp_packet_request_process_status_fis(reqeust, fis) SCI_FAILURE 110#define scic_sds_stp_packet_request_process_status_fis(reqeust, fis) SCI_FAILURE
143#endif /* !defined(DISABLE_ATAPI) */
144
145#if !defined(DISABLE_ATAPI)
146void scic_sds_stp_packet_internal_request_sense_build_sgl(
147 struct scic_sds_request *sci_req);
148#else /* !defined(DISABLE_ATAPI) */
149#define scic_sds_stp_packet_internal_request_sense_build_sgl(request) 111#define scic_sds_stp_packet_internal_request_sense_build_sgl(request)
150#endif /* !defined(DISABLE_ATAPI) */
151 112
152#endif /* _SCIC_SDS_STP_PACKET_REQUEST_H_ */ 113#endif /* _SCIC_SDS_STP_PACKET_REQUEST_H_ */
153 114
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index 1e9e2227820a..6d5ab728ccd1 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -99,15 +99,6 @@ enum sas_linkrate scic_remote_device_get_connection_rate(
99 return sci_dev->connection_rate; 99 return sci_dev->connection_rate;
100} 100}
101 101
102
103#if !defined(DISABLE_ATAPI)
104bool scic_remote_device_is_atapi(struct scic_sds_remote_device *sci_dev)
105{
106 return sci_dev->is_atapi;
107}
108#endif
109
110
111/** 102/**
112 * 103 *
113 * 104 *
@@ -217,16 +208,6 @@ enum sci_status scic_sds_remote_device_start_task(
217 208
218/** 209/**
219 * 210 *
220 * @controller: The controller that is completing the task request.
221 * @sci_dev: The remote device for which the complete task handling is
222 * being requested.
223 * @io_request: The task request that is being completed.
224 *
225 * This method invokes the remote device complete task handler. enum sci_status
226 */
227
228/**
229 *
230 * @sci_dev: 211 * @sci_dev:
231 * @request: 212 * @request:
232 * 213 *
@@ -247,47 +228,6 @@ void scic_sds_remote_device_post_request(
247 ); 228 );
248} 229}
249 230
250#if !defined(DISABLE_ATAPI)
251/**
252 *
253 * @sci_dev: The device to be checked.
254 *
255 * This method check the signature fis of a stp device to decide whether a
256 * device is atapi or not. true if a device is atapi device. False if a device
257 * is not atapi.
258 */
259bool scic_sds_remote_device_is_atapi(
260 struct scic_sds_remote_device *sci_dev)
261{
262 if (!sci_dev->target_protocols.u.bits.attached_stp_target)
263 return false;
264 else if (sci_dev->is_direct_attached) {
265 struct scic_sds_phy *phy;
266 struct scic_sata_phy_properties properties;
267 struct sata_fis_reg_d2h *signature_fis;
268 phy = scic_sds_port_get_a_connected_phy(sci_dev->owning_port);
269 scic_sata_phy_get_properties(phy, &properties);
270
271 /* decode the signature fis. */
272 signature_fis = &(properties.signature_fis);
273
274 if ((signature_fis->sector_count == 0x01)
275 && (signature_fis->lba_low == 0x01)
276 && (signature_fis->lba_mid == 0x14)
277 && (signature_fis->lba_high == 0xEB)
278 && ((signature_fis->device & 0x5F) == 0x00)
279 ) {
280 /* An ATA device supporting the PACKET command set. */
281 return true;
282 } else
283 return false;
284 } else {
285 /* Expander supported ATAPI device is not currently supported. */
286 return false;
287 }
288}
289#endif
290
291/** 231/**
292 * 232 *
293 * @user_parameter: This is cast to a remote device object. 233 * @user_parameter: This is cast to a remote device object.
diff --git a/drivers/scsi/isci/remote_device.h b/drivers/scsi/isci/remote_device.h
index 5b82b9fb7be1..5cceb6c5dc1d 100644
--- a/drivers/scsi/isci/remote_device.h
+++ b/drivers/scsi/isci/remote_device.h
@@ -105,14 +105,6 @@ struct scic_sds_remote_device {
105 */ 105 */
106 bool is_direct_attached; 106 bool is_direct_attached;
107 107
108#if !defined(DISABLE_ATAPI)
109 /**
110 * This filed is assinged the value of true if the device is an ATAPI
111 * device.
112 */
113 bool is_atapi;
114#endif
115
116 /** 108 /**
117 * This filed contains a pointer back to the port to which this device 109 * This filed contains a pointer back to the port to which this device
118 * is assigned. 110 * is assigned.
@@ -254,22 +246,7 @@ enum sci_status scic_remote_device_reset_complete(
254enum sas_linkrate scic_remote_device_get_connection_rate( 246enum sas_linkrate scic_remote_device_get_connection_rate(
255 struct scic_sds_remote_device *remote_device); 247 struct scic_sds_remote_device *remote_device);
256 248
257#if !defined(DISABLE_ATAPI)
258/**
259 * scic_remote_device_is_atapi() -
260 * @this_device: The device whose type is to be decided.
261 *
262 * This method first decide whether a device is a stp target, then decode the
263 * signature fis of a DA STP device to tell whether it is a standard end disk
264 * or an ATAPI device. bool Indicate a device is ATAPI device or not.
265 */
266bool scic_remote_device_is_atapi(
267 struct scic_sds_remote_device *device_handle);
268#else /* !defined(DISABLE_ATAPI) */
269#define scic_remote_device_is_atapi(device_handle) false 249#define scic_remote_device_is_atapi(device_handle) false
270#endif /* !defined(DISABLE_ATAPI) */
271
272
273 250
274/** 251/**
275 * enum scic_sds_remote_device_states - This enumeration depicts all the states 252 * enum scic_sds_remote_device_states - This enumeration depicts all the states
@@ -405,16 +382,6 @@ enum scic_sds_stp_remote_device_ready_substates {
405 */ 382 */
406 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR, 383 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR,
407 384
408#if !defined(DISABLE_ATAPI)
409 /**
410 * This is the ATAPI error state for the STP ATAPI remote device. This state is
411 * entered when ATAPI device sends error status FIS without data while the device
412 * object is in CMD state. A suspension event is expected in this state. The device
413 * object will resume right away.
414 */
415 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR,
416#endif
417
418 /** 385 /**
419 * This is the READY substate indicates the device is waiting for the RESET task 386 * This is the READY substate indicates the device is waiting for the RESET task
420 * coming to be recovered from certain hardware specific error. 387 * coming to be recovered from certain hardware specific error.
@@ -727,12 +694,7 @@ void scic_sds_remote_device_post_request(
727 struct scic_sds_remote_device *sci_dev, 694 struct scic_sds_remote_device *sci_dev,
728 u32 request); 695 u32 request);
729 696
730#if !defined(DISABLE_ATAPI)
731bool scic_sds_remote_device_is_atapi(
732 struct scic_sds_remote_device *sci_dev);
733#else /* !defined(DISABLE_ATAPI) */
734#define scic_sds_remote_device_is_atapi(sci_dev) false 697#define scic_sds_remote_device_is_atapi(sci_dev) false
735#endif /* !defined(DISABLE_ATAPI) */
736 698
737void scic_sds_remote_device_start_request( 699void scic_sds_remote_device_start_request(
738 struct scic_sds_remote_device *sci_dev, 700 struct scic_sds_remote_device *sci_dev,
diff --git a/drivers/scsi/isci/stp_remote_device.c b/drivers/scsi/isci/stp_remote_device.c
index b81f21f47d2a..0fbfe52208fa 100644
--- a/drivers/scsi/isci/stp_remote_device.c
+++ b/drivers/scsi/isci/stp_remote_device.c
@@ -483,47 +483,6 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com
483 return status; 483 return status;
484} 484}
485 485
486#if !defined(DISABLE_ATAPI)
487/*
488 * *****************************************************************************
489 * * STP REMOTE DEVICE READY ATAPI ERROR SUBSTATE HANDLERS
490 * ***************************************************************************** */
491
492/**
493 *
494 * @[in]: device The device received event.
495 * @[in]: event_code The event code.
496 *
497 * This method will handle the event for a ATAPI device that is in the ATAPI
498 * ERROR state. We pick up suspension events to handle specifically to this
499 * state. We resume the RNC right away. We then complete the outstanding IO to
500 * this device. enum sci_status
501 */
502enum sci_status scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler(
503 struct scic_sds_remote_device *sci_dev,
504 u32 event_code)
505{
506 enum sci_status status;
507
508 status = scic_sds_remote_device_general_event_handler(sci_dev, event_code);
509
510 if (status == SCI_SUCCESS) {
511 if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX
512 || scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) {
513 status = scic_sds_remote_node_context_resume(
514 sci_dev->rnc,
515 sci_dev->working_request->state_handlers->parent.complete_handler,
516 (void *)sci_dev->working_request
517 );
518 }
519 }
520
521 return status;
522}
523#endif /* !defined(DISABLE_ATAPI) */
524
525/* --------------------------------------------------------------------------- */
526
527static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_device_ready_substate_handler_table[] = { 486static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_device_ready_substate_handler_table[] = {
528 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { 487 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
529 .start_handler = scic_sds_remote_device_default_start_handler, 488 .start_handler = scic_sds_remote_device_default_start_handler,
@@ -593,25 +552,6 @@ static const struct scic_sds_remote_device_state_handler scic_sds_stp_remote_dev
593 .event_handler = scic_sds_remote_device_general_event_handler, 552 .event_handler = scic_sds_remote_device_general_event_handler,
594 .frame_handler = scic_sds_remote_device_general_frame_handler 553 .frame_handler = scic_sds_remote_device_general_frame_handler
595 }, 554 },
596#if !defined(DISABLE_ATAPI)
597 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR] = {
598 .start_handler = scic_sds_remote_device_default_start_handler,
599 .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
600 .fail_handler = scic_sds_remote_device_default_fail_handler,
601 .destruct_handler = scic_sds_remote_device_default_destruct_handler,
602 .reset_handler = scic_sds_remote_device_ready_state_reset_handler,
603 .reset_complete_handler = scic_sds_remote_device_default_reset_complete_handler,
604 .start_io_handler = scic_sds_remote_device_default_start_request_handler,
605 .complete_io_handler = scic_sds_stp_remote_device_complete_request,
606 .continue_io_handler = scic_sds_remote_device_default_continue_request_handler,
607 .start_task_handler = scic_sds_stp_remote_device_ready_substate_start_request_handler,
608 .complete_task_handler = scic_sds_stp_remote_device_complete_request,
609 .suspend_handler = scic_sds_remote_device_default_suspend_handler,
610 .resume_handler = scic_sds_remote_device_default_resume_handler,
611 .event_handler = scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler,
612 .frame_handler = scic_sds_remote_device_general_frame_handler
613 },
614#endif
615 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = { 555 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = {
616 .start_handler = scic_sds_remote_device_default_start_handler, 556 .start_handler = scic_sds_remote_device_default_start_handler,
617 .stop_handler = scic_sds_remote_device_ready_state_stop_handler, 557 .stop_handler = scic_sds_remote_device_ready_state_stop_handler,
@@ -764,35 +704,6 @@ static void scic_sds_stp_remote_device_ready_await_reset_substate_enter(
764 ); 704 );
765} 705}
766 706
767#if !defined(DISABLE_ATAPI)
768/*
769 * *****************************************************************************
770 * * STP REMOTE DEVICE READY ATAPI ERROR SUBSTATE
771 * ***************************************************************************** */
772
773/**
774 * The enter routine to READY ATAPI ERROR substate.
775 * @device: This is the SCI base object which is cast into a
776 * struct scic_sds_remote_device object.
777 *
778 */
779void scic_sds_stp_remote_device_ready_atapi_error_substate_enter(
780 struct sci_base_object *device)
781{
782 struct scic_sds_remote_device *sci_dev;
783
784 sci_dev = (struct scic_sds_remote_device *)device;
785
786 SET_STATE_HANDLER(
787 sci_dev,
788 scic_sds_stp_remote_device_ready_substate_handler_table,
789 SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR
790 );
791}
792#endif /* !defined(DISABLE_ATAPI) */
793
794/* --------------------------------------------------------------------------- */
795
796const struct sci_base_state scic_sds_stp_remote_device_ready_substate_table[] = { 707const struct sci_base_state scic_sds_stp_remote_device_ready_substate_table[] = {
797 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = { 708 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE] = {
798 .enter_state = scic_sds_stp_remote_device_ready_idle_substate_enter, 709 .enter_state = scic_sds_stp_remote_device_ready_idle_substate_enter,
@@ -806,11 +717,6 @@ const struct sci_base_state scic_sds_stp_remote_device_ready_substate_table[] =
806 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = { 717 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR] = {
807 .enter_state = scic_sds_stp_remote_device_ready_ncq_error_substate_enter, 718 .enter_state = scic_sds_stp_remote_device_ready_ncq_error_substate_enter,
808 }, 719 },
809#if !defined(DISABLE_ATAPI)
810 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR] = {
811 .enter_state = scic_sds_stp_remote_device_ready_atapi_error_substate_enter,
812 },
813#endif
814 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = { 720 [SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET] = {
815 .enter_state = scic_sds_stp_remote_device_ready_await_reset_substate_enter, 721 .enter_state = scic_sds_stp_remote_device_ready_await_reset_substate_enter,
816 }, 722 },