diff options
author | Dave Jiang <dave.jiang@intel.com> | 2011-05-04 18:02:03 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:46 -0400 |
commit | e76d6180da436edf2cc3538cbed1f5b02b614613 (patch) | |
tree | 24892fa998bfb575eb71ab2fff7016fad3d423a9 | |
parent | f2f300806fe186a6c45020a444667755edcce672 (diff) |
isci: Convert ATA defines to Linux native defines
* Removing all intel_sata and intel_ata defines
* Removing the usage of SAT_PROTOCOL_*. We can get everything from sas_task
* Moved SATA FIS types to local sas.h. These defines will have to go
into include/scsi/sas.h eventually.
* Added offsets for SATA FIS header in order to grab the values
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/core/intel_ata.h | 554 | ||||
-rw-r--r-- | drivers/scsi/isci/core/intel_sas.h | 3 | ||||
-rw-r--r-- | drivers/scsi/isci/core/intel_sata.h | 224 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_phy.h | 1 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy.c | 23 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_phy.h | 1 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.c | 125 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.c | 366 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.h | 8 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 23 | ||||
-rw-r--r-- | drivers/scsi/isci/sas.h (renamed from drivers/scsi/isci/core/intel_sat.h) | 53 | ||||
-rw-r--r-- | drivers/scsi/isci/sata.c | 75 | ||||
-rw-r--r-- | drivers/scsi/isci/sata.h | 4 |
13 files changed, 280 insertions, 1180 deletions
diff --git a/drivers/scsi/isci/core/intel_ata.h b/drivers/scsi/isci/core/intel_ata.h deleted file mode 100644 index 48b297e50bd0..000000000000 --- a/drivers/scsi/isci/core/intel_ata.h +++ /dev/null | |||
@@ -1,554 +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 | /** | ||
57 | * This file defines all of the ATA related constants, enumerations, and types. | ||
58 | * Please note that this file does not necessarily contain an exhaustive | ||
59 | * list of all constants, commands, sub-commands, etc. | ||
60 | * | ||
61 | * | ||
62 | */ | ||
63 | |||
64 | #ifndef _ATA_H_ | ||
65 | #define _ATA_H_ | ||
66 | |||
67 | #include <linux/types.h> | ||
68 | |||
69 | /** | ||
70 | * | ||
71 | * | ||
72 | * ATA_COMMAND_CODES These constants depict the various ATA command codes | ||
73 | * defined in the ATA/ATAPI specification. | ||
74 | */ | ||
75 | #define ATA_IDENTIFY_DEVICE 0xEC | ||
76 | #define ATA_CHECK_POWER_MODE 0xE5 | ||
77 | #define ATA_STANDBY 0xE2 | ||
78 | #define ATA_STANDBY_IMMED 0xE0 | ||
79 | #define ATA_IDLE_IMMED 0xE1 | ||
80 | #define ATA_IDLE 0xE3 | ||
81 | #define ATA_FLUSH_CACHE 0xE7 | ||
82 | #define ATA_FLUSH_CACHE_EXT 0xEA | ||
83 | #define ATA_READ_DMA_EXT 0x25 | ||
84 | #define ATA_READ_DMA 0xC8 | ||
85 | #define ATA_READ_SECTORS_EXT 0x24 | ||
86 | #define ATA_READ_SECTORS 0x20 | ||
87 | #define ATA_WRITE_DMA_EXT 0x35 | ||
88 | #define ATA_WRITE_DMA 0xCA | ||
89 | #define ATA_WRITE_SECTORS_EXT 0x34 | ||
90 | #define ATA_WRITE_SECTORS 0x30 | ||
91 | #define ATA_WRITE_UNCORRECTABLE 0x45 | ||
92 | #define ATA_READ_VERIFY_SECTORS 0x40 | ||
93 | #define ATA_READ_VERIFY_SECTORS_EXT 0x42 | ||
94 | #define ATA_READ_BUFFER 0xE4 | ||
95 | #define ATA_WRITE_BUFFER 0xE8 | ||
96 | #define ATA_EXECUTE_DEVICE_DIAG 0x90 | ||
97 | #define ATA_SET_FEATURES 0xEF | ||
98 | #define ATA_SMART 0xB0 | ||
99 | #define ATA_PACKET_IDENTIFY 0xA1 | ||
100 | #define ATA_PACKET 0xA0 | ||
101 | #define ATA_READ_FPDMA 0x60 | ||
102 | #define ATA_WRITE_FPDMA 0x61 | ||
103 | #define ATA_READ_LOG_EXT 0x2F | ||
104 | #define ATA_NOP 0x00 | ||
105 | #define ATA_DEVICE_RESET 0x08 | ||
106 | #define ATA_MEDIA_EJECT 0xED | ||
107 | |||
108 | /** | ||
109 | * | ||
110 | * | ||
111 | * ATA_SMART_SUB_COMMAND_CODES These constants define the ATA SMART command | ||
112 | * sub-codes that can be executed. | ||
113 | */ | ||
114 | #define ATA_SMART_SUB_CMD_ENABLE 0xD8 | ||
115 | #define ATA_SMART_SUB_CMD_DISABLE 0xD9 | ||
116 | #define ATA_SMART_SUB_CMD_RETURN_STATUS 0xDA | ||
117 | #define ATA_SMART_SUB_CMD_READ_LOG 0xD5 | ||
118 | |||
119 | /** | ||
120 | * | ||
121 | * | ||
122 | * ATA_SET_FEATURES_SUB_COMMAND_CODES These constants define the ATA SET | ||
123 | * FEATURES command sub-codes that can be executed. | ||
124 | */ | ||
125 | #define ATA_SET_FEATURES_SUB_CMD_ENABLE_CACHE 0x02 | ||
126 | #define ATA_SET_FEATURES_SUB_CMD_DISABLE_CACHE 0x82 | ||
127 | #define ATA_SET_FEATURES_SUB_CMD_DISABLE_READ_AHEAD 0x55 | ||
128 | #define ATA_SET_FEATURES_SUB_CMD_ENABLE_READ_AHEAD 0xAA | ||
129 | #define ATA_SET_FEATURES_SUB_CMD_SET_TRANSFER_MODE 0x3 | ||
130 | |||
131 | /** | ||
132 | * | ||
133 | * | ||
134 | * ATA_READ_LOG_EXT_PAGE_CODES This is a list of log page codes available for | ||
135 | * use. | ||
136 | */ | ||
137 | #define ATA_LOG_PAGE_NCQ_ERROR 0x10 | ||
138 | #define ATA_LOG_PAGE_SMART_SELF_TEST 0x06 | ||
139 | #define ATA_LOG_PAGE_EXTENDED_SMART_SELF_TEST 0x07 | ||
140 | |||
141 | /** | ||
142 | * | ||
143 | * | ||
144 | * ATA_LOG_PAGE_NCQ_ERROR_CONSTANTS These constants define standard values for | ||
145 | * use when requesting the NCQ error log page. | ||
146 | */ | ||
147 | #define ATA_LOG_PAGE_NCQ_ERROR_SECTOR 0 | ||
148 | #define ATA_LOG_PAGE_NCQ_ERROR_SECTOR_COUNT 1 | ||
149 | |||
150 | /** | ||
151 | * | ||
152 | * | ||
153 | * ATA_STATUS_REGISTER_BITS The following are status register bit definitions | ||
154 | * per ATA/ATAPI-7. | ||
155 | */ | ||
156 | #define ATA_STATUS_REG_BSY_BIT 0x80 | ||
157 | #define ATA_STATUS_REG_DEVICE_FAULT_BIT 0x20 | ||
158 | #define ATA_STATUS_REG_ERROR_BIT 0x01 | ||
159 | |||
160 | /** | ||
161 | * | ||
162 | * | ||
163 | * ATA_ERROR_REGISTER_BITS The following are error register bit definitions per | ||
164 | * ATA/ATAPI-7. | ||
165 | */ | ||
166 | #define ATA_ERROR_REG_NO_MEDIA_BIT 0x02 | ||
167 | #define ATA_ERROR_REG_ABORT_BIT 0x04 | ||
168 | #define ATA_ERROR_REG_MEDIA_CHANGE_REQUEST_BIT 0x08 | ||
169 | #define ATA_ERROR_REG_ID_NOT_FOUND_BIT 0x10 | ||
170 | #define ATA_ERROR_REG_MEDIA_CHANGE_BIT 0x20 | ||
171 | #define ATA_ERROR_REG_UNCORRECTABLE_BIT 0x40 | ||
172 | #define ATA_ERROR_REG_WRITE_PROTECTED_BIT 0x40 | ||
173 | #define ATA_ERROR_REG_ICRC_BIT 0x80 | ||
174 | |||
175 | /** | ||
176 | * | ||
177 | * | ||
178 | * ATA_CONTROL_REGISTER_BITS The following are control register bit definitions | ||
179 | * per ATA/ATAPI-7 | ||
180 | */ | ||
181 | #define ATA_CONTROL_REG_INTERRUPT_ENABLE_BIT 0x02 | ||
182 | #define ATA_CONTROL_REG_SOFT_RESET_BIT 0x04 | ||
183 | #define ATA_CONTROL_REG_HIGH_ORDER_BYTE_BIT 0x80 | ||
184 | |||
185 | /** | ||
186 | * | ||
187 | * | ||
188 | * ATA_DEVICE_HEAD_REGISTER_BITS The following are device/head register bit | ||
189 | * definitions per ATA/ATAPI-7. | ||
190 | */ | ||
191 | #define ATA_DEV_HEAD_REG_LBA_MODE_ENABLE 0x40 | ||
192 | #define ATA_DEV_HEAD_REG_FUA_ENABLE 0x80 | ||
193 | |||
194 | /** | ||
195 | * | ||
196 | * | ||
197 | * ATA_IDENTIFY_DEVICE_FIELD_LENGTHS The following constants define the number | ||
198 | * of bytes contained in various fields found in the IDENTIFY DEVICE data | ||
199 | * structure. | ||
200 | */ | ||
201 | #define ATA_IDENTIFY_SERIAL_NUMBER_LEN 20 | ||
202 | #define ATA_IDENTIFY_MODEL_NUMBER_LEN 40 | ||
203 | #define ATA_IDENTIFY_FW_REVISION_LEN 8 | ||
204 | #define ATA_IDENTIFY_48_LBA_LEN 8 | ||
205 | #define ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN 30 | ||
206 | #define ATA_IDENTIFY_WWN_LEN 8 | ||
207 | |||
208 | /** | ||
209 | * | ||
210 | * | ||
211 | * ATA_IDENTIFY_DEVICE_FIELD_MASKS The following constants define bit masks | ||
212 | * utilized to determine if a feature is supported/enabled or if a bit is | ||
213 | * simply set inside of the IDENTIFY DEVICE data structre. | ||
214 | */ | ||
215 | #define ATA_IDENTIFY_REMOVABLE_MEDIA_ENABLE 0x0080 | ||
216 | #define ATA_IDENTIFY_CAPABILITIES1_NORMAL_DMA_ENABLE 0x0100 | ||
217 | #define ATA_IDENTIFY_CAPABILITIES1_STANDBY_ENABLE 0x2000 | ||
218 | #define ATA_IDENTIFY_COMMAND_SET_SUPPORTED0_SMART_ENABLE 0x0001 | ||
219 | #define ATA_IDENTIFY_COMMAND_SET_SUPPORTED1_48BIT_ENABLE 0x0400 | ||
220 | #define ATA_IDENTIFY_COMMAND_SET_WWN_SUPPORT_ENABLE 0x0100 | ||
221 | #define ATA_IDENTIFY_COMMAND_SET_ENABLED0_SMART_ENABLE 0x0001 | ||
222 | #define ATA_IDENTIFY_SATA_CAPABILITIES_NCQ_ENABLE 0x0100 | ||
223 | #define ATA_IDENTIFY_NCQ_QUEUE_DEPTH_ENABLE 0x001F | ||
224 | #define ATA_IDENTIFY_SECTOR_LARGER_THEN_512_ENABLE 0x0100 | ||
225 | #define ATA_IDENTIFY_LOGICAL_SECTOR_PER_PHYSICAL_SECTOR_MASK 0x000F | ||
226 | #define ATA_IDENTIFY_LOGICAL_SECTOR_PER_PHYSICAL_SECTOR_ENABLE 0x2000 | ||
227 | #define ATA_IDENTIFY_WRITE_UNCORRECTABLE_SUPPORT 0x0004 | ||
228 | #define ATA_IDENTIFY_COMMAND_SET_SMART_SELF_TEST_SUPPORTED 0x0002 | ||
229 | |||
230 | /** | ||
231 | * | ||
232 | * | ||
233 | * ATAPI_IDENTIFY_DEVICE_FIELD_MASKS These constants define the various bit | ||
234 | * definitions for the fields in the PACKET IDENTIFY DEVICE data structure. | ||
235 | */ | ||
236 | #define ATAPI_IDENTIFY_16BYTE_CMD_PCKT_ENABLE 0x01 | ||
237 | |||
238 | /** | ||
239 | * | ||
240 | * | ||
241 | * ATA_PACKET_FEATURE_BITS These constants define the various bit definitions | ||
242 | * for the ATA PACKET feature register. | ||
243 | */ | ||
244 | #define ATA_PACKET_FEATURE_DMA 0x01 | ||
245 | #define ATA_PACKET_FEATURE_OVL 0x02 | ||
246 | #define ATA_PACKET_FEATURE_DMADIR 0x04 | ||
247 | |||
248 | /** | ||
249 | * | ||
250 | * | ||
251 | * ATA_Device_Power_Mode_Values These constants define the power mode values | ||
252 | * returned by ATA_Check_Power_Mode | ||
253 | */ | ||
254 | #define ATA_STANDBY_POWER_MODE 0x00 | ||
255 | #define ATA_IDLE_POWER_MODE 0x80 | ||
256 | #define ATA_ACTIVE_POWER_MODE 0xFF | ||
257 | |||
258 | /** | ||
259 | * | ||
260 | * | ||
261 | * ATA_WRITE_UNCORRECTIABLE feature field values These constants define the | ||
262 | * Write Uncorrectable feature values used with the SATI translation. | ||
263 | */ | ||
264 | #define ATA_WRITE_UNCORRECTABLE_PSUEDO 0x55 | ||
265 | #define ATA_WRITE_UNCORRECTABLE_FLAGGED 0xAA | ||
266 | |||
267 | |||
268 | |||
269 | /** | ||
270 | * struct ATA_IDENTIFY_DEVICE - This structure depicts the ATA IDENTIFY DEVICE | ||
271 | * data format. | ||
272 | * | ||
273 | * | ||
274 | */ | ||
275 | struct ata_identify_device_data { | ||
276 | u16 general_config_bits; /* word 00 */ | ||
277 | u16 obsolete0; /* word 01 (num cylinders) */ | ||
278 | u16 vendor_specific_config_bits; /* word 02 */ | ||
279 | u16 obsolete1; /* word 03 (num heads) */ | ||
280 | u16 retired1[2]; /* words 04-05 */ | ||
281 | u16 obsolete2; /* word 06 (sectors / track) */ | ||
282 | u16 reserved_for_compact_flash1[2]; /* words 07-08 */ | ||
283 | u16 retired0; /* word 09 */ | ||
284 | u8 serial_number[ATA_IDENTIFY_SERIAL_NUMBER_LEN]; /* word 10-19 */ | ||
285 | u16 retired2[2]; /* words 20-21 */ | ||
286 | u16 obsolete4; /* word 22 */ | ||
287 | u8 firmware_revision[ATA_IDENTIFY_FW_REVISION_LEN]; /* words 23-26 */ | ||
288 | u8 model_number[ATA_IDENTIFY_MODEL_NUMBER_LEN]; /* words 27-46 */ | ||
289 | u16 max_sectors_per_multiple; /* word 47 */ | ||
290 | u16 reserved0; /* word 48 */ | ||
291 | u16 capabilities1; /* word 49 */ | ||
292 | u16 capabilities2; /* word 50 */ | ||
293 | u16 obsolete5[2]; /* words 51-52 */ | ||
294 | u16 validity_bits; /* word 53 */ | ||
295 | u16 obsolete6[5]; /* | ||
296 | * words 54-58 Used to be: | ||
297 | * current cylinders, | ||
298 | * current heads, | ||
299 | * current sectors/Track, | ||
300 | * current capacity */ | ||
301 | u16 current_max_sectors_per_multiple; /* word 59 */ | ||
302 | u8 total_num_sectors[4]; /* words 60-61 */ | ||
303 | u16 obsolete7; /* word 62 */ | ||
304 | u16 multi_word_dma_mode; /* word 63 */ | ||
305 | u16 pio_modes_supported; /* word 64 */ | ||
306 | u16 min_multiword_dma_transfer_cycle; /* word 65 */ | ||
307 | u16 rec_min_multiword_dma_transfer_cycle; /* word 66 */ | ||
308 | u16 min_pio_transfer_no_flow_ctrl; /* word 67 */ | ||
309 | u16 min_pio_transfer_with_flow_ctrl; /* word 68 */ | ||
310 | u16 reserved1[2]; /* words 69-70 */ | ||
311 | u16 reserved2[4]; /* words 71-74 */ | ||
312 | u16 queue_depth; /* word 75 */ | ||
313 | u16 serial_ata_capabilities; /* word 76 */ | ||
314 | u16 serial_ata_reserved; /* word 77 */ | ||
315 | u16 serial_ata_features_supported; /* word 78 */ | ||
316 | u16 serial_ata_features_enabled; /* word 79 */ | ||
317 | u16 major_version_number; /* word 80 */ | ||
318 | u16 minor_version_number; /* word 81 */ | ||
319 | u16 command_set_supported0; /* word 82 */ | ||
320 | u16 command_set_supported1; /* word 83 */ | ||
321 | u16 command_set_supported_extention; /* word 84 */ | ||
322 | u16 command_set_enabled0; /* word 85 */ | ||
323 | u16 command_set_enabled1; /* word 86 */ | ||
324 | u16 command_set_default; /* word 87 */ | ||
325 | u16 ultra_dma_mode; /* word 88 */ | ||
326 | u16 security_erase_completion_time; /* word 89 */ | ||
327 | u16 enhanced_security_erase_time; /* word 90 */ | ||
328 | u16 current_power_mgmt_value; /* word 91 */ | ||
329 | u16 master_password_revision; /* word 92 */ | ||
330 | u16 hardware_reset_result; /* word 93 */ | ||
331 | u16 current_acoustic_management_value; /* word 94 */ | ||
332 | u16 stream_min_request_size; /* word 95 */ | ||
333 | u16 stream_transfer_time; /* word 96 */ | ||
334 | u16 stream_access_latency; /* word 97 */ | ||
335 | u16 stream_performance_granularity[2]; /* words 98-99 */ | ||
336 | u8 max_48bit_lba[ATA_IDENTIFY_48_LBA_LEN]; /* words 100-103 */ | ||
337 | u16 streaming_transfer_time; /* word 104 */ | ||
338 | u16 reserved3; /* word 105 */ | ||
339 | u16 physical_logical_sector_info; /* word 106 */ | ||
340 | u16 acoustic_test_interseek_delay; /* word 107 */ | ||
341 | u8 world_wide_name[ATA_IDENTIFY_WWN_LEN]; /* words 108-111 */ | ||
342 | u8 reserved_for_wwn_extention[ATA_IDENTIFY_WWN_LEN]; /* words 112-115 */ | ||
343 | u16 reserved4; /* word 116 */ | ||
344 | u8 words_per_logical_sector[4]; /* words 117-118 */ | ||
345 | u16 command_set_supported2; /* word 119 */ | ||
346 | u16 reserved5[7]; /* words 120-126 */ | ||
347 | u16 removable_media_status; /* word 127 */ | ||
348 | u16 security_status; /* word 128 */ | ||
349 | u16 vendor_specific1[31]; /* words 129-159 */ | ||
350 | u16 cfa_power_mode1; /* word 160 */ | ||
351 | u16 reserved_for_compact_flash2[7]; /* words 161-167 */ | ||
352 | u16 device_nominal_form_factor; /* word 168 */ | ||
353 | u16 reserved_for_compact_flash3[7]; /* words 169-175 */ | ||
354 | u16 current_media_serial_number[ATA_IDENTIFY_MEDIA_SERIAL_NUMBER_LEN]; /* words 176-205 */ | ||
355 | u16 reserved6[3]; /* words 206-208 */ | ||
356 | u16 logical_sector_alignment; /* words 209 */ | ||
357 | u16 reserved7[7]; /* words 210-216 */ | ||
358 | u16 nominal_media_rotation_rate; /* word 217 */ | ||
359 | u16 reserved8[37]; /* words 218-254 */ | ||
360 | u16 integrity_word; /* word 255 */ | ||
361 | |||
362 | }; | ||
363 | |||
364 | #define ATA_IDENTIFY_DEVICE_GET_OFFSET(field_name) \ | ||
365 | ((unsigned long)&(((struct ata_identify_device_data *)0)->field_name)) | ||
366 | #define ATA_IDENTIFY_DEVICE_WCE_ENABLE 0x20 | ||
367 | #define ATA_IDENTIFY_DEVICE_RA_ENABLE 0x40 | ||
368 | |||
369 | /** | ||
370 | * struct ATAPI_IDENTIFY_PACKET_DATA - The following structure depicts the | ||
371 | * ATA-ATAPI 7 version of the IDENTIFY PACKET DEVICE data structure. | ||
372 | * | ||
373 | * | ||
374 | */ | ||
375 | struct atapi_identify_packet_device { | ||
376 | u16 generalConfigBits; /* word 00 */ | ||
377 | u16 reserved0; /* word 01 (num cylinders) */ | ||
378 | u16 uniqueConfigBits; /* word 02 */ | ||
379 | u16 reserved1[7]; /* words 03 - 09 */ | ||
380 | u8 serialNumber[ATA_IDENTIFY_SERIAL_NUMBER_LEN]; /* word 10-19 */ | ||
381 | u16 reserved2[3]; /* words 20-22 */ | ||
382 | u8 firmwareRevision[ATA_IDENTIFY_FW_REVISION_LEN]; /* words 23-26 */ | ||
383 | u8 modelNumber[ATA_IDENTIFY_MODEL_NUMBER_LEN]; /* words 27-46 */ | ||
384 | u16 reserved4[2]; /* words 47-48 */ | ||
385 | u16 capabilities1; /* word 49 */ | ||
386 | u16 capabilities2; /* word 50 */ | ||
387 | u16 obsolete0[2]; /* words 51-52 */ | ||
388 | u16 validityBits; /* word 53 */ | ||
389 | u16 reserved[8]; /* words 54-61 */ | ||
390 | |||
391 | u16 DMADIRBitRequired; /* word 62, page2 */ | ||
392 | u16 multiWordDmaMode; /* word 63 */ | ||
393 | u16 pioModesSupported; /* word 64 */ | ||
394 | u16 minMultiwordDmaTransferCycle; /* word 65 */ | ||
395 | u16 recMinMultiwordDmaTransferCycle; /* word 66 */ | ||
396 | u16 minPioTransferNoFlowCtrl; /* word 67 */ | ||
397 | u16 minPioTransferWithFlowCtrl; /* word 68 */ | ||
398 | u16 reserved6[2]; /* words 69-70 */ | ||
399 | u16 nsFromPACKETReceiptToBusRelease; /* word 71 */ | ||
400 | u16 nsFromSERVICEReceiptToBSYreset; /* wore 72 */ | ||
401 | u16 reserved7[2]; /* words 73-74 */ | ||
402 | u16 queueDepth; /* word 75 */ | ||
403 | u16 serialAtaCapabilities; /* word 76 */ | ||
404 | u16 serialAtaReserved; /* word 77 */ | ||
405 | u16 serialAtaFeaturesSupported; /* word 78 */ | ||
406 | u16 serialAtaFeaturesEnabled; /* word 79 */ | ||
407 | |||
408 | u16 majorVersionNumber; /* word 80, page3 */ | ||
409 | u16 minorVersionNumber; /* word 81 */ | ||
410 | u16 commandSetSupported0; /* word 82 */ | ||
411 | u16 commandSetSupported1; /* word 83 */ | ||
412 | |||
413 | u16 commandSetSupportedExtention; /* word 84, page4 */ | ||
414 | u16 commandSetEnabled0; /* word 85 */ | ||
415 | u16 commandSetEnabled1; /* word 86 */ | ||
416 | u16 commandSetDefault; /* word 87 */ | ||
417 | |||
418 | u16 ultraDmaMode; /* word 88, page5 */ | ||
419 | u16 reserved8[4]; /* words 89 - 92 */ | ||
420 | |||
421 | u16 hardwareResetResult; /* word 93, page6 */ | ||
422 | u16 currentAcousticManagementValue; /* word 94 */ | ||
423 | u16 reserved9[30]; /* words 95-124 */ | ||
424 | u16 ATAPIByteCount0Behavior; /* word 125 */ | ||
425 | u16 obsolete1; /* word 126 */ | ||
426 | u16 removableMediaStatus; /* word 127, */ | ||
427 | |||
428 | u16 securityStatus; /* word 128, page7 */ | ||
429 | u16 vendorSpecific1[31]; /* words 129-159 */ | ||
430 | u16 reservedForCompactFlash[16]; /* words 160-175 */ | ||
431 | u16 reserved10[79]; /* words 176-254 */ | ||
432 | u16 integrityWord; /* word 255 */ | ||
433 | }; | ||
434 | |||
435 | /** | ||
436 | * struct ata_extended_smart_self_test_log - The following structure depicts | ||
437 | * the ATA-8 version of the Extended SMART self test log page descriptor | ||
438 | * entry. | ||
439 | * | ||
440 | * | ||
441 | */ | ||
442 | union ata_descriptor_entry { | ||
443 | struct DESCRIPTOR_ENTRY { | ||
444 | u8 lba_field; | ||
445 | u8 status_byte; | ||
446 | u8 time_stamp_low; | ||
447 | u8 time_stamp_high; | ||
448 | u8 checkpoint_byte; | ||
449 | u8 failing_lba_low; | ||
450 | u8 failing_lba_mid; | ||
451 | u8 failing_lba_high; | ||
452 | u8 failing_lba_low_ext; | ||
453 | u8 failing_lba_mid_ext; | ||
454 | u8 failing_lba_high_ext; | ||
455 | |||
456 | u8 vendor_specific1; | ||
457 | u8 vendor_specific2; | ||
458 | u8 vendor_specific3; | ||
459 | u8 vendor_specific4; | ||
460 | u8 vendor_specific5; | ||
461 | u8 vendor_specific6; | ||
462 | u8 vendor_specific7; | ||
463 | u8 vendor_specific8; | ||
464 | u8 vendor_specific9; | ||
465 | u8 vendor_specific10; | ||
466 | u8 vendor_specific11; | ||
467 | u8 vendor_specific12; | ||
468 | u8 vendor_specific13; | ||
469 | u8 vendor_specific14; | ||
470 | u8 vendor_specific15; | ||
471 | } DESCRIPTOR_ENTRY; | ||
472 | |||
473 | u8 descriptor_entry[26]; | ||
474 | |||
475 | }; | ||
476 | |||
477 | /** | ||
478 | * struct ata_extended_smart_self_test_log - The following structure depicts | ||
479 | * the ATA-8 version of the SMART self test log page descriptor entry. | ||
480 | * | ||
481 | * | ||
482 | */ | ||
483 | union ata_smart_descriptor_entry { | ||
484 | struct SMART_DESCRIPTOR_ENTRY { | ||
485 | u8 lba_field; | ||
486 | u8 status_byte; | ||
487 | u8 time_stamp_low; | ||
488 | u8 time_stamp_high; | ||
489 | u8 checkpoint_byte; | ||
490 | u8 failing_lba_low; | ||
491 | u8 failing_lba_mid; | ||
492 | u8 failing_lba_high; | ||
493 | u8 failing_lba_low_ext; | ||
494 | |||
495 | u8 vendor_specific1; | ||
496 | u8 vendor_specific2; | ||
497 | u8 vendor_specific3; | ||
498 | u8 vendor_specific4; | ||
499 | u8 vendor_specific5; | ||
500 | u8 vendor_specific6; | ||
501 | u8 vendor_specific7; | ||
502 | u8 vendor_specific8; | ||
503 | u8 vendor_specific9; | ||
504 | u8 vendor_specific10; | ||
505 | u8 vendor_specific11; | ||
506 | u8 vendor_specific12; | ||
507 | u8 vendor_specific13; | ||
508 | u8 vendor_specific14; | ||
509 | u8 vendor_specific15; | ||
510 | } SMART_DESCRIPTOR_ENTRY; | ||
511 | |||
512 | u8 smart_descriptor_entry[24]; | ||
513 | |||
514 | }; | ||
515 | |||
516 | /** | ||
517 | * struct ata_extended_smart_self_test_log - The following structure depicts | ||
518 | * the ATA-8 version of the Extended SMART self test log page. | ||
519 | * | ||
520 | * | ||
521 | */ | ||
522 | struct ata_extended_smart_self_test_log { | ||
523 | u8 self_test_log_data_structure_revision_number; /* byte 0 */ | ||
524 | u8 reserved0; /* byte 1 */ | ||
525 | u8 self_test_descriptor_index[2]; /* byte 2-3 */ | ||
526 | |||
527 | union ata_descriptor_entry descriptor_entrys[19]; /* bytes 4-497 */ | ||
528 | |||
529 | u8 vendor_specific[2]; /* byte 498-499 */ | ||
530 | u8 reserved1[11]; /* byte 500-510 */ | ||
531 | u8 data_structure_checksum; /* byte 511 */ | ||
532 | |||
533 | }; | ||
534 | |||
535 | /** | ||
536 | * struct ata_extended_smart_self_test_log - The following structure depicts | ||
537 | * the ATA-8 version of the SMART self test log page. | ||
538 | * | ||
539 | * | ||
540 | */ | ||
541 | struct ata_smart_self_test_log { | ||
542 | u8 self_test_log_data_structure_revision_number[2]; /* bytes 0-1 */ | ||
543 | |||
544 | union ata_smart_descriptor_entry descriptor_entrys[21]; /* bytes 2-505 */ | ||
545 | |||
546 | u8 vendor_specific[2]; /* byte 506-507 */ | ||
547 | u8 self_test_index; /* byte 508 */ | ||
548 | u8 reserved1[2]; /* byte 509-510 */ | ||
549 | u8 data_structure_checksum; /* byte 511 */ | ||
550 | |||
551 | }; | ||
552 | |||
553 | #endif /* _ATA_H_ */ | ||
554 | |||
diff --git a/drivers/scsi/isci/core/intel_sas.h b/drivers/scsi/isci/core/intel_sas.h index c12e6d4f4d7d..119eb5b3094a 100644 --- a/drivers/scsi/isci/core/intel_sas.h +++ b/drivers/scsi/isci/core/intel_sas.h | |||
@@ -62,8 +62,7 @@ | |||
62 | * | 62 | * |
63 | * | 63 | * |
64 | */ | 64 | */ |
65 | 65 | #include <linux/kernel.h> | |
66 | #include "intel_sata.h" | ||
67 | #include "intel_scsi.h" | 66 | #include "intel_scsi.h" |
68 | 67 | ||
69 | /** | 68 | /** |
diff --git a/drivers/scsi/isci/core/intel_sata.h b/drivers/scsi/isci/core/intel_sata.h deleted file mode 100644 index 977354d7b843..000000000000 --- a/drivers/scsi/isci/core/intel_sata.h +++ /dev/null | |||
@@ -1,224 +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 _SATA_H_ | ||
57 | #define _SATA_H_ | ||
58 | |||
59 | #include <linux/types.h> | ||
60 | |||
61 | /** | ||
62 | * This file defines all of the SATA releated constants, enumerations, and | ||
63 | * types. Please note that this file does not necessarily contain an | ||
64 | * exhaustive list of all contants and commands. | ||
65 | * | ||
66 | * | ||
67 | */ | ||
68 | |||
69 | /** | ||
70 | * | ||
71 | * | ||
72 | * SATA FIS Types These constants depict the various SATA FIS types devined in | ||
73 | * the serial ATA specification. | ||
74 | */ | ||
75 | #define SATA_FIS_TYPE_REGH2D 0x27 | ||
76 | #define SATA_FIS_TYPE_REGD2H 0x34 | ||
77 | #define SATA_FIS_TYPE_SETDEVBITS 0xA1 | ||
78 | #define SATA_FIS_TYPE_DMA_ACTIVATE 0x39 | ||
79 | #define SATA_FIS_TYPE_DMA_SETUP 0x41 | ||
80 | #define SATA_FIS_TYPE_BIST_ACTIVATE 0x58 | ||
81 | #define SATA_FIS_TYPE_PIO_SETUP 0x5F | ||
82 | #define SATA_FIS_TYPE_DATA 0x46 | ||
83 | |||
84 | #define SATA_REGISTER_FIS_SIZE 0x20 | ||
85 | |||
86 | /** | ||
87 | * struct sata_fis_header - This is the common definition for a SATA FIS Header | ||
88 | * word. A different header word is defined for any FIS type that does not | ||
89 | * use the standard header. | ||
90 | * | ||
91 | * | ||
92 | */ | ||
93 | struct sata_fis_header { | ||
94 | u32 fis_type:8; /* word 0 */ | ||
95 | u32 pm_port:4; | ||
96 | u32 reserved:1; | ||
97 | u32 direction_flag:1; /* direction */ | ||
98 | u32 interrupt_flag:1; | ||
99 | u32 command_flag:1; /* command, auto_activate, or notification */ | ||
100 | u32 status:8; | ||
101 | u32 error:8; | ||
102 | }; | ||
103 | |||
104 | /** | ||
105 | * | ||
106 | * | ||
107 | * Status field bit definitions | ||
108 | */ | ||
109 | #define SATA_FIS_STATUS_DEVBITS_MASK (0x77) | ||
110 | |||
111 | /** | ||
112 | * struct sata_fis_set_dev_bits - SATA Set Device Bits FIS | ||
113 | * | ||
114 | * | ||
115 | */ | ||
116 | struct sata_fis_set_dev_bits { | ||
117 | u32 fis_type:8; /* word 0 */ | ||
118 | u32 pm_port:4; | ||
119 | u32 reserved0:2; | ||
120 | u32 irq:1; | ||
121 | u32 notification:1; | ||
122 | u32 status_low:4; | ||
123 | u32 status_high:4; | ||
124 | u32 error:8; | ||
125 | u32 s_active; /* word 1 */ | ||
126 | }; | ||
127 | |||
128 | /** | ||
129 | * struct sata_fis_dma_activate - SATA DMA Activate FIS | ||
130 | * | ||
131 | * | ||
132 | */ | ||
133 | struct sata_fis_dma_activate { | ||
134 | u32 fis_type:8; /* word 0 */ | ||
135 | u32 pm_port:4; | ||
136 | u32 reserved0:24; | ||
137 | }; | ||
138 | |||
139 | /** | ||
140 | * | ||
141 | * | ||
142 | * The lower 5 bits in the DMA Buffer ID Low field of the DMA Setup are used to | ||
143 | * communicate the command tag. | ||
144 | */ | ||
145 | #define SATA_DMA_SETUP_TAG_ENABLE 0x1F | ||
146 | |||
147 | #define SATA_DMA_SETUP_AUTO_ACT_ENABLE 0x80 | ||
148 | |||
149 | /** | ||
150 | * struct sata_fis_dma_setup - SATA DMA Setup FIS | ||
151 | * | ||
152 | * | ||
153 | */ | ||
154 | struct sata_fis_dma_setup { | ||
155 | u32 fis_type:8; /* word 0 */ | ||
156 | u32 pm_port:4; | ||
157 | u32 reserved_00:1; | ||
158 | u32 direction:1; | ||
159 | u32 irq:1; | ||
160 | u32 auto_activate:1; | ||
161 | u32 reserved_01:16; | ||
162 | u32 dma_buffer_id_low; /* word 1 */ | ||
163 | u32 dma_buffer_id_high; /* word 2 */ | ||
164 | u32 reserved0; /* word 3 */ | ||
165 | u32 dma_buffer_offset; /* word 4 */ | ||
166 | u32 dma_transfer_count; /* word 5 */ | ||
167 | u32 reserved1; /* word 6 */ | ||
168 | }; | ||
169 | |||
170 | /** | ||
171 | * struct sata_fis_bist_activate - SATA BIST Activate FIS | ||
172 | * | ||
173 | * | ||
174 | */ | ||
175 | struct sata_fis_bist_activate { | ||
176 | u32 fis_type:8; /* word 0 */ | ||
177 | u32 reserved0:8; | ||
178 | u32 pattern_definition:8; | ||
179 | u32 reserved1:8; | ||
180 | u32 data1; /* word 1 */ | ||
181 | u32 data2; /* word 1 */ | ||
182 | }; | ||
183 | |||
184 | /* | ||
185 | * SATA PIO Setup FIS | ||
186 | */ | ||
187 | struct sata_fis_pio_setup { | ||
188 | u32 fis_type:8; /* word 0 */ | ||
189 | u32 pm_port:4; | ||
190 | u32 reserved_00:1; | ||
191 | u32 direction:1; | ||
192 | u32 irq:1; | ||
193 | u32 reserved_01:1; | ||
194 | u32 status:8; | ||
195 | u32 error:8; | ||
196 | u32 lba_low:8; /* word 1 */ | ||
197 | u32 lba_mid:8; | ||
198 | u32 lba_high:8; | ||
199 | u32 device:8; | ||
200 | u32 lba_low_exp:8; /* word 2 */ | ||
201 | u32 lba_mid_exp:8; | ||
202 | u32 lba_high_exp:8; | ||
203 | u32 reserved:8; | ||
204 | u32 sector_count:8; /* word 3 */ | ||
205 | u32 sector_count_exp:8; | ||
206 | u32 reserved1:8; | ||
207 | u32 ending_status:8; | ||
208 | u32 transfter_count:16; /* word 4 */ | ||
209 | u32 reserved3:16; | ||
210 | }; | ||
211 | |||
212 | /** | ||
213 | * struct sata_fis_data - SATA Data FIS | ||
214 | * | ||
215 | * | ||
216 | */ | ||
217 | struct sata_fis_data { | ||
218 | u32 fis_type:8; /* word 0 */ | ||
219 | u32 pm_port:4; | ||
220 | u32 reserved0:24; | ||
221 | u8 data[4]; /* word 1 */ | ||
222 | }; | ||
223 | |||
224 | #endif /* _SATA_H_ */ | ||
diff --git a/drivers/scsi/isci/core/scic_phy.h b/drivers/scsi/isci/core/scic_phy.h index 6fe39ccedf0b..d8c4bf1a958a 100644 --- a/drivers/scsi/isci/core/scic_phy.h +++ b/drivers/scsi/isci/core/scic_phy.h | |||
@@ -67,7 +67,6 @@ | |||
67 | #include <scsi/sas.h> | 67 | #include <scsi/sas.h> |
68 | #include <scsi/libsas.h> | 68 | #include <scsi/libsas.h> |
69 | #include "sci_status.h" | 69 | #include "sci_status.h" |
70 | #include "intel_sata.h" | ||
71 | #include "intel_sas.h" | 70 | #include "intel_sas.h" |
72 | 71 | ||
73 | struct scic_sds_phy; | 72 | struct scic_sds_phy; |
diff --git a/drivers/scsi/isci/core/scic_sds_phy.c b/drivers/scsi/isci/core/scic_sds_phy.c index 1b35b1ac1f8d..0f292f1be2bb 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.c +++ b/drivers/scsi/isci/core/scic_sds_phy.c | |||
@@ -54,8 +54,7 @@ | |||
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include <scsi/sas.h> | 56 | #include <scsi/sas.h> |
57 | #include "intel_ata.h" | 57 | #include "sas.h" |
58 | #include "intel_sata.h" | ||
59 | #include "sci_base_state.h" | 58 | #include "sci_base_state.h" |
60 | #include "sci_base_state_machine.h" | 59 | #include "sci_base_state_machine.h" |
61 | #include "scic_phy.h" | 60 | #include "scic_phy.h" |
@@ -1279,23 +1278,19 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle | |||
1279 | u32 frame_index) | 1278 | u32 frame_index) |
1280 | { | 1279 | { |
1281 | enum sci_status result; | 1280 | enum sci_status result; |
1282 | u32 *frame_words; | 1281 | struct dev_to_host_fis *frame_header; |
1283 | struct sata_fis_header *fis_frame_header; | ||
1284 | u32 *fis_frame_data; | 1282 | u32 *fis_frame_data; |
1285 | 1283 | ||
1286 | result = scic_sds_unsolicited_frame_control_get_header( | 1284 | result = scic_sds_unsolicited_frame_control_get_header( |
1287 | &(scic_sds_phy_get_controller(sci_phy)->uf_control), | 1285 | &(scic_sds_phy_get_controller(sci_phy)->uf_control), |
1288 | frame_index, | 1286 | frame_index, |
1289 | (void **)&frame_words); | 1287 | (void **)&frame_header); |
1290 | 1288 | ||
1291 | if (result != SCI_SUCCESS) { | 1289 | if (result != SCI_SUCCESS) |
1292 | return result; | 1290 | return result; |
1293 | } | ||
1294 | |||
1295 | fis_frame_header = (struct sata_fis_header *)frame_words; | ||
1296 | 1291 | ||
1297 | if ((fis_frame_header->fis_type == SATA_FIS_TYPE_REGD2H) && | 1292 | if ((frame_header->fis_type == FIS_REGD2H) && |
1298 | !(fis_frame_header->status & ATA_STATUS_REG_BSY_BIT)) { | 1293 | !(frame_header->status & ATA_BUSY)) { |
1299 | scic_sds_unsolicited_frame_control_get_buffer( | 1294 | scic_sds_unsolicited_frame_control_get_buffer( |
1300 | &(scic_sds_phy_get_controller(sci_phy)->uf_control), | 1295 | &(scic_sds_phy_get_controller(sci_phy)->uf_control), |
1301 | frame_index, | 1296 | frame_index, |
@@ -1303,10 +1298,10 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle | |||
1303 | 1298 | ||
1304 | scic_sds_controller_copy_sata_response( | 1299 | scic_sds_controller_copy_sata_response( |
1305 | &sci_phy->phy_type.sata.signature_fis_buffer, | 1300 | &sci_phy->phy_type.sata.signature_fis_buffer, |
1306 | frame_words, | 1301 | frame_header, |
1307 | fis_frame_data); | 1302 | fis_frame_data); |
1308 | 1303 | ||
1309 | /* We got the IAF we can now go to the await spinup semaphore state */ | 1304 | /* got IAF we can now go to the await spinup semaphore state */ |
1310 | sci_base_state_machine_change_state(&sci_phy->starting_substate_machine, | 1305 | sci_base_state_machine_change_state(&sci_phy->starting_substate_machine, |
1311 | SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL); | 1306 | SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL); |
1312 | 1307 | ||
@@ -1318,7 +1313,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sig_fis_frame_handle | |||
1318 | __func__, | 1313 | __func__, |
1319 | frame_index); | 1314 | frame_index); |
1320 | 1315 | ||
1321 | /* Regardless of the result release this frame since we are done with it */ | 1316 | /* Regardless of the result we are done with this frame with it */ |
1322 | scic_sds_controller_release_frame(scic_sds_phy_get_controller(sci_phy), | 1317 | scic_sds_controller_release_frame(scic_sds_phy_get_controller(sci_phy), |
1323 | frame_index); | 1318 | frame_index); |
1324 | 1319 | ||
diff --git a/drivers/scsi/isci/core/scic_sds_phy.h b/drivers/scsi/isci/core/scic_sds_phy.h index c9fa2071f9b2..22b3119ec7fd 100644 --- a/drivers/scsi/isci/core/scic_sds_phy.h +++ b/drivers/scsi/isci/core/scic_sds_phy.h | |||
@@ -56,7 +56,6 @@ | |||
56 | #ifndef _SCIC_SDS_PHY_H_ | 56 | #ifndef _SCIC_SDS_PHY_H_ |
57 | #define _SCIC_SDS_PHY_H_ | 57 | #define _SCIC_SDS_PHY_H_ |
58 | 58 | ||
59 | #include "intel_sata.h" | ||
60 | #include "intel_sas.h" | 59 | #include "intel_sas.h" |
61 | #include "scu_registers.h" | 60 | #include "scu_registers.h" |
62 | #include "sci_base_state_machine.h" | 61 | #include "sci_base_state_machine.h" |
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index 13067659a8c6..31df5267c096 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c | |||
@@ -55,8 +55,6 @@ | |||
55 | 55 | ||
56 | #include <scsi/sas.h> | 56 | #include <scsi/sas.h> |
57 | #include "intel_sas.h" | 57 | #include "intel_sas.h" |
58 | #include "intel_sata.h" | ||
59 | #include "intel_sat.h" | ||
60 | #include "scic_controller.h" | 58 | #include "scic_controller.h" |
61 | #include "scic_io_request.h" | 59 | #include "scic_io_request.h" |
62 | #include "scic_sds_controller.h" | 60 | #include "scic_sds_controller.h" |
@@ -631,51 +629,55 @@ static void scu_ssp_task_request_construct_task_context( | |||
631 | * | 629 | * |
632 | * enum sci_status | 630 | * enum sci_status |
633 | */ | 631 | */ |
634 | static enum sci_status scic_io_request_construct_sata(struct scic_sds_request *sci_req, | 632 | static enum sci_status |
635 | u8 proto, u32 len, | 633 | scic_io_request_construct_sata(struct scic_sds_request *sci_req, |
636 | enum dma_data_direction dir, | 634 | u32 len, |
637 | bool copy) | 635 | enum dma_data_direction dir, |
636 | bool copy) | ||
638 | { | 637 | { |
639 | enum sci_status status = SCI_SUCCESS; | 638 | enum sci_status status = SCI_SUCCESS; |
639 | struct isci_request *ireq = sci_req->ireq; | ||
640 | struct sas_task *task = isci_request_access_task(ireq); | ||
641 | |||
642 | /* check for management protocols */ | ||
643 | if (ireq->ttype == tmf_task) { | ||
644 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); | ||
645 | |||
646 | if (tmf->tmf_code == isci_tmf_sata_srst_high || | ||
647 | tmf->tmf_code == isci_tmf_sata_srst_low) | ||
648 | return scic_sds_stp_soft_reset_request_construct(sci_req); | ||
649 | else { | ||
650 | dev_err(scic_to_dev(sci_req->owning_controller), | ||
651 | "%s: Request 0x%p received un-handled SAT " | ||
652 | "management protocol 0x%x.\n", | ||
653 | __func__, sci_req, tmf->tmf_code); | ||
654 | |||
655 | return SCI_FAILURE; | ||
656 | } | ||
657 | } | ||
640 | 658 | ||
641 | switch (proto) { | 659 | if (!sas_protocol_ata(task->task_proto)) { |
642 | case SAT_PROTOCOL_PIO_DATA_IN: | 660 | dev_err(scic_to_dev(sci_req->owning_controller), |
643 | case SAT_PROTOCOL_PIO_DATA_OUT: | 661 | "%s: Non-ATA protocol in SATA path: 0x%x\n", |
644 | status = scic_sds_stp_pio_request_construct(sci_req, proto, copy); | 662 | __func__, |
645 | break; | 663 | task->task_proto); |
646 | 664 | return SCI_FAILURE; | |
647 | case SAT_PROTOCOL_UDMA_DATA_IN: | ||
648 | case SAT_PROTOCOL_UDMA_DATA_OUT: | ||
649 | status = scic_sds_stp_udma_request_construct(sci_req, len, dir); | ||
650 | break; | ||
651 | 665 | ||
652 | case SAT_PROTOCOL_ATA_HARD_RESET: | 666 | } |
653 | case SAT_PROTOCOL_SOFT_RESET: | ||
654 | status = scic_sds_stp_soft_reset_request_construct(sci_req); | ||
655 | break; | ||
656 | 667 | ||
657 | case SAT_PROTOCOL_NON_DATA: | 668 | /* non data */ |
658 | status = scic_sds_stp_non_data_request_construct(sci_req); | 669 | if (task->data_dir == DMA_NONE) |
659 | break; | 670 | return scic_sds_stp_non_data_request_construct(sci_req); |
660 | 671 | ||
661 | case SAT_PROTOCOL_FPDMA: | 672 | /* NCQ */ |
662 | status = scic_sds_stp_ncq_request_construct(sci_req, len, dir); | 673 | if (task->ata_task.use_ncq) |
663 | break; | 674 | return scic_sds_stp_ncq_request_construct(sci_req, len, dir); |
664 | 675 | ||
665 | case SAT_PROTOCOL_DMA_QUEUED: | 676 | /* DMA */ |
666 | case SAT_PROTOCOL_DMA: | 677 | if (task->ata_task.dma_xfer) |
667 | case SAT_PROTOCOL_DEVICE_DIAGNOSTIC: | 678 | return scic_sds_stp_udma_request_construct(sci_req, len, dir); |
668 | case SAT_PROTOCOL_DEVICE_RESET: | 679 | else /* PIO */ |
669 | case SAT_PROTOCOL_RETURN_RESPONSE_INFO: | 680 | return scic_sds_stp_pio_request_construct(sci_req, copy); |
670 | default: | ||
671 | dev_err(scic_to_dev(sci_req->owning_controller), | ||
672 | "%s: SCIC IO Request 0x%p received un-handled " | ||
673 | "SAT Protocl %d.\n", | ||
674 | __func__, sci_req, proto); | ||
675 | |||
676 | status = SCI_FAILURE; | ||
677 | break; | ||
678 | } | ||
679 | 681 | ||
680 | return status; | 682 | return status; |
681 | } | 683 | } |
@@ -735,7 +737,6 @@ enum sci_status scic_io_request_construct_basic_sata( | |||
735 | { | 737 | { |
736 | enum sci_status status; | 738 | enum sci_status status; |
737 | struct scic_sds_stp_request *stp_req; | 739 | struct scic_sds_stp_request *stp_req; |
738 | u8 proto; | ||
739 | u32 len; | 740 | u32 len; |
740 | enum dma_data_direction dir; | 741 | enum dma_data_direction dir; |
741 | bool copy = false; | 742 | bool copy = false; |
@@ -748,10 +749,9 @@ enum sci_status scic_io_request_construct_basic_sata( | |||
748 | 749 | ||
749 | len = isci_request_io_request_get_transfer_length(isci_request); | 750 | len = isci_request_io_request_get_transfer_length(isci_request); |
750 | dir = isci_request_io_request_get_data_direction(isci_request); | 751 | dir = isci_request_io_request_get_data_direction(isci_request); |
751 | proto = isci_sata_get_sat_protocol(isci_request); | ||
752 | copy = (task->data_dir == DMA_NONE) ? false : true; | 752 | copy = (task->data_dir == DMA_NONE) ? false : true; |
753 | 753 | ||
754 | status = scic_io_request_construct_sata(sci_req, proto, len, dir, copy); | 754 | status = scic_io_request_construct_sata(sci_req, len, dir, copy); |
755 | 755 | ||
756 | if (status == SCI_SUCCESS) | 756 | if (status == SCI_SUCCESS) |
757 | sci_base_state_machine_change_state(&sci_req->state_machine, | 757 | sci_base_state_machine_change_state(&sci_req->state_machine, |
@@ -764,33 +764,30 @@ enum sci_status scic_io_request_construct_basic_sata( | |||
764 | enum sci_status scic_task_request_construct_sata( | 764 | enum sci_status scic_task_request_construct_sata( |
765 | struct scic_sds_request *sci_req) | 765 | struct scic_sds_request *sci_req) |
766 | { | 766 | { |
767 | enum sci_status status; | 767 | enum sci_status status = SCI_SUCCESS; |
768 | u8 sat_protocol; | 768 | struct isci_request *ireq = sci_req->ireq; |
769 | struct isci_request *isci_request = sci_req->ireq; | ||
770 | |||
771 | sat_protocol = isci_sata_get_sat_protocol(isci_request); | ||
772 | 769 | ||
773 | switch (sat_protocol) { | 770 | /* check for management protocols */ |
774 | case SAT_PROTOCOL_ATA_HARD_RESET: | 771 | if (ireq->ttype == tmf_task) { |
775 | case SAT_PROTOCOL_SOFT_RESET: | 772 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); |
776 | status = scic_sds_stp_soft_reset_request_construct(sci_req); | ||
777 | break; | ||
778 | 773 | ||
779 | default: | 774 | if (tmf->tmf_code == isci_tmf_sata_srst_high || |
780 | dev_err(scic_to_dev(sci_req->owning_controller), | 775 | tmf->tmf_code == isci_tmf_sata_srst_low) { |
781 | "%s: SCIC IO Request 0x%p received un-handled SAT " | 776 | status = scic_sds_stp_soft_reset_request_construct(sci_req); |
782 | "Protocl %d.\n", | 777 | } else { |
783 | __func__, | 778 | dev_err(scic_to_dev(sci_req->owning_controller), |
784 | sci_req, | 779 | "%s: Request 0x%p received un-handled SAT " |
785 | sat_protocol); | 780 | "Protocol 0x%x.\n", |
781 | __func__, sci_req, tmf->tmf_code); | ||
786 | 782 | ||
787 | status = SCI_FAILURE; | 783 | return SCI_FAILURE; |
788 | break; | 784 | } |
789 | } | 785 | } |
790 | 786 | ||
791 | if (status == SCI_SUCCESS) | 787 | if (status == SCI_SUCCESS) |
792 | sci_base_state_machine_change_state(&sci_req->state_machine, | 788 | sci_base_state_machine_change_state( |
793 | SCI_BASE_REQUEST_STATE_CONSTRUCTED); | 789 | &sci_req->state_machine, |
790 | SCI_BASE_REQUEST_STATE_CONSTRUCTED); | ||
794 | 791 | ||
795 | return status; | 792 | return status; |
796 | } | 793 | } |
diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index 1cd111c42ede..b3ad33bc4221 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c | |||
@@ -53,10 +53,8 @@ | |||
53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | 56 | #include <scsi/sas.h> | |
57 | #include "intel_ata.h" | 57 | #include "sas.h" |
58 | #include "intel_sata.h" | ||
59 | #include "intel_sat.h" | ||
60 | #include "sci_base_state.h" | 58 | #include "sci_base_state.h" |
61 | #include "sci_base_state_machine.h" | 59 | #include "sci_base_state_machine.h" |
62 | #include "scic_io_request.h" | 60 | #include "scic_io_request.h" |
@@ -136,7 +134,8 @@ u32 scic_sds_stp_request_get_object_size(void) | |||
136 | 134 | ||
137 | void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) | 135 | void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) |
138 | { | 136 | { |
139 | struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent); | 137 | struct scic_sds_stp_request *stp_req = |
138 | container_of(sci_req, typeof(*stp_req), parent); | ||
140 | 139 | ||
141 | sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); | 140 | sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); |
142 | sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); | 141 | sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); |
@@ -353,7 +352,7 @@ static void scu_stp_raw_request_construct_task_context( | |||
353 | task_context->control_frame = 0; | 352 | task_context->control_frame = 0; |
354 | task_context->priority = SCU_TASK_PRIORITY_NORMAL; | 353 | task_context->priority = SCU_TASK_PRIORITY_NORMAL; |
355 | task_context->task_type = SCU_TASK_TYPE_SATA_RAW_FRAME; | 354 | task_context->task_type = SCU_TASK_TYPE_SATA_RAW_FRAME; |
356 | task_context->type.stp.fis_type = SATA_FIS_TYPE_REGH2D; | 355 | task_context->type.stp.fis_type = FIS_REGH2D; |
357 | task_context->transfer_length_bytes = | 356 | task_context->transfer_length_bytes = |
358 | sizeof(struct host_to_dev_fis) - sizeof(u32); | 357 | sizeof(struct host_to_dev_fis) - sizeof(u32); |
359 | } | 358 | } |
@@ -484,68 +483,65 @@ static enum sci_status scic_sds_stp_request_non_data_await_h2d_tc_completion_han | |||
484 | * if the received frame was processed successfully. | 483 | * if the received frame was processed successfully. |
485 | */ | 484 | */ |
486 | static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler( | 485 | static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler( |
487 | struct scic_sds_request *request, | 486 | struct scic_sds_request *sci_req, |
488 | u32 frame_index) | 487 | u32 frame_index) |
489 | { | 488 | { |
490 | enum sci_status status; | 489 | enum sci_status status; |
491 | struct sata_fis_header *frame_header; | 490 | struct dev_to_host_fis *frame_header; |
492 | u32 *frame_buffer; | 491 | u32 *frame_buffer; |
493 | struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request; | 492 | struct scic_sds_stp_request *stp_req = |
493 | container_of(sci_req, typeof(*stp_req), parent); | ||
494 | 494 | ||
495 | status = scic_sds_unsolicited_frame_control_get_header( | 495 | status = scic_sds_unsolicited_frame_control_get_header( |
496 | &sci_req->parent.owning_controller->uf_control, | 496 | &stp_req->parent.owning_controller->uf_control, |
497 | frame_index, | 497 | frame_index, |
498 | (void **)&frame_header | 498 | (void **)&frame_header); |
499 | ); | ||
500 | 499 | ||
501 | if (status == SCI_SUCCESS) { | 500 | if (status == SCI_SUCCESS) { |
502 | switch (frame_header->fis_type) { | 501 | switch (frame_header->fis_type) { |
503 | case SATA_FIS_TYPE_REGD2H: | 502 | case FIS_REGD2H: |
504 | scic_sds_unsolicited_frame_control_get_buffer( | 503 | scic_sds_unsolicited_frame_control_get_buffer( |
505 | &sci_req->parent.owning_controller->uf_control, | 504 | &stp_req->parent.owning_controller->uf_control, |
506 | frame_index, | 505 | frame_index, |
507 | (void **)&frame_buffer | 506 | (void **)&frame_buffer); |
508 | ); | ||
509 | 507 | ||
510 | scic_sds_controller_copy_sata_response( | 508 | scic_sds_controller_copy_sata_response( |
511 | &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer | 509 | &stp_req->d2h_reg_fis, |
512 | ); | 510 | (u32 *)frame_header, |
511 | frame_buffer); | ||
513 | 512 | ||
514 | /* The command has completed with error */ | 513 | /* The command has completed with error */ |
515 | scic_sds_request_set_status( | 514 | scic_sds_request_set_status( |
516 | &sci_req->parent, | 515 | &stp_req->parent, |
517 | SCU_TASK_DONE_CHECK_RESPONSE, | 516 | SCU_TASK_DONE_CHECK_RESPONSE, |
518 | SCI_FAILURE_IO_RESPONSE_VALID | 517 | SCI_FAILURE_IO_RESPONSE_VALID); |
519 | ); | ||
520 | break; | 518 | break; |
521 | 519 | ||
522 | default: | 520 | default: |
523 | dev_warn(scic_to_dev(request->owning_controller), | 521 | dev_warn(scic_to_dev(sci_req->owning_controller), |
524 | "%s: IO Request:0x%p Frame Id:%d protocol " | 522 | "%s: IO Request:0x%p Frame Id:%d protocol " |
525 | "violation occurred\n", | 523 | "violation occurred\n", |
526 | __func__, sci_req, frame_index); | 524 | __func__, stp_req, frame_index); |
527 | 525 | ||
528 | scic_sds_request_set_status( | 526 | scic_sds_request_set_status( |
529 | &sci_req->parent, | 527 | &stp_req->parent, |
530 | SCU_TASK_DONE_UNEXP_FIS, | 528 | SCU_TASK_DONE_UNEXP_FIS, |
531 | SCI_FAILURE_PROTOCOL_VIOLATION | 529 | SCI_FAILURE_PROTOCOL_VIOLATION); |
532 | ); | ||
533 | break; | 530 | break; |
534 | } | 531 | } |
535 | 532 | ||
536 | sci_base_state_machine_change_state( | 533 | sci_base_state_machine_change_state( |
537 | &sci_req->parent.state_machine, | 534 | &stp_req->parent.state_machine, |
538 | SCI_BASE_REQUEST_STATE_COMPLETED | 535 | SCI_BASE_REQUEST_STATE_COMPLETED); |
539 | ); | ||
540 | 536 | ||
541 | /* Frame has been decoded return it to the controller */ | 537 | /* Frame has been decoded return it to the controller */ |
542 | scic_sds_controller_release_frame( | 538 | scic_sds_controller_release_frame( |
543 | sci_req->parent.owning_controller, frame_index); | 539 | stp_req->parent.owning_controller, frame_index); |
544 | } else | 540 | } else |
545 | dev_err(scic_to_dev(request->owning_controller), | 541 | dev_err(scic_to_dev(sci_req->owning_controller), |
546 | "%s: SCIC IO Request 0x%p could not get frame header " | 542 | "%s: SCIC IO Request 0x%p could not get frame header " |
547 | "for frame index %d, status %x\n", | 543 | "for frame index %d, status %x\n", |
548 | __func__, sci_req, frame_index, status); | 544 | __func__, stp_req, frame_index, status); |
549 | 545 | ||
550 | return status; | 546 | return status; |
551 | } | 547 | } |
@@ -603,7 +599,8 @@ static const struct sci_base_state scic_sds_stp_request_started_non_data_substat | |||
603 | 599 | ||
604 | enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request *sci_req) | 600 | enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request *sci_req) |
605 | { | 601 | { |
606 | struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent); | 602 | struct scic_sds_stp_request *stp_req = |
603 | container_of(sci_req, typeof(*stp_req), parent); | ||
607 | 604 | ||
608 | scic_sds_stp_non_ncq_request_construct(sci_req); | 605 | scic_sds_stp_non_ncq_request_construct(sci_req); |
609 | 606 | ||
@@ -634,7 +631,8 @@ static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame( | |||
634 | struct scic_sds_request *sci_req, | 631 | struct scic_sds_request *sci_req, |
635 | u32 length) | 632 | u32 length) |
636 | { | 633 | { |
637 | struct scic_sds_stp_request *stp_req = (struct scic_sds_stp_request *)sci_req; | 634 | struct scic_sds_stp_request *stp_req = |
635 | container_of(sci_req, typeof(*stp_req), parent); | ||
638 | struct scu_sgl_element *current_sgl; | 636 | struct scu_sgl_element *current_sgl; |
639 | 637 | ||
640 | /* | 638 | /* |
@@ -654,7 +652,7 @@ static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame( | |||
654 | task_context->command_iu_upper = current_sgl->address_upper; | 652 | task_context->command_iu_upper = current_sgl->address_upper; |
655 | task_context->command_iu_lower = current_sgl->address_lower; | 653 | task_context->command_iu_lower = current_sgl->address_lower; |
656 | task_context->transfer_length_bytes = length; | 654 | task_context->transfer_length_bytes = length; |
657 | task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA; | 655 | task_context->type.stp.fis_type = FIS_DATA; |
658 | 656 | ||
659 | /* send the new TC out. */ | 657 | /* send the new TC out. */ |
660 | return scic_controller_continue_io(sci_req); | 658 | return scic_controller_continue_io(sci_req); |
@@ -675,7 +673,8 @@ static enum sci_status scic_sds_stp_request_pio_data_out_transmit_data( | |||
675 | u32 remaining_bytes_in_current_sgl = 0; | 673 | u32 remaining_bytes_in_current_sgl = 0; |
676 | enum sci_status status = SCI_SUCCESS; | 674 | enum sci_status status = SCI_SUCCESS; |
677 | 675 | ||
678 | struct scic_sds_stp_request *stp_req = (struct scic_sds_stp_request *)sci_req; | 676 | struct scic_sds_stp_request *stp_req = |
677 | container_of(sci_req, typeof(*stp_req), parent); | ||
679 | 678 | ||
680 | sgl_offset = stp_req->type.pio.request_current.sgl_offset; | 679 | sgl_offset = stp_req->type.pio.request_current.sgl_offset; |
681 | 680 | ||
@@ -855,122 +854,126 @@ static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completi | |||
855 | * enum sci_status | 854 | * enum sci_status |
856 | */ | 855 | */ |
857 | static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( | 856 | static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( |
858 | struct scic_sds_request *request, | 857 | struct scic_sds_request *sci_req, |
859 | u32 frame_index) | 858 | u32 frame_index) |
860 | { | 859 | { |
861 | enum sci_status status; | 860 | enum sci_status status; |
862 | struct sata_fis_header *frame_header; | 861 | struct dev_to_host_fis *frame_header; |
863 | u32 *frame_buffer; | 862 | u32 *frame_buffer; |
864 | struct scic_sds_stp_request *sci_req; | 863 | struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent); |
865 | 864 | struct isci_request *ireq = sci_req->ireq; | |
866 | sci_req = (struct scic_sds_stp_request *)request; | 865 | struct sas_task *task = isci_request_access_task(ireq); |
867 | 866 | ||
868 | status = scic_sds_unsolicited_frame_control_get_header( | 867 | status = scic_sds_unsolicited_frame_control_get_header( |
869 | &(sci_req->parent.owning_controller->uf_control), | 868 | &(stp_req->parent.owning_controller->uf_control), |
870 | frame_index, | 869 | frame_index, |
871 | (void **)&frame_header | 870 | (void **)&frame_header); |
872 | ); | ||
873 | 871 | ||
874 | if (status == SCI_SUCCESS) { | 872 | if (status == SCI_SUCCESS) { |
875 | switch (frame_header->fis_type) { | 873 | switch (frame_header->fis_type) { |
876 | case SATA_FIS_TYPE_PIO_SETUP: | 874 | case FIS_PIO_SETUP: |
877 | /* Get from the frame buffer the PIO Setup Data */ | 875 | /* Get from the frame buffer the PIO Setup Data */ |
878 | scic_sds_unsolicited_frame_control_get_buffer( | 876 | scic_sds_unsolicited_frame_control_get_buffer( |
879 | &(sci_req->parent.owning_controller->uf_control), | 877 | &(stp_req->parent.owning_controller->uf_control), |
880 | frame_index, | 878 | frame_index, |
881 | (void **)&frame_buffer | 879 | (void **)&frame_buffer); |
882 | ); | ||
883 | 880 | ||
884 | /* | 881 | /* Get the data from the PIO Setup The SCU Hardware |
885 | * Get the data from the PIO Setup | 882 | * returns first word in the frame_header and the rest |
886 | * The SCU Hardware returns first word in the frame_header and the rest | 883 | * of the data is in the frame buffer so we need to back |
887 | * of the data is in the frame buffer so we need to back up one dword */ | 884 | * up one dword |
888 | sci_req->type.pio.pio_transfer_bytes = | 885 | */ |
889 | (u16)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->transfter_count; | 886 | |
890 | sci_req->type.pio.ending_status = | 887 | /* transfer_count: first 16bits in the 4th dword */ |
891 | (u8)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->ending_status; | 888 | stp_req->type.pio.pio_transfer_bytes = |
889 | frame_buffer[3] & 0xffff; | ||
890 | |||
891 | /* ending_status: 4th byte in the 3rd dword */ | ||
892 | stp_req->type.pio.ending_status = | ||
893 | (frame_buffer[2] >> 24) & 0xff; | ||
892 | 894 | ||
893 | scic_sds_controller_copy_sata_response( | 895 | scic_sds_controller_copy_sata_response( |
894 | &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer | 896 | &stp_req->d2h_reg_fis, |
895 | ); | 897 | (u32 *)frame_header, |
898 | frame_buffer); | ||
896 | 899 | ||
897 | sci_req->d2h_reg_fis.status = | 900 | stp_req->d2h_reg_fis.status = |
898 | sci_req->type.pio.ending_status; | 901 | stp_req->type.pio.ending_status; |
899 | 902 | ||
900 | /* The next state is dependent on whether the request was PIO Data-in or Data out */ | 903 | /* The next state is dependent on whether the |
901 | if (sci_req->type.pio.sat_protocol == SAT_PROTOCOL_PIO_DATA_IN) { | 904 | * request was PIO Data-in or Data out |
905 | */ | ||
906 | if (task->data_dir == DMA_FROM_DEVICE) { | ||
902 | sci_base_state_machine_change_state( | 907 | sci_base_state_machine_change_state( |
903 | &sci_req->parent.started_substate_machine, | 908 | &stp_req->parent.started_substate_machine, |
904 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE | 909 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE); |
905 | ); | 910 | } else if (task->data_dir == DMA_TO_DEVICE) { |
906 | } else if (sci_req->type.pio.sat_protocol == SAT_PROTOCOL_PIO_DATA_OUT) { | ||
907 | /* Transmit data */ | 911 | /* Transmit data */ |
908 | status = scic_sds_stp_request_pio_data_out_transmit_data(request); | 912 | status = scic_sds_stp_request_pio_data_out_transmit_data(sci_req); |
909 | if (status == SCI_SUCCESS) { | 913 | if (status == SCI_SUCCESS) { |
910 | sci_base_state_machine_change_state( | 914 | sci_base_state_machine_change_state( |
911 | &sci_req->parent.started_substate_machine, | 915 | &stp_req->parent.started_substate_machine, |
912 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE | 916 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE); |
913 | ); | ||
914 | } | 917 | } |
915 | } | 918 | } |
916 | break; | 919 | break; |
917 | 920 | ||
918 | case SATA_FIS_TYPE_SETDEVBITS: | 921 | case FIS_SETDEVBITS: |
919 | sci_base_state_machine_change_state( | 922 | sci_base_state_machine_change_state( |
920 | &sci_req->parent.started_substate_machine, | 923 | &stp_req->parent.started_substate_machine, |
921 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE | 924 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE); |
922 | ); | ||
923 | break; | 925 | break; |
924 | 926 | ||
925 | case SATA_FIS_TYPE_REGD2H: | 927 | case FIS_REGD2H: |
926 | if ((frame_header->status & ATA_STATUS_REG_BSY_BIT) == 0) { | 928 | if ((frame_header->status & ATA_BUSY) == 0) { |
927 | scic_sds_unsolicited_frame_control_get_buffer( | 929 | scic_sds_unsolicited_frame_control_get_buffer( |
928 | &(sci_req->parent.owning_controller->uf_control), | 930 | &(stp_req->parent.owning_controller->uf_control), |
929 | frame_index, | 931 | frame_index, |
930 | (void **)&frame_buffer | 932 | (void **)&frame_buffer); |
931 | ); | ||
932 | 933 | ||
933 | scic_sds_controller_copy_sata_response( | 934 | scic_sds_controller_copy_sata_response( |
934 | &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer); | 935 | &stp_req->d2h_reg_fis, |
936 | (u32 *)frame_header, | ||
937 | frame_buffer); | ||
935 | 938 | ||
936 | scic_sds_request_set_status( | 939 | scic_sds_request_set_status( |
937 | &sci_req->parent, | 940 | &stp_req->parent, |
938 | SCU_TASK_DONE_CHECK_RESPONSE, | 941 | SCU_TASK_DONE_CHECK_RESPONSE, |
939 | SCI_FAILURE_IO_RESPONSE_VALID | 942 | SCI_FAILURE_IO_RESPONSE_VALID); |
940 | ); | ||
941 | 943 | ||
942 | sci_base_state_machine_change_state( | 944 | sci_base_state_machine_change_state( |
943 | &sci_req->parent.state_machine, | 945 | &stp_req->parent.state_machine, |
944 | SCI_BASE_REQUEST_STATE_COMPLETED | 946 | SCI_BASE_REQUEST_STATE_COMPLETED); |
945 | ); | ||
946 | } else { | 947 | } else { |
947 | /* | 948 | /* Now why is the drive sending a D2H Register |
948 | * Now why is the drive sending a D2H Register FIS when it is still busy? | 949 | * FIS when it is still busy? |
949 | * Do nothing since we are still in the right state. */ | 950 | * Do nothing since we are still in the right |
950 | dev_dbg(scic_to_dev(request->owning_controller), | 951 | * state. |
952 | */ | ||
953 | dev_dbg(scic_to_dev(sci_req->owning_controller), | ||
951 | "%s: SCIC PIO Request 0x%p received " | 954 | "%s: SCIC PIO Request 0x%p received " |
952 | "D2H Register FIS with BSY status " | 955 | "D2H Register FIS with BSY status " |
953 | "0x%x\n", | 956 | "0x%x\n", |
954 | __func__, | 957 | __func__, |
955 | sci_req, | 958 | stp_req, |
956 | frame_header->status); | 959 | frame_header->status); |
957 | } | 960 | } |
958 | break; | 961 | break; |
959 | 962 | ||
960 | default: | 963 | default: |
964 | /* FIXME: what do we do here? */ | ||
961 | break; | 965 | break; |
962 | } | 966 | } |
963 | 967 | ||
964 | /* Frame is decoded return it to the controller */ | 968 | /* Frame is decoded return it to the controller */ |
965 | scic_sds_controller_release_frame( | 969 | scic_sds_controller_release_frame( |
966 | sci_req->parent.owning_controller, | 970 | stp_req->parent.owning_controller, |
967 | frame_index | 971 | frame_index); |
968 | ); | ||
969 | } else | 972 | } else |
970 | dev_err(scic_to_dev(request->owning_controller), | 973 | dev_err(scic_to_dev(sci_req->owning_controller), |
971 | "%s: SCIC IO Request 0x%p could not get frame header " | 974 | "%s: SCIC IO Request 0x%p could not get frame header " |
972 | "for frame index %d, status %x\n", | 975 | "for frame index %d, status %x\n", |
973 | __func__, sci_req, frame_index, status); | 976 | __func__, stp_req, frame_index, status); |
974 | 977 | ||
975 | return status; | 978 | return status; |
976 | } | 979 | } |
@@ -983,100 +986,94 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( | |||
983 | * enum sci_status | 986 | * enum sci_status |
984 | */ | 987 | */ |
985 | static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler( | 988 | static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler( |
986 | struct scic_sds_request *request, | 989 | struct scic_sds_request *sci_req, |
987 | u32 frame_index) | 990 | u32 frame_index) |
988 | { | 991 | { |
989 | enum sci_status status; | 992 | enum sci_status status; |
990 | struct sata_fis_header *frame_header; | 993 | struct dev_to_host_fis *frame_header; |
991 | struct sata_fis_data *frame_buffer; | 994 | struct sata_fis_data *frame_buffer; |
992 | struct scic_sds_stp_request *sci_req; | 995 | struct scic_sds_stp_request *stp_req = |
993 | 996 | container_of(sci_req, typeof(*stp_req), parent); | |
994 | sci_req = (struct scic_sds_stp_request *)request; | ||
995 | 997 | ||
996 | status = scic_sds_unsolicited_frame_control_get_header( | 998 | status = scic_sds_unsolicited_frame_control_get_header( |
997 | &(sci_req->parent.owning_controller->uf_control), | 999 | &(stp_req->parent.owning_controller->uf_control), |
998 | frame_index, | 1000 | frame_index, |
999 | (void **)&frame_header | 1001 | (void **)&frame_header); |
1000 | ); | ||
1001 | 1002 | ||
1002 | if (status == SCI_SUCCESS) { | 1003 | if (status == SCI_SUCCESS) { |
1003 | if (frame_header->fis_type == SATA_FIS_TYPE_DATA) { | 1004 | if (frame_header->fis_type == FIS_DATA) { |
1004 | if (sci_req->type.pio.request_current.sgl_pair == NULL) { | 1005 | if (stp_req->type.pio.request_current.sgl_pair == |
1005 | sci_req->parent.saved_rx_frame_index = frame_index; | 1006 | NULL) { |
1006 | sci_req->type.pio.pio_transfer_bytes = 0; | 1007 | stp_req->parent.saved_rx_frame_index = |
1008 | frame_index; | ||
1009 | stp_req->type.pio.pio_transfer_bytes = 0; | ||
1007 | } else { | 1010 | } else { |
1008 | status = scic_sds_unsolicited_frame_control_get_buffer( | 1011 | status = scic_sds_unsolicited_frame_control_get_buffer( |
1009 | &(sci_req->parent.owning_controller->uf_control), | 1012 | &(stp_req->parent.owning_controller->uf_control), |
1010 | frame_index, | 1013 | frame_index, |
1011 | (void **)&frame_buffer | 1014 | (void **)&frame_buffer); |
1012 | ); | ||
1013 | 1015 | ||
1014 | status = scic_sds_stp_request_pio_data_in_copy_data(sci_req, (u8 *)frame_buffer); | 1016 | status = scic_sds_stp_request_pio_data_in_copy_data( |
1017 | stp_req, | ||
1018 | (u8 *)frame_buffer); | ||
1015 | 1019 | ||
1016 | /* Frame is decoded return it to the controller */ | 1020 | /* Frame is decoded return it to the controller */ |
1017 | scic_sds_controller_release_frame( | 1021 | scic_sds_controller_release_frame( |
1018 | sci_req->parent.owning_controller, | 1022 | stp_req->parent.owning_controller, |
1019 | frame_index | 1023 | frame_index); |
1020 | ); | ||
1021 | } | 1024 | } |
1022 | 1025 | ||
1023 | /* | 1026 | /* |
1024 | * Check for the end of the transfer, are there more bytes remaining | 1027 | * Check for the end of the transfer, are there more |
1025 | * for this data transfer */ | 1028 | * bytes remaining for this data transfer |
1026 | if ( | 1029 | */ |
1027 | (status == SCI_SUCCESS) | 1030 | if ((status == SCI_SUCCESS) && |
1028 | && (sci_req->type.pio.pio_transfer_bytes == 0) | 1031 | (stp_req->type.pio.pio_transfer_bytes == 0)) { |
1029 | ) { | 1032 | if ((stp_req->type.pio.ending_status & |
1030 | if ((sci_req->type.pio.ending_status & ATA_STATUS_REG_BSY_BIT) == 0) { | 1033 | ATA_BUSY) == 0) { |
1031 | scic_sds_request_set_status( | 1034 | scic_sds_request_set_status( |
1032 | &sci_req->parent, | 1035 | &stp_req->parent, |
1033 | SCU_TASK_DONE_CHECK_RESPONSE, | 1036 | SCU_TASK_DONE_CHECK_RESPONSE, |
1034 | SCI_FAILURE_IO_RESPONSE_VALID | 1037 | SCI_FAILURE_IO_RESPONSE_VALID); |
1035 | ); | ||
1036 | 1038 | ||
1037 | sci_base_state_machine_change_state( | 1039 | sci_base_state_machine_change_state( |
1038 | &sci_req->parent.state_machine, | 1040 | &stp_req->parent.state_machine, |
1039 | SCI_BASE_REQUEST_STATE_COMPLETED | 1041 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1040 | ); | ||
1041 | } else { | 1042 | } else { |
1042 | sci_base_state_machine_change_state( | 1043 | sci_base_state_machine_change_state( |
1043 | &request->started_substate_machine, | 1044 | &sci_req->started_substate_machine, |
1044 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE | 1045 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE); |
1045 | ); | ||
1046 | } | 1046 | } |
1047 | } | 1047 | } |
1048 | } else { | 1048 | } else { |
1049 | dev_err(scic_to_dev(request->owning_controller), | 1049 | dev_err(scic_to_dev(sci_req->owning_controller), |
1050 | "%s: SCIC PIO Request 0x%p received frame %d " | 1050 | "%s: SCIC PIO Request 0x%p received frame %d " |
1051 | "with fis type 0x%02x when expecting a data " | 1051 | "with fis type 0x%02x when expecting a data " |
1052 | "fis.\n", | 1052 | "fis.\n", |
1053 | __func__, | 1053 | __func__, |
1054 | sci_req, | 1054 | stp_req, |
1055 | frame_index, | 1055 | frame_index, |
1056 | frame_header->fis_type); | 1056 | frame_header->fis_type); |
1057 | 1057 | ||
1058 | scic_sds_request_set_status( | 1058 | scic_sds_request_set_status( |
1059 | &sci_req->parent, | 1059 | &stp_req->parent, |
1060 | SCU_TASK_DONE_GOOD, | 1060 | SCU_TASK_DONE_GOOD, |
1061 | SCI_FAILURE_IO_REQUIRES_SCSI_ABORT | 1061 | SCI_FAILURE_IO_REQUIRES_SCSI_ABORT); |
1062 | ); | ||
1063 | 1062 | ||
1064 | sci_base_state_machine_change_state( | 1063 | sci_base_state_machine_change_state( |
1065 | &sci_req->parent.state_machine, | 1064 | &stp_req->parent.state_machine, |
1066 | SCI_BASE_REQUEST_STATE_COMPLETED | 1065 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1067 | ); | ||
1068 | 1066 | ||
1069 | /* Frame is decoded return it to the controller */ | 1067 | /* Frame is decoded return it to the controller */ |
1070 | scic_sds_controller_release_frame( | 1068 | scic_sds_controller_release_frame( |
1071 | sci_req->parent.owning_controller, | 1069 | stp_req->parent.owning_controller, |
1072 | frame_index | 1070 | frame_index); |
1073 | ); | ||
1074 | } | 1071 | } |
1075 | } else | 1072 | } else |
1076 | dev_err(scic_to_dev(request->owning_controller), | 1073 | dev_err(scic_to_dev(sci_req->owning_controller), |
1077 | "%s: SCIC IO Request 0x%p could not get frame header " | 1074 | "%s: SCIC IO Request 0x%p could not get frame header " |
1078 | "for frame index %d, status %x\n", | 1075 | "for frame index %d, status %x\n", |
1079 | __func__, sci_req, frame_index, status); | 1076 | __func__, stp_req, frame_index, status); |
1080 | 1077 | ||
1081 | return status; | 1078 | return status; |
1082 | } | 1079 | } |
@@ -1094,10 +1091,10 @@ static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_com | |||
1094 | struct scic_sds_request *sci_req, | 1091 | struct scic_sds_request *sci_req, |
1095 | u32 completion_code) | 1092 | u32 completion_code) |
1096 | { | 1093 | { |
1097 | enum sci_status status = SCI_SUCCESS; | 1094 | enum sci_status status = SCI_SUCCESS; |
1098 | bool all_frames_transferred = false; | 1095 | bool all_frames_transferred = false; |
1099 | 1096 | struct scic_sds_stp_request *stp_req = | |
1100 | struct scic_sds_stp_request *stp_req = (struct scic_sds_stp_request *)sci_req; | 1097 | container_of(sci_req, typeof(*stp_req), parent); |
1101 | 1098 | ||
1102 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1099 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
1103 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): | 1100 | case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): |
@@ -1279,11 +1276,12 @@ static const struct sci_base_state scic_sds_stp_request_started_pio_substate_tab | |||
1279 | } | 1276 | } |
1280 | }; | 1277 | }; |
1281 | 1278 | ||
1282 | enum sci_status scic_sds_stp_pio_request_construct(struct scic_sds_request *sci_req, | 1279 | enum sci_status |
1283 | u8 sat_protocol, | 1280 | scic_sds_stp_pio_request_construct(struct scic_sds_request *sci_req, |
1284 | bool copy_rx_frame) | 1281 | bool copy_rx_frame) |
1285 | { | 1282 | { |
1286 | struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent); | 1283 | struct scic_sds_stp_request *stp_req = |
1284 | container_of(sci_req, typeof(*stp_req), parent); | ||
1287 | struct scic_sds_stp_pio_request *pio = &stp_req->type.pio; | 1285 | struct scic_sds_stp_pio_request *pio = &stp_req->type.pio; |
1288 | 1286 | ||
1289 | scic_sds_stp_non_ncq_request_construct(sci_req); | 1287 | scic_sds_stp_non_ncq_request_construct(sci_req); |
@@ -1297,7 +1295,6 @@ enum sci_status scic_sds_stp_pio_request_construct(struct scic_sds_request *sci_ | |||
1297 | 1295 | ||
1298 | pio->request_current.sgl_offset = 0; | 1296 | pio->request_current.sgl_offset = 0; |
1299 | pio->request_current.sgl_set = SCU_SGL_ELEMENT_PAIR_A; | 1297 | pio->request_current.sgl_set = SCU_SGL_ELEMENT_PAIR_A; |
1300 | pio->sat_protocol = sat_protocol; | ||
1301 | 1298 | ||
1302 | if (copy_rx_frame) { | 1299 | if (copy_rx_frame) { |
1303 | scic_sds_request_build_sgl(sci_req); | 1300 | scic_sds_request_build_sgl(sci_req); |
@@ -1340,30 +1337,25 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler( | |||
1340 | u32 frame_index) | 1337 | u32 frame_index) |
1341 | { | 1338 | { |
1342 | enum sci_status status; | 1339 | enum sci_status status; |
1343 | struct sata_fis_header *frame_header; | 1340 | struct dev_to_host_fis *frame_header; |
1344 | u32 *frame_buffer; | 1341 | u32 *frame_buffer; |
1345 | 1342 | ||
1346 | status = scic_sds_unsolicited_frame_control_get_header( | 1343 | status = scic_sds_unsolicited_frame_control_get_header( |
1347 | &sci_req->owning_controller->uf_control, | 1344 | &sci_req->owning_controller->uf_control, |
1348 | frame_index, | 1345 | frame_index, |
1349 | (void **)&frame_header | 1346 | (void **)&frame_header); |
1350 | ); | ||
1351 | 1347 | ||
1352 | if ( | 1348 | if ((status == SCI_SUCCESS) && |
1353 | (status == SCI_SUCCESS) | 1349 | (frame_header->fis_type == FIS_REGD2H)) { |
1354 | && (frame_header->fis_type == SATA_FIS_TYPE_REGD2H) | ||
1355 | ) { | ||
1356 | scic_sds_unsolicited_frame_control_get_buffer( | 1350 | scic_sds_unsolicited_frame_control_get_buffer( |
1357 | &sci_req->owning_controller->uf_control, | 1351 | &sci_req->owning_controller->uf_control, |
1358 | frame_index, | 1352 | frame_index, |
1359 | (void **)&frame_buffer | 1353 | (void **)&frame_buffer); |
1360 | ); | ||
1361 | 1354 | ||
1362 | scic_sds_controller_copy_sata_response( | 1355 | scic_sds_controller_copy_sata_response( |
1363 | &((struct scic_sds_stp_request *)sci_req)->d2h_reg_fis, | 1356 | &((struct scic_sds_stp_request *)sci_req)->d2h_reg_fis, |
1364 | (u32 *)frame_header, | 1357 | (u32 *)frame_header, |
1365 | frame_buffer | 1358 | frame_buffer); |
1366 | ); | ||
1367 | } | 1359 | } |
1368 | 1360 | ||
1369 | scic_sds_controller_release_frame( | 1361 | scic_sds_controller_release_frame( |
@@ -1399,7 +1391,7 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi | |||
1399 | /* | 1391 | /* |
1400 | * We must check ther response buffer to see if the D2H Register FIS was | 1392 | * We must check ther response buffer to see if the D2H Register FIS was |
1401 | * received before we got the TC completion. */ | 1393 | * received before we got the TC completion. */ |
1402 | if (sci_req->d2h_reg_fis.fis_type == SATA_FIS_TYPE_REGD2H) { | 1394 | if (sci_req->d2h_reg_fis.fis_type == FIS_REGD2H) { |
1403 | scic_sds_remote_device_suspend( | 1395 | scic_sds_remote_device_suspend( |
1404 | sci_req->parent.target_device, | 1396 | sci_req->parent.target_device, |
1405 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code)) | 1397 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code)) |
@@ -1648,35 +1640,34 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler( | |||
1648 | u32 frame_index) | 1640 | u32 frame_index) |
1649 | { | 1641 | { |
1650 | enum sci_status status; | 1642 | enum sci_status status; |
1651 | struct sata_fis_header *frame_header; | 1643 | struct dev_to_host_fis *frame_header; |
1652 | u32 *frame_buffer; | 1644 | u32 *frame_buffer; |
1653 | struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request; | 1645 | struct scic_sds_stp_request *stp_req = |
1646 | (struct scic_sds_stp_request *)request; | ||
1654 | 1647 | ||
1655 | status = scic_sds_unsolicited_frame_control_get_header( | 1648 | status = scic_sds_unsolicited_frame_control_get_header( |
1656 | &(sci_req->parent.owning_controller->uf_control), | 1649 | &(stp_req->parent.owning_controller->uf_control), |
1657 | frame_index, | 1650 | frame_index, |
1658 | (void **)&frame_header | 1651 | (void **)&frame_header); |
1659 | ); | ||
1660 | 1652 | ||
1661 | if (status == SCI_SUCCESS) { | 1653 | if (status == SCI_SUCCESS) { |
1662 | switch (frame_header->fis_type) { | 1654 | switch (frame_header->fis_type) { |
1663 | case SATA_FIS_TYPE_REGD2H: | 1655 | case FIS_REGD2H: |
1664 | scic_sds_unsolicited_frame_control_get_buffer( | 1656 | scic_sds_unsolicited_frame_control_get_buffer( |
1665 | &(sci_req->parent.owning_controller->uf_control), | 1657 | &(stp_req->parent.owning_controller->uf_control), |
1666 | frame_index, | 1658 | frame_index, |
1667 | (void **)&frame_buffer | 1659 | (void **)&frame_buffer); |
1668 | ); | ||
1669 | 1660 | ||
1670 | scic_sds_controller_copy_sata_response( | 1661 | scic_sds_controller_copy_sata_response( |
1671 | &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer | 1662 | &stp_req->d2h_reg_fis, |
1672 | ); | 1663 | (u32 *)frame_header, |
1664 | frame_buffer); | ||
1673 | 1665 | ||
1674 | /* The command has completed with error */ | 1666 | /* The command has completed with error */ |
1675 | scic_sds_request_set_status( | 1667 | scic_sds_request_set_status( |
1676 | &sci_req->parent, | 1668 | &stp_req->parent, |
1677 | SCU_TASK_DONE_CHECK_RESPONSE, | 1669 | SCU_TASK_DONE_CHECK_RESPONSE, |
1678 | SCI_FAILURE_IO_RESPONSE_VALID | 1670 | SCI_FAILURE_IO_RESPONSE_VALID); |
1679 | ); | ||
1680 | break; | 1671 | break; |
1681 | 1672 | ||
1682 | default: | 1673 | default: |
@@ -1684,30 +1675,28 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler( | |||
1684 | "%s: IO Request:0x%p Frame Id:%d protocol " | 1675 | "%s: IO Request:0x%p Frame Id:%d protocol " |
1685 | "violation occurred\n", | 1676 | "violation occurred\n", |
1686 | __func__, | 1677 | __func__, |
1687 | sci_req, | 1678 | stp_req, |
1688 | frame_index); | 1679 | frame_index); |
1689 | 1680 | ||
1690 | scic_sds_request_set_status( | 1681 | scic_sds_request_set_status( |
1691 | &sci_req->parent, | 1682 | &stp_req->parent, |
1692 | SCU_TASK_DONE_UNEXP_FIS, | 1683 | SCU_TASK_DONE_UNEXP_FIS, |
1693 | SCI_FAILURE_PROTOCOL_VIOLATION | 1684 | SCI_FAILURE_PROTOCOL_VIOLATION); |
1694 | ); | ||
1695 | break; | 1685 | break; |
1696 | } | 1686 | } |
1697 | 1687 | ||
1698 | sci_base_state_machine_change_state( | 1688 | sci_base_state_machine_change_state( |
1699 | &sci_req->parent.state_machine, | 1689 | &stp_req->parent.state_machine, |
1700 | SCI_BASE_REQUEST_STATE_COMPLETED); | 1690 | SCI_BASE_REQUEST_STATE_COMPLETED); |
1701 | 1691 | ||
1702 | /* Frame has been decoded return it to the controller */ | 1692 | /* Frame has been decoded return it to the controller */ |
1703 | scic_sds_controller_release_frame( | 1693 | scic_sds_controller_release_frame( |
1704 | sci_req->parent.owning_controller, frame_index | 1694 | stp_req->parent.owning_controller, frame_index); |
1705 | ); | ||
1706 | } else | 1695 | } else |
1707 | dev_err(scic_to_dev(request->owning_controller), | 1696 | dev_err(scic_to_dev(request->owning_controller), |
1708 | "%s: SCIC IO Request 0x%p could not get frame header " | 1697 | "%s: SCIC IO Request 0x%p could not get frame header " |
1709 | "for frame index %d, status %x\n", | 1698 | "for frame index %d, status %x\n", |
1710 | __func__, sci_req, frame_index, status); | 1699 | __func__, stp_req, frame_index, status); |
1711 | 1700 | ||
1712 | return status; | 1701 | return status; |
1713 | } | 1702 | } |
@@ -1798,7 +1787,8 @@ static const struct sci_base_state scic_sds_stp_request_started_soft_reset_subst | |||
1798 | 1787 | ||
1799 | enum sci_status scic_sds_stp_soft_reset_request_construct(struct scic_sds_request *sci_req) | 1788 | enum sci_status scic_sds_stp_soft_reset_request_construct(struct scic_sds_request *sci_req) |
1800 | { | 1789 | { |
1801 | struct scic_sds_stp_request *stp_req = container_of(sci_req, typeof(*stp_req), parent); | 1790 | struct scic_sds_stp_request *stp_req = |
1791 | container_of(sci_req, typeof(*stp_req), parent); | ||
1802 | 1792 | ||
1803 | scic_sds_stp_non_ncq_request_construct(sci_req); | 1793 | scic_sds_stp_non_ncq_request_construct(sci_req); |
1804 | 1794 | ||
diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.h b/drivers/scsi/isci/core/scic_sds_stp_request.h index 807bc4eeb821..50cb48ef554e 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.h +++ b/drivers/scsi/isci/core/scic_sds_stp_request.h | |||
@@ -57,7 +57,7 @@ | |||
57 | #define _SCIC_SDS_STP_REQUEST_T_ | 57 | #define _SCIC_SDS_STP_REQUEST_T_ |
58 | 58 | ||
59 | #include <linux/dma-mapping.h> | 59 | #include <linux/dma-mapping.h> |
60 | #include "intel_sata.h" | 60 | #include <scsi/sas.h> |
61 | #include "scic_sds_request.h" | 61 | #include "scic_sds_request.h" |
62 | 62 | ||
63 | /** | 63 | /** |
@@ -111,11 +111,6 @@ struct scic_sds_stp_request { | |||
111 | */ | 111 | */ |
112 | u8 ending_error; | 112 | u8 ending_error; |
113 | 113 | ||
114 | /** | ||
115 | * Protocol Type. This is filled in by core during IO Request construction type. | ||
116 | */ | ||
117 | u8 sat_protocol; | ||
118 | |||
119 | struct scic_sds_request_pio_sgl { | 114 | struct scic_sds_request_pio_sgl { |
120 | struct scu_sgl_element_pair *sgl_pair; | 115 | struct scu_sgl_element_pair *sgl_pair; |
121 | u8 sgl_set; | 116 | u8 sgl_set; |
@@ -173,7 +168,6 @@ u32 scic_sds_stp_request_get_object_size(void); | |||
173 | 168 | ||
174 | enum sci_status scic_sds_stp_pio_request_construct( | 169 | enum sci_status scic_sds_stp_pio_request_construct( |
175 | struct scic_sds_request *scic_io_request, | 170 | struct scic_sds_request *scic_io_request, |
176 | u8 sat_protocol, | ||
177 | bool copy_rx_frame); | 171 | bool copy_rx_frame); |
178 | 172 | ||
179 | enum sci_status scic_sds_stp_udma_request_construct( | 173 | enum sci_status scic_sds_stp_udma_request_construct( |
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index a23ebe85773e..e766b27bdc19 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -53,7 +53,7 @@ | |||
53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
54 | */ | 54 | */ |
55 | #include "intel_sas.h" | 55 | #include "intel_sas.h" |
56 | #include "intel_ata.h" | 56 | #include "sas.h" |
57 | #include "isci.h" | 57 | #include "isci.h" |
58 | #include "port.h" | 58 | #include "port.h" |
59 | #include "remote_device.h" | 59 | #include "remote_device.h" |
@@ -327,7 +327,7 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
327 | break; | 327 | break; |
328 | } | 328 | } |
329 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: { | 329 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: { |
330 | struct sata_fis_header *hdr; | 330 | struct dev_to_host_fis *hdr; |
331 | 331 | ||
332 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, | 332 | status = scic_sds_unsolicited_frame_control_get_header(&scic->uf_control, |
333 | frame_index, | 333 | frame_index, |
@@ -335,14 +335,14 @@ enum sci_status scic_sds_remote_device_frame_handler(struct scic_sds_remote_devi | |||
335 | if (status != SCI_SUCCESS) | 335 | if (status != SCI_SUCCESS) |
336 | return status; | 336 | return status; |
337 | 337 | ||
338 | if (hdr->fis_type == SATA_FIS_TYPE_SETDEVBITS && | 338 | if (hdr->fis_type == FIS_SETDEVBITS && |
339 | (hdr->status & ATA_STATUS_REG_ERROR_BIT)) { | 339 | (hdr->status & ATA_ERR)) { |
340 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; | 340 | sci_dev->not_ready_reason = SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; |
341 | 341 | ||
342 | /* TODO Check sactive and complete associated IO if any. */ | 342 | /* TODO Check sactive and complete associated IO if any. */ |
343 | sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR); | 343 | sci_base_state_machine_change_state(sm, SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR); |
344 | } else if (hdr->fis_type == SATA_FIS_TYPE_REGD2H && | 344 | } else if (hdr->fis_type == FIS_REGD2H && |
345 | (hdr->status & ATA_STATUS_REG_ERROR_BIT)) { | 345 | (hdr->status & ATA_ERR)) { |
346 | /* | 346 | /* |
347 | * Some devices return D2H FIS when an NCQ error is detected. | 347 | * Some devices return D2H FIS when an NCQ error is detected. |
348 | * Treat this like an SDB error FIS ready reason. | 348 | * Treat this like an SDB error FIS ready reason. |
@@ -469,6 +469,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
469 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 469 | struct sci_base_state_machine *sm = &sci_dev->state_machine; |
470 | enum scic_sds_remote_device_states state = sm->current_state_id; | 470 | enum scic_sds_remote_device_states state = sm->current_state_id; |
471 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 471 | struct scic_sds_port *sci_port = sci_dev->owning_port; |
472 | struct isci_request *ireq = sci_req->ireq; | ||
472 | enum sci_status status; | 473 | enum sci_status status; |
473 | 474 | ||
474 | switch (state) { | 475 | switch (state) { |
@@ -510,6 +511,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
510 | * substate. | 511 | * substate. |
511 | */ | 512 | */ |
512 | enum scic_sds_remote_device_states new_state; | 513 | enum scic_sds_remote_device_states new_state; |
514 | struct sas_task *task = isci_request_access_task(ireq); | ||
513 | 515 | ||
514 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); | 516 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); |
515 | if (status != SCI_SUCCESS) | 517 | if (status != SCI_SUCCESS) |
@@ -523,7 +525,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
523 | if (status != SCI_SUCCESS) | 525 | if (status != SCI_SUCCESS) |
524 | break; | 526 | break; |
525 | 527 | ||
526 | if (isci_sata_get_sat_protocol(sci_req->ireq) == SAT_PROTOCOL_FPDMA) | 528 | if (task->ata_task.use_ncq) |
527 | new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ; | 529 | new_state = SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ; |
528 | else { | 530 | else { |
529 | sci_dev->working_request = sci_req; | 531 | sci_dev->working_request = sci_req; |
@@ -532,8 +534,10 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
532 | sci_base_state_machine_change_state(sm, new_state); | 534 | sci_base_state_machine_change_state(sm, new_state); |
533 | break; | 535 | break; |
534 | } | 536 | } |
535 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: | 537 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ: { |
536 | if (isci_sata_get_sat_protocol(sci_req->ireq) == SAT_PROTOCOL_FPDMA) { | 538 | struct sas_task *task = isci_request_access_task(ireq); |
539 | |||
540 | if (task->ata_task.use_ncq) { | ||
537 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); | 541 | status = scic_sds_port_start_io(sci_port, sci_dev, sci_req); |
538 | if (status != SCI_SUCCESS) | 542 | if (status != SCI_SUCCESS) |
539 | return status; | 543 | return status; |
@@ -546,6 +550,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
546 | } else | 550 | } else |
547 | return SCI_FAILURE_INVALID_STATE; | 551 | return SCI_FAILURE_INVALID_STATE; |
548 | break; | 552 | break; |
553 | } | ||
549 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: | 554 | case SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET: |
550 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; | 555 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
551 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: | 556 | case SCIC_SDS_SMP_REMOTE_DEVICE_READY_SUBSTATE_IDLE: |
diff --git a/drivers/scsi/isci/core/intel_sat.h b/drivers/scsi/isci/sas.h index c4d78ed35cf1..05af8bd61453 100644 --- a/drivers/scsi/isci/core/intel_sat.h +++ b/drivers/scsi/isci/sas.h | |||
@@ -53,43 +53,20 @@ | |||
53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #ifndef _SAT_H_ | 56 | #ifndef _SCI_SAS_H_ |
57 | #define _SAT_H_ | 57 | #define _SCI_SAS_H_ |
58 | 58 | /* | |
59 | /** | 59 | * SATA FIS Types These constants depict the various SATA FIS types devined in |
60 | * This file contains constants and constructs defined in the SCSI to ATA | 60 | * the serial ATA specification. |
61 | * Translation (SAT) T10 standard. For more information please refer to | 61 | * XXX: This needs to go into <scsi/sas.h> |
62 | * www.t10.org. | ||
63 | * | ||
64 | * | ||
65 | */ | ||
66 | |||
67 | /** | ||
68 | * | ||
69 | * | ||
70 | * SAT_PROTOCOLS These constants indicate the various protocol values that can | ||
71 | * be supported in a SAT translator. | ||
72 | */ | 62 | */ |
73 | #define SAT_PROTOCOL_ATA_HARD_RESET 0 | 63 | #define FIS_REGH2D 0x27 |
74 | #define SAT_PROTOCOL_SOFT_RESET 1 | 64 | #define FIS_REGD2H 0x34 |
75 | #define SAT_PROTOCOL_NON_DATA 3 | 65 | #define FIS_SETDEVBITS 0xA1 |
76 | #define SAT_PROTOCOL_PIO_DATA_IN 4 | 66 | #define FIS_DMA_ACTIVATE 0x39 |
77 | #define SAT_PROTOCOL_PIO_DATA_OUT 5 | 67 | #define FIS_DMA_SETUP 0x41 |
78 | #define SAT_PROTOCOL_DMA 6 | 68 | #define FIS_BIST_ACTIVATE 0x58 |
79 | #define SAT_PROTOCOL_DMA_QUEUED 7 | 69 | #define FIS_PIO_SETUP 0x5F |
80 | #define SAT_PROTOCOL_DEVICE_DIAGNOSTIC 8 | 70 | #define FIS_DATA 0x46 |
81 | #define SAT_PROTOCOL_DEVICE_RESET 9 | ||
82 | #define SAT_PROTOCOL_UDMA_DATA_IN 10 | ||
83 | #define SAT_PROTOCOL_UDMA_DATA_OUT 11 | ||
84 | #define SAT_PROTOCOL_FPDMA 12 | ||
85 | #define SAT_PROTOCOL_RETURN_RESPONSE_INFO 15 | ||
86 | |||
87 | #define SAT_PROTOCOL_PACKET 0x10 | ||
88 | #define SAT_PROTOCOL_PACKET_NON_DATA (SAT_PROTOCOL_PACKET | 0x0) | ||
89 | #define SAT_PROTOCOL_PACKET_DMA_DATA_IN (SAT_PROTOCOL_PACKET | 0x1) | ||
90 | #define SAT_PROTOCOL_PACKET_DMA_DATA_OUT (SAT_PROTOCOL_PACKET | 0x2) | ||
91 | #define SAT_PROTOCOL_PACKET_PIO_DATA_IN (SAT_PROTOCOL_PACKET | 0x3) | ||
92 | #define SAT_PROTOCOL_PACKET_PIO_DATA_OUT (SAT_PROTOCOL_PACKET | 0x4) | ||
93 | |||
94 | #endif /* _SAT_H_ */ | ||
95 | 71 | ||
72 | #endif | ||
diff --git a/drivers/scsi/isci/sata.c b/drivers/scsi/isci/sata.c index 08374505832e..a08fcf511908 100644 --- a/drivers/scsi/isci/sata.c +++ b/drivers/scsi/isci/sata.c | |||
@@ -61,11 +61,6 @@ | |||
61 | #include "task.h" | 61 | #include "task.h" |
62 | #include "request.h" | 62 | #include "request.h" |
63 | #include "sata.h" | 63 | #include "sata.h" |
64 | #include "intel_sat.h" | ||
65 | #include "intel_ata.h" | ||
66 | |||
67 | static u8 isci_sata_get_management_task_protocol(struct isci_tmf *tmf); | ||
68 | |||
69 | 64 | ||
70 | /** | 65 | /** |
71 | * isci_sata_task_to_fis_copy() - This function gets the host_to_dev_fis from | 66 | * isci_sata_task_to_fis_copy() - This function gets the host_to_dev_fis from |
@@ -158,7 +153,7 @@ void isci_request_process_stp_response(struct sas_task *task, | |||
158 | * If the device fault bit is set in the status register, then | 153 | * If the device fault bit is set in the status register, then |
159 | * set the sense data and return. | 154 | * set the sense data and return. |
160 | */ | 155 | */ |
161 | if (d2h_reg_fis->status & ATA_STATUS_REG_DEVICE_FAULT_BIT) | 156 | if (d2h_reg_fis->status & ATA_DF) |
162 | ts->stat = SAS_PROTO_RESPONSE; | 157 | ts->stat = SAS_PROTO_RESPONSE; |
163 | else | 158 | else |
164 | ts->stat = SAM_STAT_GOOD; | 159 | ts->stat = SAM_STAT_GOOD; |
@@ -166,74 +161,6 @@ void isci_request_process_stp_response(struct sas_task *task, | |||
166 | ts->resp = SAS_TASK_COMPLETE; | 161 | ts->resp = SAS_TASK_COMPLETE; |
167 | } | 162 | } |
168 | 163 | ||
169 | /** | ||
170 | * isci_sata_get_sat_protocol() - retrieve the sat protocol for the request | ||
171 | * @isci_request: ata request | ||
172 | * | ||
173 | * Note: temporary implementation until expert mode removes the callback | ||
174 | * | ||
175 | */ | ||
176 | u8 isci_sata_get_sat_protocol(struct isci_request *isci_request) | ||
177 | { | ||
178 | struct sas_task *task; | ||
179 | struct domain_device *dev; | ||
180 | |||
181 | dev_dbg(&isci_request->isci_host->pdev->dev, | ||
182 | "%s: isci_request = %p, ttype = %d\n", | ||
183 | __func__, isci_request, isci_request->ttype); | ||
184 | |||
185 | if (tmf_task == isci_request->ttype) { | ||
186 | struct isci_tmf *tmf = isci_request_access_tmf(isci_request); | ||
187 | |||
188 | return isci_sata_get_management_task_protocol(tmf); | ||
189 | } | ||
190 | |||
191 | task = isci_request_access_task(isci_request); | ||
192 | dev = task->dev; | ||
193 | |||
194 | if (!sas_protocol_ata(task->task_proto)) { | ||
195 | WARN(1, "unhandled task protocol\n"); | ||
196 | return SAT_PROTOCOL_NON_DATA; | ||
197 | } | ||
198 | |||
199 | if (task->data_dir == DMA_NONE) | ||
200 | return SAT_PROTOCOL_NON_DATA; | ||
201 | |||
202 | /* the "_IN" protocol types are equivalent to their "_OUT" | ||
203 | * analogs as far as the core is concerned | ||
204 | */ | ||
205 | if (dev->sata_dev.command_set == ATAPI_COMMAND_SET) { | ||
206 | if (task->ata_task.dma_xfer) | ||
207 | return SAT_PROTOCOL_PACKET_DMA_DATA_IN; | ||
208 | else | ||
209 | return SAT_PROTOCOL_PACKET_PIO_DATA_IN; | ||
210 | } | ||
211 | |||
212 | if (task->ata_task.use_ncq) | ||
213 | return SAT_PROTOCOL_FPDMA; | ||
214 | |||
215 | if (task->ata_task.dma_xfer) | ||
216 | return SAT_PROTOCOL_UDMA_DATA_IN; | ||
217 | else | ||
218 | return SAT_PROTOCOL_PIO_DATA_IN; | ||
219 | } | ||
220 | |||
221 | static u8 isci_sata_get_management_task_protocol( | ||
222 | struct isci_tmf *tmf) | ||
223 | { | ||
224 | u8 ret = 0; | ||
225 | |||
226 | pr_warn("tmf = %p, func = %d\n", tmf, tmf->tmf_code); | ||
227 | |||
228 | if ((tmf->tmf_code == isci_tmf_sata_srst_high) || | ||
229 | (tmf->tmf_code == isci_tmf_sata_srst_low)) { | ||
230 | pr_warn("%s: tmf->tmf_code == TMF_LU_RESET\n", __func__); | ||
231 | ret = SAT_PROTOCOL_SOFT_RESET; | ||
232 | } | ||
233 | |||
234 | return ret; | ||
235 | } | ||
236 | |||
237 | enum sci_status isci_sata_management_task_request_build( | 164 | enum sci_status isci_sata_management_task_request_build( |
238 | struct isci_request *isci_request) | 165 | struct isci_request *isci_request) |
239 | { | 166 | { |
diff --git a/drivers/scsi/isci/sata.h b/drivers/scsi/isci/sata.h index b6ba25b52d2c..1b89f1f75770 100644 --- a/drivers/scsi/isci/sata.h +++ b/drivers/scsi/isci/sata.h | |||
@@ -53,10 +53,6 @@ | |||
53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
54 | */ | 54 | */ |
55 | 55 | ||
56 | #include "intel_sat.h" | ||
57 | |||
58 | |||
59 | |||
60 | struct host_to_dev_fis *isci_sata_task_to_fis_copy( | 56 | struct host_to_dev_fis *isci_sata_task_to_fis_copy( |
61 | struct sas_task *task); | 57 | struct sas_task *task); |
62 | 58 | ||