1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55#ifndef _ISCI_TASK_H_
56#define _ISCI_TASK_H_
57
58#include <scsi/sas_ata.h>
59#include "host.h"
60
61#define ISCI_TERMINATION_TIMEOUT_MSEC 500
62
63struct isci_request;
64
65
66
67
68
69
70
71enum isci_tmf_function_codes {
72
73 isci_tmf_func_none = 0,
74 isci_tmf_ssp_task_abort = TMF_ABORT_TASK,
75 isci_tmf_ssp_lun_reset = TMF_LU_RESET,
76};
77
78
79
80
81
82
83
84struct isci_tmf {
85
86 struct completion *complete;
87 enum sas_protocol proto;
88 union {
89 struct ssp_response_iu resp_iu;
90 struct dev_to_host_fis d2h_fis;
91 u8 rsp_buf[SSP_RESP_IU_MAX_SIZE];
92 } resp;
93 unsigned char lun[8];
94 u16 io_tag;
95 enum isci_tmf_function_codes tmf_code;
96 int status;
97};
98
99static inline void isci_print_tmf(struct isci_host *ihost, struct isci_tmf *tmf)
100{
101 if (SAS_PROTOCOL_SATA == tmf->proto)
102 dev_dbg(&ihost->pdev->dev,
103 "%s: status = %x\n"
104 "tmf->resp.d2h_fis.status = %x\n"
105 "tmf->resp.d2h_fis.error = %x\n",
106 __func__,
107 tmf->status,
108 tmf->resp.d2h_fis.status,
109 tmf->resp.d2h_fis.error);
110 else
111 dev_dbg(&ihost->pdev->dev,
112 "%s: status = %x\n"
113 "tmf->resp.resp_iu.data_present = %x\n"
114 "tmf->resp.resp_iu.status = %x\n"
115 "tmf->resp.resp_iu.data_length = %x\n"
116 "tmf->resp.resp_iu.data[0] = %x\n"
117 "tmf->resp.resp_iu.data[1] = %x\n"
118 "tmf->resp.resp_iu.data[2] = %x\n"
119 "tmf->resp.resp_iu.data[3] = %x\n",
120 __func__,
121 tmf->status,
122 tmf->resp.resp_iu.datapres,
123 tmf->resp.resp_iu.status,
124 be32_to_cpu(tmf->resp.resp_iu.response_data_len),
125 tmf->resp.resp_iu.resp_data[0],
126 tmf->resp.resp_iu.resp_data[1],
127 tmf->resp.resp_iu.resp_data[2],
128 tmf->resp.resp_iu.resp_data[3]);
129}
130
131
132int isci_task_execute_task(
133 struct sas_task *task,
134 int num,
135 gfp_t gfp_flags);
136
137int isci_task_abort_task(
138 struct sas_task *task);
139
140int isci_task_abort_task_set(
141 struct domain_device *d_device,
142 u8 *lun);
143
144int isci_task_clear_aca(
145 struct domain_device *d_device,
146 u8 *lun);
147
148int isci_task_clear_task_set(
149 struct domain_device *d_device,
150 u8 *lun);
151
152int isci_task_query_task(
153 struct sas_task *task);
154
155int isci_task_lu_reset(
156 struct domain_device *d_device,
157 u8 *lun);
158
159int isci_task_clear_nexus_port(
160 struct asd_sas_port *port);
161
162int isci_task_clear_nexus_ha(
163 struct sas_ha_struct *ha);
164
165int isci_task_I_T_nexus_reset(
166 struct domain_device *d_device);
167
168void isci_task_request_complete(
169 struct isci_host *isci_host,
170 struct isci_request *request,
171 enum sci_task_status completion_status);
172
173u16 isci_task_ssp_request_get_io_tag_to_manage(
174 struct isci_request *request);
175
176u8 isci_task_ssp_request_get_function(
177 struct isci_request *request);
178
179
180void *isci_task_ssp_request_get_response_data_address(
181 struct isci_request *request);
182
183u32 isci_task_ssp_request_get_response_data_length(
184 struct isci_request *request);
185
186int isci_queuecommand(
187 struct scsi_cmnd *scsi_cmd,
188 void (*donefunc)(struct scsi_cmnd *));
189
190#endif
191