diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-08 05:35:32 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:47 -0400 |
commit | b7645818cff1536038c0b21407eefb6b9d5755e6 (patch) | |
tree | 5b44923a329f8c00ca076ee38e1713c68a0315ab /drivers/scsi | |
parent | 26298264a5de6d46d6e872dfd4c5d14c3011666f (diff) |
isci: make command/response iu explicit request object members
Final elimination of the anonymous data at the end of the request
structure.
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/isci/core/scic_io_request.h | 61 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.c | 178 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.h | 30 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_smp_request.c | 62 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.c | 101 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.h | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/host.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/request.c | 31 | ||||
-rw-r--r-- | drivers/scsi/isci/sata.c | 55 | ||||
-rw-r--r-- | drivers/scsi/isci/task.c | 5 |
10 files changed, 104 insertions, 423 deletions
diff --git a/drivers/scsi/isci/core/scic_io_request.h b/drivers/scsi/isci/core/scic_io_request.h index 6ddf3801daf8..cb3667decb3c 100644 --- a/drivers/scsi/isci/core/scic_io_request.h +++ b/drivers/scsi/isci/core/scic_io_request.h | |||
@@ -104,14 +104,6 @@ typedef enum { | |||
104 | 104 | ||
105 | 105 | ||
106 | /** | 106 | /** |
107 | * scic_io_request_get_object_size() - This method simply returns the size | ||
108 | * required to build an SCI based IO request object. | ||
109 | * | ||
110 | * Return the size of the SCI IO request object. | ||
111 | */ | ||
112 | u32 scic_io_request_get_object_size(void); | ||
113 | |||
114 | /** | ||
115 | * scic_io_request_construct() - This method is called by the SCI user to | 107 | * scic_io_request_construct() - This method is called by the SCI user to |
116 | * construct all SCI Core IO requests. Memory initialization and | 108 | * construct all SCI Core IO requests. Memory initialization and |
117 | * functionality common to all IO request types is performed in this method. | 109 | * functionality common to all IO request types is performed in this method. |
@@ -222,32 +214,6 @@ enum sci_status scic_io_request_construct_smp( | |||
222 | u32 scic_request_get_controller_status( | 214 | u32 scic_request_get_controller_status( |
223 | struct scic_sds_request *io_request); | 215 | struct scic_sds_request *io_request); |
224 | 216 | ||
225 | |||
226 | |||
227 | /** | ||
228 | * scic_io_request_get_command_iu_address() - This method will return the | ||
229 | * address to the command information unit. | ||
230 | * @scic_io_request: This parameter specifies the handle to the io request | ||
231 | * object to be built. | ||
232 | * | ||
233 | * The address of the SSP/SMP command information unit. | ||
234 | */ | ||
235 | void *scic_io_request_get_command_iu_address( | ||
236 | struct scic_sds_request *scic_io_request); | ||
237 | |||
238 | /** | ||
239 | * scic_io_request_get_response_iu_address() - This method will return the | ||
240 | * address to the response information unit. For an SSP request this buffer | ||
241 | * is only valid if the IO request is completed with the status | ||
242 | * SCI_FAILURE_IO_RESPONSE_VALID. | ||
243 | * @scic_io_request: This parameter specifies the handle to the io request | ||
244 | * object to be built. | ||
245 | * | ||
246 | * The address of the SSP/SMP response information unit. | ||
247 | */ | ||
248 | void *scic_io_request_get_response_iu_address( | ||
249 | struct scic_sds_request *scic_io_request); | ||
250 | |||
251 | /** | 217 | /** |
252 | * scic_io_request_get_io_tag() - This method will return the IO tag utilized | 218 | * scic_io_request_get_io_tag() - This method will return the IO tag utilized |
253 | * by the IO request. | 219 | * by the IO request. |
@@ -280,33 +246,6 @@ void scic_stp_io_request_set_ncq_tag( | |||
280 | u16 ncq_tag); | 246 | u16 ncq_tag); |
281 | 247 | ||
282 | /** | 248 | /** |
283 | * scic_stp_io_request_get_h2d_reg_address() - This method will return the | ||
284 | * address of the host to device register fis region for the io request | ||
285 | * object. | ||
286 | * @scic_io_request: This parameter specifies the handle to the io request | ||
287 | * object from which to get the host to device register fis buffer. | ||
288 | * | ||
289 | * The address of the host to device register fis buffer in the io request | ||
290 | * object. This function is only valid for SATA requests. | ||
291 | */ | ||
292 | void *scic_stp_io_request_get_h2d_reg_address( | ||
293 | struct scic_sds_request *scic_io_request); | ||
294 | |||
295 | /** | ||
296 | * scic_stp_io_request_get_d2h_reg_address() - This method will return the | ||
297 | * address of the device to host register fis region for the io request | ||
298 | * object. | ||
299 | * @scic_io_request: This parameter specifies teh handle to the io request | ||
300 | * object from which to get the device to host register fis buffer. | ||
301 | * | ||
302 | * The address fo the device to host register fis ending the io request. This | ||
303 | * function is only valid for SATA requests. | ||
304 | */ | ||
305 | void *scic_stp_io_request_get_d2h_reg_address( | ||
306 | struct scic_sds_request *scic_io_request); | ||
307 | |||
308 | |||
309 | /** | ||
310 | * scic_io_request_get_number_of_bytes_transferred() - This method will return | 249 | * scic_io_request_get_number_of_bytes_transferred() - This method will return |
311 | * the number of bytes transferred from the SCU | 250 | * the number of bytes transferred from the SCU |
312 | * @scic_io_request: This parameter specifies the handle to the io request | 251 | * @scic_io_request: This parameter specifies the handle to the io request |
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index baf69edab699..36c2b310c175 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c | |||
@@ -83,93 +83,6 @@ | |||
83 | #define SCIC_SDS_IO_REQUEST_MINIMUM_TIMER_COUNT (0) | 83 | #define SCIC_SDS_IO_REQUEST_MINIMUM_TIMER_COUNT (0) |
84 | #define SCIC_SDS_IO_REQUEST_MAXIMUM_TIMER_COUNT (0) | 84 | #define SCIC_SDS_IO_REQUEST_MAXIMUM_TIMER_COUNT (0) |
85 | 85 | ||
86 | /* | ||
87 | * **************************************************************************** | ||
88 | * * SCIC SDS IO REQUEST MACROS | ||
89 | * **************************************************************************** */ | ||
90 | |||
91 | /** | ||
92 | * scic_ssp_io_request_get_object_size() - | ||
93 | * | ||
94 | * This macro returns the sizeof memory required to store the an SSP IO | ||
95 | * request. This does not include the size of the SGL or SCU Task Context | ||
96 | * memory. | ||
97 | */ | ||
98 | #define scic_ssp_io_request_get_object_size() \ | ||
99 | (\ | ||
100 | sizeof(struct ssp_cmd_iu) \ | ||
101 | + SSP_RESP_IU_MAX_SIZE \ | ||
102 | ) | ||
103 | |||
104 | /** | ||
105 | * scic_sds_ssp_request_get_command_buffer() - | ||
106 | * | ||
107 | * This macro returns the address of the ssp command buffer in the io request | ||
108 | * memory | ||
109 | */ | ||
110 | #define scic_sds_ssp_request_get_command_buffer(memory) \ | ||
111 | ((struct ssp_cmd_iu *)(\ | ||
112 | ((char *)(memory)) + sizeof(struct scic_sds_request) \ | ||
113 | )) | ||
114 | |||
115 | /** | ||
116 | * scic_sds_ssp_request_get_response_buffer() - | ||
117 | * | ||
118 | * This macro returns the address of the ssp response buffer in the io request | ||
119 | * memory | ||
120 | */ | ||
121 | #define scic_sds_ssp_request_get_response_buffer(memory) \ | ||
122 | ((struct ssp_response_iu *)(\ | ||
123 | ((char *)(scic_sds_ssp_request_get_command_buffer(memory))) \ | ||
124 | + sizeof(struct ssp_cmd_iu) \ | ||
125 | )) | ||
126 | |||
127 | /** | ||
128 | * scic_ssp_task_request_get_object_size() - | ||
129 | * | ||
130 | * This macro returns the sizeof of memory required to store an SSP Task | ||
131 | * request. This does not include the size of the SCU Task Context memory. | ||
132 | */ | ||
133 | #define scic_ssp_task_request_get_object_size() \ | ||
134 | (\ | ||
135 | sizeof(struct ssp_task_iu) \ | ||
136 | + SSP_RESP_IU_MAX_SIZE \ | ||
137 | ) | ||
138 | |||
139 | /** | ||
140 | * scic_sds_ssp_task_request_get_command_buffer() - | ||
141 | * | ||
142 | * This macro returns the address of the ssp command buffer in the task request | ||
143 | * memory. Yes its the same as the above macro except for the name. | ||
144 | */ | ||
145 | #define scic_sds_ssp_task_request_get_command_buffer(memory) \ | ||
146 | ((struct ssp_task_iu *)(\ | ||
147 | ((char *)(memory)) + sizeof(struct scic_sds_request) \ | ||
148 | )) | ||
149 | |||
150 | /** | ||
151 | * scic_sds_ssp_task_request_get_response_buffer() - | ||
152 | * | ||
153 | * This macro returns the address of the ssp response buffer in the task | ||
154 | * request memory. | ||
155 | */ | ||
156 | #define scic_sds_ssp_task_request_get_response_buffer(memory) \ | ||
157 | ((struct ssp_response_iu *)(\ | ||
158 | ((char *)(scic_sds_ssp_task_request_get_command_buffer(memory))) \ | ||
159 | + sizeof(struct ssp_task_iu) \ | ||
160 | )) | ||
161 | |||
162 | /** | ||
163 | * | ||
164 | * | ||
165 | * This method returns the size required to store an SSP IO request object. u32 | ||
166 | */ | ||
167 | static u32 scic_sds_ssp_request_get_object_size(void) | ||
168 | { | ||
169 | return sizeof(struct scic_sds_request) | ||
170 | + scic_ssp_io_request_get_object_size(); | ||
171 | } | ||
172 | |||
173 | /** | 86 | /** |
174 | * This method returns the sgl element pair for the specificed sgl_pair index. | 87 | * This method returns the sgl element pair for the specificed sgl_pair index. |
175 | * @sci_req: This parameter specifies the IO request for which to retrieve | 88 | * @sci_req: This parameter specifies the IO request for which to retrieve |
@@ -268,21 +181,8 @@ void scic_sds_request_build_sgl(struct scic_sds_request *sds_request) | |||
268 | } | 181 | } |
269 | } | 182 | } |
270 | 183 | ||
271 | /** | 184 | static void scic_sds_ssp_io_request_assign_buffers(struct scic_sds_request *sci_req) |
272 | * This method build the remainder of the IO request object. | ||
273 | * @sci_req: This parameter specifies the request object being constructed. | ||
274 | * | ||
275 | * The scic_sds_general_request_construct() must be called before this call is | ||
276 | * valid. none | ||
277 | */ | ||
278 | static void scic_sds_ssp_io_request_assign_buffers( | ||
279 | struct scic_sds_request *sci_req) | ||
280 | { | 185 | { |
281 | sci_req->command_buffer = | ||
282 | scic_sds_ssp_request_get_command_buffer(sci_req); | ||
283 | sci_req->response_buffer = | ||
284 | scic_sds_ssp_request_get_response_buffer(sci_req); | ||
285 | |||
286 | if (sci_req->was_tag_assigned_by_user == false) | 186 | if (sci_req->was_tag_assigned_by_user == false) |
287 | sci_req->task_context_buffer = &sci_req->tc; | 187 | sci_req->task_context_buffer = &sci_req->tc; |
288 | } | 188 | } |
@@ -293,7 +193,7 @@ static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sc | |||
293 | struct isci_request *ireq = sci_req->ireq; | 193 | struct isci_request *ireq = sci_req->ireq; |
294 | struct sas_task *task = isci_request_access_task(ireq); | 194 | struct sas_task *task = isci_request_access_task(ireq); |
295 | 195 | ||
296 | cmd_iu = sci_req->command_buffer; | 196 | cmd_iu = &sci_req->ssp.cmd; |
297 | 197 | ||
298 | memcpy(cmd_iu->LUN, task->ssp_task.LUN, 8); | 198 | memcpy(cmd_iu->LUN, task->ssp_task.LUN, 8); |
299 | cmd_iu->add_cdb_len = 0; | 199 | cmd_iu->add_cdb_len = 0; |
@@ -315,7 +215,7 @@ static void scic_sds_task_request_build_ssp_task_iu(struct scic_sds_request *sci | |||
315 | struct sas_task *task = isci_request_access_task(ireq); | 215 | struct sas_task *task = isci_request_access_task(ireq); |
316 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); | 216 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); |
317 | 217 | ||
318 | task_iu = sci_req->command_buffer; | 218 | task_iu = &sci_req->ssp.tmf; |
319 | 219 | ||
320 | memset(task_iu, 0, sizeof(struct ssp_task_iu)); | 220 | memset(task_iu, 0, sizeof(struct ssp_task_iu)); |
321 | 221 | ||
@@ -411,7 +311,7 @@ static void scu_ssp_reqeust_construct_task_context( | |||
411 | * SCU Task Context | 311 | * SCU Task Context |
412 | */ | 312 | */ |
413 | dma_addr = scic_io_request_get_dma_addr(sds_request, | 313 | dma_addr = scic_io_request_get_dma_addr(sds_request, |
414 | sds_request->command_buffer); | 314 | &sds_request->ssp.cmd); |
415 | 315 | ||
416 | task_context->command_iu_upper = upper_32_bits(dma_addr); | 316 | task_context->command_iu_upper = upper_32_bits(dma_addr); |
417 | task_context->command_iu_lower = lower_32_bits(dma_addr); | 317 | task_context->command_iu_lower = lower_32_bits(dma_addr); |
@@ -421,7 +321,7 @@ static void scu_ssp_reqeust_construct_task_context( | |||
421 | * SCU Task Context | 321 | * SCU Task Context |
422 | */ | 322 | */ |
423 | dma_addr = scic_io_request_get_dma_addr(sds_request, | 323 | dma_addr = scic_io_request_get_dma_addr(sds_request, |
424 | sds_request->response_buffer); | 324 | &sds_request->ssp.rsp); |
425 | 325 | ||
426 | task_context->response_iu_upper = upper_32_bits(dma_addr); | 326 | task_context->response_iu_upper = upper_32_bits(dma_addr); |
427 | task_context->response_iu_lower = lower_32_bits(dma_addr); | 327 | task_context->response_iu_lower = lower_32_bits(dma_addr); |
@@ -464,22 +364,8 @@ static void scu_ssp_io_request_construct_task_context( | |||
464 | scic_sds_request_build_sgl(sci_req); | 364 | scic_sds_request_build_sgl(sci_req); |
465 | } | 365 | } |
466 | 366 | ||
467 | 367 | static void scic_sds_ssp_task_request_assign_buffers(struct scic_sds_request *sci_req) | |
468 | /** | ||
469 | * This method will fill in the remainder of the io request object for SSP Task | ||
470 | * requests. | ||
471 | * @sci_req: | ||
472 | * | ||
473 | */ | ||
474 | static void scic_sds_ssp_task_request_assign_buffers( | ||
475 | struct scic_sds_request *sci_req) | ||
476 | { | 368 | { |
477 | /* Assign all of the buffer pointers */ | ||
478 | sci_req->command_buffer = | ||
479 | scic_sds_ssp_task_request_get_command_buffer(sci_req); | ||
480 | sci_req->response_buffer = | ||
481 | scic_sds_ssp_task_request_get_response_buffer(sci_req); | ||
482 | |||
483 | if (sci_req->was_tag_assigned_by_user == false) | 369 | if (sci_req->was_tag_assigned_by_user == false) |
484 | sci_req->task_context_buffer = &sci_req->tc; | 370 | sci_req->task_context_buffer = &sci_req->tc; |
485 | } | 371 | } |
@@ -589,19 +475,6 @@ scic_io_request_construct_sata(struct scic_sds_request *sci_req, | |||
589 | return status; | 475 | return status; |
590 | } | 476 | } |
591 | 477 | ||
592 | u32 scic_io_request_get_object_size(void) | ||
593 | { | ||
594 | u32 ssp_request_size; | ||
595 | u32 stp_request_size; | ||
596 | u32 smp_request_size; | ||
597 | |||
598 | ssp_request_size = scic_sds_ssp_request_get_object_size(); | ||
599 | stp_request_size = scic_sds_stp_request_get_object_size(); | ||
600 | smp_request_size = scic_sds_smp_request_get_object_size(); | ||
601 | |||
602 | return max(ssp_request_size, max(stp_request_size, smp_request_size)); | ||
603 | } | ||
604 | |||
605 | enum sci_status scic_io_request_construct_basic_ssp( | 478 | enum sci_status scic_io_request_construct_basic_ssp( |
606 | struct scic_sds_request *sci_req) | 479 | struct scic_sds_request *sci_req) |
607 | { | 480 | { |
@@ -712,21 +585,6 @@ u32 scic_request_get_controller_status( | |||
712 | return sci_req->scu_status; | 585 | return sci_req->scu_status; |
713 | } | 586 | } |
714 | 587 | ||
715 | |||
716 | void *scic_io_request_get_command_iu_address( | ||
717 | struct scic_sds_request *sci_req) | ||
718 | { | ||
719 | return sci_req->command_buffer; | ||
720 | } | ||
721 | |||
722 | |||
723 | void *scic_io_request_get_response_iu_address( | ||
724 | struct scic_sds_request *sci_req) | ||
725 | { | ||
726 | return sci_req->response_buffer; | ||
727 | } | ||
728 | |||
729 | |||
730 | #define SCU_TASK_CONTEXT_SRAM 0x200000 | 588 | #define SCU_TASK_CONTEXT_SRAM 0x200000 |
731 | u32 scic_io_request_get_number_of_bytes_transferred( | 589 | u32 scic_io_request_get_number_of_bytes_transferred( |
732 | struct scic_sds_request *scic_sds_request) | 590 | struct scic_sds_request *scic_sds_request) |
@@ -885,7 +743,7 @@ void scic_sds_io_request_copy_response(struct scic_sds_request *sci_req) | |||
885 | struct isci_request *ireq = sci_req->ireq; | 743 | struct isci_request *ireq = sci_req->ireq; |
886 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); | 744 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); |
887 | 745 | ||
888 | ssp_response = sci_req->response_buffer; | 746 | ssp_response = &sci_req->ssp.rsp; |
889 | 747 | ||
890 | resp_buf = &isci_tmf->resp.resp_iu; | 748 | resp_buf = &isci_tmf->resp.resp_iu; |
891 | 749 | ||
@@ -1053,11 +911,11 @@ scic_sds_request_started_state_tc_completion_handler( | |||
1053 | * truly a failed request or a good request that just got | 911 | * truly a failed request or a good request that just got |
1054 | * completed early. | 912 | * completed early. |
1055 | */ | 913 | */ |
1056 | struct ssp_response_iu *resp = sci_req->response_buffer; | 914 | struct ssp_response_iu *resp = &sci_req->ssp.rsp; |
1057 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); | 915 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); |
1058 | 916 | ||
1059 | sci_swab32_cpy(sci_req->response_buffer, | 917 | sci_swab32_cpy(&sci_req->ssp.rsp, |
1060 | sci_req->response_buffer, | 918 | &sci_req->ssp.rsp, |
1061 | word_cnt); | 919 | word_cnt); |
1062 | 920 | ||
1063 | if (resp->status == 0) { | 921 | if (resp->status == 0) { |
@@ -1078,8 +936,8 @@ scic_sds_request_started_state_tc_completion_handler( | |||
1078 | { | 936 | { |
1079 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); | 937 | ssize_t word_cnt = SSP_RESP_IU_MAX_SIZE / sizeof(u32); |
1080 | 938 | ||
1081 | sci_swab32_cpy(sci_req->response_buffer, | 939 | sci_swab32_cpy(&sci_req->ssp.rsp, |
1082 | sci_req->response_buffer, | 940 | &sci_req->ssp.rsp, |
1083 | word_cnt); | 941 | word_cnt); |
1084 | 942 | ||
1085 | scic_sds_request_set_status(sci_req, | 943 | scic_sds_request_set_status(sci_req, |
@@ -1094,7 +952,7 @@ scic_sds_request_started_state_tc_completion_handler( | |||
1094 | * guaranteed to be received before this completion status is | 952 | * guaranteed to be received before this completion status is |
1095 | * posted? | 953 | * posted? |
1096 | */ | 954 | */ |
1097 | resp_iu = sci_req->response_buffer; | 955 | resp_iu = &sci_req->ssp.rsp; |
1098 | datapres = resp_iu->datapres; | 956 | datapres = resp_iu->datapres; |
1099 | 957 | ||
1100 | if ((datapres == 0x01) || (datapres == 0x02)) { | 958 | if ((datapres == 0x01) || (datapres == 0x02)) { |
@@ -1222,10 +1080,10 @@ scic_sds_request_started_state_frame_handler(struct scic_sds_request *sci_req, | |||
1222 | frame_index, | 1080 | frame_index, |
1223 | (void **)&resp_iu); | 1081 | (void **)&resp_iu); |
1224 | 1082 | ||
1225 | sci_swab32_cpy(sci_req->response_buffer, | 1083 | sci_swab32_cpy(&sci_req->ssp.rsp, |
1226 | resp_iu, word_cnt); | 1084 | resp_iu, word_cnt); |
1227 | 1085 | ||
1228 | resp_iu = sci_req->response_buffer; | 1086 | resp_iu = &sci_req->ssp.rsp; |
1229 | 1087 | ||
1230 | if ((resp_iu->datapres == 0x01) || | 1088 | if ((resp_iu->datapres == 0x01) || |
1231 | (resp_iu->datapres == 0x02)) { | 1089 | (resp_iu->datapres == 0x02)) { |
@@ -1627,12 +1485,10 @@ scic_io_request_construct(struct scic_sds_controller *scic, | |||
1627 | else if ((dev->dev_type == SATA_DEV) || | 1485 | else if ((dev->dev_type == SATA_DEV) || |
1628 | (dev->tproto & SAS_PROTOCOL_STP)) { | 1486 | (dev->tproto & SAS_PROTOCOL_STP)) { |
1629 | scic_sds_stp_request_assign_buffers(sci_req); | 1487 | scic_sds_stp_request_assign_buffers(sci_req); |
1630 | memset(sci_req->command_buffer, | 1488 | memset(&sci_req->stp.cmd, 0, sizeof(sci_req->stp.cmd)); |
1631 | 0, | ||
1632 | sizeof(struct host_to_dev_fis)); | ||
1633 | } else if (dev_is_expander(dev)) { | 1489 | } else if (dev_is_expander(dev)) { |
1634 | scic_sds_smp_request_assign_buffers(sci_req); | 1490 | scic_sds_smp_request_assign_buffers(sci_req); |
1635 | memset(sci_req->command_buffer, 0, sizeof(struct smp_req)); | 1491 | memset(&sci_req->smp.cmd, 0, sizeof(sci_req->smp.cmd)); |
1636 | } else | 1492 | } else |
1637 | status = SCI_FAILURE_UNSUPPORTED_PROTOCOL; | 1493 | status = SCI_FAILURE_UNSUPPORTED_PROTOCOL; |
1638 | 1494 | ||
diff --git a/drivers/scsi/isci/core/scic_sds_request.h b/drivers/scsi/isci/core/scic_sds_request.h index 8f65814e79c8..3f551eaf3dfa 100644 --- a/drivers/scsi/isci/core/scic_sds_request.h +++ b/drivers/scsi/isci/core/scic_sds_request.h | |||
@@ -61,6 +61,7 @@ | |||
61 | #include "scu_task_context.h" | 61 | #include "scu_task_context.h" |
62 | #include "scic_sds_stp_request.h" | 62 | #include "scic_sds_stp_request.h" |
63 | #include "scu_constants.h" | 63 | #include "scu_constants.h" |
64 | #include "sas.h" | ||
64 | 65 | ||
65 | struct scic_sds_controller; | 66 | struct scic_sds_controller; |
66 | struct scic_sds_remote_device; | 67 | struct scic_sds_remote_device; |
@@ -181,8 +182,6 @@ struct scic_sds_request { | |||
181 | */ | 182 | */ |
182 | u32 post_context; | 183 | u32 post_context; |
183 | 184 | ||
184 | void *command_buffer; | ||
185 | void *response_buffer; | ||
186 | struct scu_task_context *task_context_buffer; | 185 | struct scu_task_context *task_context_buffer; |
187 | struct scu_task_context tc ____cacheline_aligned; | 186 | struct scu_task_context tc ____cacheline_aligned; |
188 | 187 | ||
@@ -232,9 +231,30 @@ struct scic_sds_request { | |||
232 | */ | 231 | */ |
233 | u8 device_sequence; | 232 | u8 device_sequence; |
234 | 233 | ||
235 | struct { | 234 | union { |
236 | struct scic_sds_stp_request req; | 235 | struct { |
237 | } stp; | 236 | union { |
237 | struct ssp_cmd_iu cmd; | ||
238 | struct ssp_task_iu tmf; | ||
239 | }; | ||
240 | union { | ||
241 | struct ssp_response_iu rsp; | ||
242 | u8 rsp_buf[SSP_RESP_IU_MAX_SIZE]; | ||
243 | }; | ||
244 | } ssp; | ||
245 | |||
246 | struct { | ||
247 | struct smp_req cmd; | ||
248 | struct smp_resp rsp; | ||
249 | } smp; | ||
250 | |||
251 | struct { | ||
252 | struct scic_sds_stp_request req; | ||
253 | struct host_to_dev_fis cmd; | ||
254 | struct dev_to_host_fis rsp; | ||
255 | } stp; | ||
256 | }; | ||
257 | |||
238 | }; | 258 | }; |
239 | 259 | ||
240 | static inline struct scic_sds_request *to_sci_req(struct scic_sds_stp_request *stp_req) | 260 | static inline struct scic_sds_request *to_sci_req(struct scic_sds_stp_request *stp_req) |
diff --git a/drivers/scsi/isci/core/scic_sds_smp_request.c b/drivers/scsi/isci/core/scic_sds_smp_request.c index 53b1260f44bc..2b911206e8d2 100644 --- a/drivers/scsi/isci/core/scic_sds_smp_request.c +++ b/drivers/scsi/isci/core/scic_sds_smp_request.c | |||
@@ -69,45 +69,8 @@ static void scu_smp_request_construct_task_context( | |||
69 | struct scic_sds_request *sci_req, | 69 | struct scic_sds_request *sci_req, |
70 | struct smp_req *smp_req); | 70 | struct smp_req *smp_req); |
71 | 71 | ||
72 | /** | ||
73 | * | ||
74 | * | ||
75 | * This method return the memory space required for STP PIO requests. u32 | ||
76 | */ | ||
77 | u32 scic_sds_smp_request_get_object_size(void) | ||
78 | { | ||
79 | return sizeof(struct scic_sds_request) | ||
80 | + sizeof(struct smp_req) | ||
81 | + sizeof(struct smp_resp); | ||
82 | } | ||
83 | |||
84 | /** | ||
85 | * scic_sds_smp_request_get_command_buffer() - | ||
86 | * | ||
87 | * This macro returns the address of the smp command buffer in the smp request | ||
88 | * memory. No need to cast to SMP request type. | ||
89 | */ | ||
90 | #define scic_sds_smp_request_get_command_buffer(memory) \ | ||
91 | (((char *)(memory)) + sizeof(struct scic_sds_request)) | ||
92 | |||
93 | /** | ||
94 | * scic_sds_smp_request_get_response_buffer() - | ||
95 | * | ||
96 | * This macro returns the address of the smp response buffer in the smp request | ||
97 | * memory. | ||
98 | */ | ||
99 | #define scic_sds_smp_request_get_response_buffer(memory) \ | ||
100 | (((char *)(scic_sds_smp_request_get_command_buffer(memory))) \ | ||
101 | + sizeof(struct smp_req)) | ||
102 | |||
103 | void scic_sds_smp_request_assign_buffers(struct scic_sds_request *sci_req) | 72 | void scic_sds_smp_request_assign_buffers(struct scic_sds_request *sci_req) |
104 | { | 73 | { |
105 | /* Assign all of the buffer pointers */ | ||
106 | sci_req->command_buffer = | ||
107 | scic_sds_smp_request_get_command_buffer(sci_req); | ||
108 | sci_req->response_buffer = | ||
109 | scic_sds_smp_request_get_response_buffer(sci_req); | ||
110 | |||
111 | if (sci_req->was_tag_assigned_by_user == false) | 74 | if (sci_req->was_tag_assigned_by_user == false) |
112 | sci_req->task_context_buffer = &sci_req->tc; | 75 | sci_req->task_context_buffer = &sci_req->tc; |
113 | } | 76 | } |
@@ -135,7 +98,7 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req, | |||
135 | ssize_t word_cnt = sizeof(struct smp_req) / sizeof(u32); | 98 | ssize_t word_cnt = sizeof(struct smp_req) / sizeof(u32); |
136 | 99 | ||
137 | /* byte swap the smp request. */ | 100 | /* byte swap the smp request. */ |
138 | sci_swab32_cpy(sci_req->command_buffer, smp_req, | 101 | sci_swab32_cpy(&sci_req->smp.cmd, smp_req, |
139 | word_cnt); | 102 | word_cnt); |
140 | 103 | ||
141 | task_context = scic_sds_request_get_task_context(sci_req); | 104 | task_context = scic_sds_request_get_task_context(sci_req); |
@@ -185,9 +148,7 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req, | |||
185 | * 18h ~ 30h, protocol specific | 148 | * 18h ~ 30h, protocol specific |
186 | * since commandIU has been build by framework at this point, we just | 149 | * since commandIU has been build by framework at this point, we just |
187 | * copy the frist DWord from command IU to this location. */ | 150 | * copy the frist DWord from command IU to this location. */ |
188 | memcpy((void *)(&task_context->type.smp), | 151 | memcpy(&task_context->type.smp, &sci_req->smp.cmd, sizeof(u32)); |
189 | sci_req->command_buffer, | ||
190 | sizeof(u32)); | ||
191 | 152 | ||
192 | /* | 153 | /* |
193 | * 40h | 154 | * 40h |
@@ -228,8 +189,7 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req, | |||
228 | * Context command buffer should not contain command header. | 189 | * Context command buffer should not contain command header. |
229 | */ | 190 | */ |
230 | dma_addr = scic_io_request_get_dma_addr(sci_req, | 191 | dma_addr = scic_io_request_get_dma_addr(sci_req, |
231 | (char *) | 192 | ((char *) &sci_req->smp.cmd) + |
232 | (sci_req->command_buffer) + | ||
233 | sizeof(u32)); | 193 | sizeof(u32)); |
234 | 194 | ||
235 | task_context->command_iu_upper = upper_32_bits(dma_addr); | 195 | task_context->command_iu_upper = upper_32_bits(dma_addr); |
@@ -255,14 +215,12 @@ scu_smp_request_construct_task_context(struct scic_sds_request *sci_req, | |||
255 | * indicates successful processing of the TC response. | 215 | * indicates successful processing of the TC response. |
256 | */ | 216 | */ |
257 | static enum sci_status | 217 | static enum sci_status |
258 | scic_sds_smp_request_await_response_frame_handler( | 218 | scic_sds_smp_request_await_response_frame_handler(struct scic_sds_request *sci_req, |
259 | struct scic_sds_request *sci_req, | 219 | u32 frame_index) |
260 | u32 frame_index) | ||
261 | { | 220 | { |
262 | enum sci_status status; | 221 | enum sci_status status; |
263 | void *frame_header; | 222 | void *frame_header; |
264 | struct smp_resp *rsp_hdr; | 223 | struct smp_resp *rsp_hdr = &sci_req->smp.rsp; |
265 | u8 *usr_smp_buf = sci_req->response_buffer; | ||
266 | ssize_t word_cnt = SMP_RESP_HDR_SZ / sizeof(u32); | 224 | ssize_t word_cnt = SMP_RESP_HDR_SZ / sizeof(u32); |
267 | 225 | ||
268 | status = scic_sds_unsolicited_frame_control_get_header( | 226 | status = scic_sds_unsolicited_frame_control_get_header( |
@@ -271,9 +229,7 @@ scic_sds_smp_request_await_response_frame_handler( | |||
271 | &frame_header); | 229 | &frame_header); |
272 | 230 | ||
273 | /* byte swap the header. */ | 231 | /* byte swap the header. */ |
274 | sci_swab32_cpy(usr_smp_buf, frame_header, word_cnt); | 232 | sci_swab32_cpy(rsp_hdr, frame_header, word_cnt); |
275 | |||
276 | rsp_hdr = (struct smp_resp *)usr_smp_buf; | ||
277 | 233 | ||
278 | if (rsp_hdr->frame_type == SMP_RESPONSE) { | 234 | if (rsp_hdr->frame_type == SMP_RESPONSE) { |
279 | void *smp_resp; | 235 | void *smp_resp; |
@@ -286,7 +242,7 @@ scic_sds_smp_request_await_response_frame_handler( | |||
286 | word_cnt = (sizeof(struct smp_req) - SMP_RESP_HDR_SZ) / | 242 | word_cnt = (sizeof(struct smp_req) - SMP_RESP_HDR_SZ) / |
287 | sizeof(u32); | 243 | sizeof(u32); |
288 | 244 | ||
289 | sci_swab32_cpy(usr_smp_buf + SMP_RESP_HDR_SZ, | 245 | sci_swab32_cpy(((u8 *) rsp_hdr) + SMP_RESP_HDR_SZ, |
290 | smp_resp, word_cnt); | 246 | smp_resp, word_cnt); |
291 | 247 | ||
292 | scic_sds_request_set_status( | 248 | scic_sds_request_set_status( |
@@ -532,7 +488,7 @@ enum sci_status scic_io_request_construct_smp(struct scic_sds_request *sci_req) | |||
532 | ); | 488 | ); |
533 | 489 | ||
534 | /* Construct the SMP SCU Task Context */ | 490 | /* Construct the SMP SCU Task Context */ |
535 | memcpy(smp_req, sci_req->command_buffer, sizeof(*smp_req)); | 491 | memcpy(smp_req, &sci_req->smp.cmd, sizeof(*smp_req)); |
536 | 492 | ||
537 | /* | 493 | /* |
538 | * Look at the SMP requests' header fields; for certain SAS 1.x SMP | 494 | * Look at the SMP requests' header fields; for certain SAS 1.x SMP |
diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index f21354571ff8..c7a8931a3bcb 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c | |||
@@ -70,48 +70,8 @@ | |||
70 | #include "scu_event_codes.h" | 70 | #include "scu_event_codes.h" |
71 | #include "scu_task_context.h" | 71 | #include "scu_task_context.h" |
72 | 72 | ||
73 | /** | ||
74 | * scic_sds_stp_request_get_h2d_reg_buffer() - | ||
75 | * | ||
76 | * This macro returns the address of the stp h2d reg fis buffer in the io | ||
77 | * request memory | ||
78 | */ | ||
79 | #define scic_sds_stp_request_get_h2d_reg_buffer(memory) \ | ||
80 | ((struct host_to_dev_fis *)(\ | ||
81 | ((char *)(memory)) + sizeof(struct scic_sds_stp_request) \ | ||
82 | )) | ||
83 | |||
84 | /** | ||
85 | * scic_sds_stp_request_get_response_buffer() - | ||
86 | * | ||
87 | * This macro returns the address of the ssp response iu buffer in the io | ||
88 | * request memory | ||
89 | */ | ||
90 | #define scic_sds_stp_request_get_response_buffer(memory) \ | ||
91 | ((struct dev_to_host_fis *)(\ | ||
92 | ((char *)(scic_sds_stp_request_get_h2d_reg_buffer(memory))) \ | ||
93 | + sizeof(struct host_to_dev_fis) \ | ||
94 | )) | ||
95 | |||
96 | /** | ||
97 | * | ||
98 | * | ||
99 | * This method return the memory space required for STP PIO requests. u32 | ||
100 | */ | ||
101 | u32 scic_sds_stp_request_get_object_size(void) | ||
102 | { | ||
103 | return sizeof(struct scic_sds_stp_request) | ||
104 | + sizeof(struct host_to_dev_fis) | ||
105 | + sizeof(struct dev_to_host_fis); | ||
106 | } | ||
107 | |||
108 | void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) | 73 | void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) |
109 | { | 74 | { |
110 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; | ||
111 | |||
112 | sci_req->command_buffer = scic_sds_stp_request_get_h2d_reg_buffer(stp_req); | ||
113 | sci_req->response_buffer = scic_sds_stp_request_get_response_buffer(stp_req); | ||
114 | |||
115 | if (sci_req->was_tag_assigned_by_user == false) | 75 | if (sci_req->was_tag_assigned_by_user == false) |
116 | sci_req->task_context_buffer = &sci_req->tc; | 76 | sci_req->task_context_buffer = &sci_req->tc; |
117 | } | 77 | } |
@@ -129,7 +89,7 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) | |||
129 | * determine what is common for SSP/SMP/STP task context structures. | 89 | * determine what is common for SSP/SMP/STP task context structures. |
130 | */ | 90 | */ |
131 | static void scu_sata_reqeust_construct_task_context( | 91 | static void scu_sata_reqeust_construct_task_context( |
132 | struct scic_sds_request *sds_request, | 92 | struct scic_sds_request *sci_req, |
133 | struct scu_task_context *task_context) | 93 | struct scu_task_context *task_context) |
134 | { | 94 | { |
135 | dma_addr_t dma_addr; | 95 | dma_addr_t dma_addr; |
@@ -137,9 +97,9 @@ static void scu_sata_reqeust_construct_task_context( | |||
137 | struct scic_sds_remote_device *target_device; | 97 | struct scic_sds_remote_device *target_device; |
138 | struct scic_sds_port *target_port; | 98 | struct scic_sds_port *target_port; |
139 | 99 | ||
140 | controller = scic_sds_request_get_controller(sds_request); | 100 | controller = scic_sds_request_get_controller(sci_req); |
141 | target_device = scic_sds_request_get_device(sds_request); | 101 | target_device = scic_sds_request_get_device(sci_req); |
142 | target_port = scic_sds_request_get_port(sds_request); | 102 | target_port = scic_sds_request_get_port(sci_req); |
143 | 103 | ||
144 | /* Fill in the TC with the its required data */ | 104 | /* Fill in the TC with the its required data */ |
145 | task_context->abort = 0; | 105 | task_context->abort = 0; |
@@ -155,7 +115,7 @@ static void scu_sata_reqeust_construct_task_context( | |||
155 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; | 115 | task_context->context_type = SCU_TASK_CONTEXT_TYPE; |
156 | 116 | ||
157 | task_context->remote_node_index = | 117 | task_context->remote_node_index = |
158 | scic_sds_remote_device_get_index(sds_request->target_device); | 118 | scic_sds_remote_device_get_index(sci_req->target_device); |
159 | task_context->command_code = 0; | 119 | task_context->command_code = 0; |
160 | 120 | ||
161 | task_context->link_layer_control = 0; | 121 | task_context->link_layer_control = 0; |
@@ -172,21 +132,21 @@ static void scu_sata_reqeust_construct_task_context( | |||
172 | (sizeof(struct host_to_dev_fis) - sizeof(u32)) / sizeof(u32); | 132 | (sizeof(struct host_to_dev_fis) - sizeof(u32)) / sizeof(u32); |
173 | 133 | ||
174 | /* Set the first word of the H2D REG FIS */ | 134 | /* Set the first word of the H2D REG FIS */ |
175 | task_context->type.words[0] = *(u32 *)sds_request->command_buffer; | 135 | task_context->type.words[0] = *(u32 *)&sci_req->stp.cmd; |
176 | 136 | ||
177 | if (sds_request->was_tag_assigned_by_user) { | 137 | if (sci_req->was_tag_assigned_by_user) { |
178 | /* | 138 | /* |
179 | * Build the task context now since we have already read | 139 | * Build the task context now since we have already read |
180 | * the data | 140 | * the data |
181 | */ | 141 | */ |
182 | sds_request->post_context = | 142 | sci_req->post_context = |
183 | (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | | 143 | (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | |
184 | (scic_sds_controller_get_protocol_engine_group( | 144 | (scic_sds_controller_get_protocol_engine_group( |
185 | controller) << | 145 | controller) << |
186 | SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | | 146 | SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT) | |
187 | (scic_sds_port_get_index(target_port) << | 147 | (scic_sds_port_get_index(target_port) << |
188 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | | 148 | SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT) | |
189 | scic_sds_io_tag_get_index(sds_request->io_tag)); | 149 | scic_sds_io_tag_get_index(sci_req->io_tag)); |
190 | } else { | 150 | } else { |
191 | /* | 151 | /* |
192 | * Build the task context now since we have already read | 152 | * Build the task context now since we have already read |
@@ -194,7 +154,7 @@ static void scu_sata_reqeust_construct_task_context( | |||
194 | * I/O tag index is not assigned because we have to wait | 154 | * I/O tag index is not assigned because we have to wait |
195 | * until we get a TCi. | 155 | * until we get a TCi. |
196 | */ | 156 | */ |
197 | sds_request->post_context = | 157 | sci_req->post_context = |
198 | (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | | 158 | (SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC | |
199 | (scic_sds_controller_get_protocol_engine_group( | 159 | (scic_sds_controller_get_protocol_engine_group( |
200 | controller) << | 160 | controller) << |
@@ -208,11 +168,9 @@ static void scu_sata_reqeust_construct_task_context( | |||
208 | * Context. We must offset the command buffer by 4 bytes because the | 168 | * Context. We must offset the command buffer by 4 bytes because the |
209 | * first 4 bytes are transfered in the body of the TC. | 169 | * first 4 bytes are transfered in the body of the TC. |
210 | */ | 170 | */ |
211 | dma_addr = | 171 | dma_addr = scic_io_request_get_dma_addr(sci_req, |
212 | scic_io_request_get_dma_addr(sds_request, | 172 | ((char *) &sci_req->stp.cmd) + |
213 | (char *)sds_request-> | 173 | sizeof(u32)); |
214 | command_buffer + | ||
215 | sizeof(u32)); | ||
216 | 174 | ||
217 | task_context->command_iu_upper = upper_32_bits(dma_addr); | 175 | task_context->command_iu_upper = upper_32_bits(dma_addr); |
218 | task_context->command_iu_lower = lower_32_bits(dma_addr); | 176 | task_context->command_iu_lower = lower_32_bits(dma_addr); |
@@ -334,21 +292,6 @@ void scic_stp_io_request_set_ncq_tag( | |||
334 | req->task_context_buffer->type.stp.ncq_tag = ncq_tag; | 292 | req->task_context_buffer->type.stp.ncq_tag = ncq_tag; |
335 | } | 293 | } |
336 | 294 | ||
337 | |||
338 | void *scic_stp_io_request_get_h2d_reg_address( | ||
339 | struct scic_sds_request *req) | ||
340 | { | ||
341 | return req->command_buffer; | ||
342 | } | ||
343 | |||
344 | |||
345 | void *scic_stp_io_request_get_d2h_reg_address(struct scic_sds_request *sci_req) | ||
346 | { | ||
347 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; | ||
348 | |||
349 | return &stp_req->d2h_reg_fis; | ||
350 | } | ||
351 | |||
352 | /** | 295 | /** |
353 | * | 296 | * |
354 | * @sci_req: | 297 | * @sci_req: |
@@ -478,7 +421,7 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler( | |||
478 | frame_index, | 421 | frame_index, |
479 | (void **)&frame_buffer); | 422 | (void **)&frame_buffer); |
480 | 423 | ||
481 | scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis, | 424 | scic_sds_controller_copy_sata_response(&sci_req->stp.rsp, |
482 | frame_header, | 425 | frame_header, |
483 | frame_buffer); | 426 | frame_buffer); |
484 | 427 | ||
@@ -830,11 +773,11 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(struct | |||
830 | /* ending_status: 4th byte in the 3rd dword */ | 773 | /* ending_status: 4th byte in the 3rd dword */ |
831 | stp_req->type.pio.ending_status = (frame_buffer[2] >> 24) & 0xff; | 774 | stp_req->type.pio.ending_status = (frame_buffer[2] >> 24) & 0xff; |
832 | 775 | ||
833 | scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis, | 776 | scic_sds_controller_copy_sata_response(&sci_req->stp.rsp, |
834 | frame_header, | 777 | frame_header, |
835 | frame_buffer); | 778 | frame_buffer); |
836 | 779 | ||
837 | stp_req->d2h_reg_fis.status = stp_req->type.pio.ending_status; | 780 | sci_req->stp.rsp.status = stp_req->type.pio.ending_status; |
838 | 781 | ||
839 | /* The next state is dependent on whether the | 782 | /* The next state is dependent on whether the |
840 | * request was PIO Data-in or Data out | 783 | * request was PIO Data-in or Data out |
@@ -873,7 +816,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(struct | |||
873 | frame_index, | 816 | frame_index, |
874 | (void **)&frame_buffer); | 817 | (void **)&frame_buffer); |
875 | 818 | ||
876 | scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis, | 819 | scic_sds_controller_copy_sata_response(&sci_req->stp.req, |
877 | frame_header, | 820 | frame_header, |
878 | frame_buffer); | 821 | frame_buffer); |
879 | 822 | ||
@@ -1220,7 +1163,6 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct sc | |||
1220 | u32 frame_index) | 1163 | u32 frame_index) |
1221 | { | 1164 | { |
1222 | struct scic_sds_controller *scic = sci_req->owning_controller; | 1165 | struct scic_sds_controller *scic = sci_req->owning_controller; |
1223 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; | ||
1224 | struct dev_to_host_fis *frame_header; | 1166 | struct dev_to_host_fis *frame_header; |
1225 | enum sci_status status; | 1167 | enum sci_status status; |
1226 | u32 *frame_buffer; | 1168 | u32 *frame_buffer; |
@@ -1235,7 +1177,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(struct sc | |||
1235 | frame_index, | 1177 | frame_index, |
1236 | (void **)&frame_buffer); | 1178 | (void **)&frame_buffer); |
1237 | 1179 | ||
1238 | scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis, | 1180 | scic_sds_controller_copy_sata_response(&sci_req->stp.rsp, |
1239 | frame_header, | 1181 | frame_header, |
1240 | frame_buffer); | 1182 | frame_buffer); |
1241 | } | 1183 | } |
@@ -1249,7 +1191,6 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi | |||
1249 | struct scic_sds_request *sci_req, | 1191 | struct scic_sds_request *sci_req, |
1250 | u32 completion_code) | 1192 | u32 completion_code) |
1251 | { | 1193 | { |
1252 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; | ||
1253 | enum sci_status status = SCI_SUCCESS; | 1194 | enum sci_status status = SCI_SUCCESS; |
1254 | 1195 | ||
1255 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { | 1196 | switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { |
@@ -1263,7 +1204,7 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi | |||
1263 | /* | 1204 | /* |
1264 | * We must check ther response buffer to see if the D2H Register FIS was | 1205 | * We must check ther response buffer to see if the D2H Register FIS was |
1265 | * received before we got the TC completion. */ | 1206 | * received before we got the TC completion. */ |
1266 | if (stp_req->d2h_reg_fis.fis_type == FIS_REGD2H) { | 1207 | if (sci_req->stp.rsp.fis_type == FIS_REGD2H) { |
1267 | scic_sds_remote_device_suspend(sci_req->target_device, | 1208 | scic_sds_remote_device_suspend(sci_req->target_device, |
1268 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))); | 1209 | SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))); |
1269 | 1210 | ||
@@ -1523,7 +1464,7 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler( | |||
1523 | frame_index, | 1464 | frame_index, |
1524 | (void **)&frame_buffer); | 1465 | (void **)&frame_buffer); |
1525 | 1466 | ||
1526 | scic_sds_controller_copy_sata_response(&stp_req->d2h_reg_fis, | 1467 | scic_sds_controller_copy_sata_response(&sci_req->stp.rsp, |
1527 | frame_header, | 1468 | frame_header, |
1528 | frame_buffer); | 1469 | frame_buffer); |
1529 | 1470 | ||
@@ -1595,7 +1536,7 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet | |||
1595 | enum sci_status status; | 1536 | enum sci_status status; |
1596 | 1537 | ||
1597 | /* Clear the SRST bit */ | 1538 | /* Clear the SRST bit */ |
1598 | h2d_fis = scic_stp_io_request_get_h2d_reg_address(sci_req); | 1539 | h2d_fis = &sci_req->stp.cmd; |
1599 | h2d_fis->control = 0; | 1540 | h2d_fis->control = 0; |
1600 | 1541 | ||
1601 | /* Clear the TC control bit */ | 1542 | /* Clear the TC control bit */ |
diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.h b/drivers/scsi/isci/core/scic_sds_stp_request.h index 6d02030b6cd6..f5434f12ad06 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.h +++ b/drivers/scsi/isci/core/scic_sds_stp_request.h | |||
@@ -60,8 +60,6 @@ | |||
60 | #include <scsi/sas.h> | 60 | #include <scsi/sas.h> |
61 | 61 | ||
62 | struct scic_sds_stp_request { | 62 | struct scic_sds_stp_request { |
63 | struct dev_to_host_fis d2h_reg_fis; | ||
64 | |||
65 | union { | 63 | union { |
66 | u32 ncq; | 64 | u32 ncq; |
67 | 65 | ||
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index cdd99304c363..4d0ee7bf847b 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -433,7 +433,7 @@ int isci_host_init(struct isci_host *isci_host) | |||
433 | * when trying to convert virtual addresses to physical addresses | 433 | * when trying to convert virtual addresses to physical addresses |
434 | */ | 434 | */ |
435 | isci_host->dma_pool_alloc_size = sizeof(struct isci_request) + | 435 | isci_host->dma_pool_alloc_size = sizeof(struct isci_request) + |
436 | scic_io_request_get_object_size(); | 436 | sizeof(struct scic_sds_request); |
437 | isci_host->dma_pool = dmam_pool_create(DRV_NAME, &isci_host->pdev->dev, | 437 | isci_host->dma_pool = dmam_pool_create(DRV_NAME, &isci_host->pdev->dev, |
438 | isci_host->dma_pool_alloc_size, | 438 | isci_host->dma_pool_alloc_size, |
439 | SLAB_HWCACHE_ALIGN, 0); | 439 | SLAB_HWCACHE_ALIGN, 0); |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index 9dd971a3fbb2..a5b9b22d3b3a 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -126,7 +126,6 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq) | |||
126 | enum sci_status status = SCI_FAILURE; | 126 | enum sci_status status = SCI_FAILURE; |
127 | struct sas_task *task = isci_request_access_task(ireq); | 127 | struct sas_task *task = isci_request_access_task(ireq); |
128 | struct scic_sds_request *sci_req = ireq->sci_request_handle; | 128 | struct scic_sds_request *sci_req = ireq->sci_request_handle; |
129 | void *cmd_iu = sci_req->command_buffer; | ||
130 | 129 | ||
131 | dev_dbg(&ireq->isci_host->pdev->dev, | 130 | dev_dbg(&ireq->isci_host->pdev->dev, |
132 | "%s: request = %p\n", __func__, ireq); | 131 | "%s: request = %p\n", __func__, ireq); |
@@ -138,7 +137,7 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq) | |||
138 | 137 | ||
139 | /* copy the smp_command to the address; */ | 138 | /* copy the smp_command to the address; */ |
140 | sg_copy_to_buffer(&task->smp_task.smp_req, 1, | 139 | sg_copy_to_buffer(&task->smp_task.smp_req, 1, |
141 | (char *)cmd_iu, | 140 | &sci_req->smp.cmd, |
142 | sizeof(struct smp_req)); | 141 | sizeof(struct smp_req)); |
143 | 142 | ||
144 | status = scic_io_request_construct_smp(sci_req); | 143 | status = scic_io_request_construct_smp(sci_req); |
@@ -998,25 +997,15 @@ void isci_request_io_request_complete( | |||
998 | task); | 997 | task); |
999 | 998 | ||
1000 | if (sas_protocol_ata(task->task_proto)) { | 999 | if (sas_protocol_ata(task->task_proto)) { |
1001 | resp_buf | 1000 | resp_buf = &request->sci_request_handle->stp.rsp; |
1002 | = scic_stp_io_request_get_d2h_reg_address( | ||
1003 | request->sci_request_handle | ||
1004 | ); | ||
1005 | isci_request_process_stp_response(task, | 1001 | isci_request_process_stp_response(task, |
1006 | resp_buf | 1002 | resp_buf); |
1007 | ); | ||
1008 | |||
1009 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { | 1003 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { |
1010 | 1004 | ||
1011 | /* crack the iu response buffer. */ | 1005 | /* crack the iu response buffer. */ |
1012 | resp_iu | 1006 | resp_iu = &request->sci_request_handle->ssp.rsp; |
1013 | = scic_io_request_get_response_iu_address( | ||
1014 | request->sci_request_handle | ||
1015 | ); | ||
1016 | |||
1017 | isci_request_process_response_iu(task, resp_iu, | 1007 | isci_request_process_response_iu(task, resp_iu, |
1018 | &isci_host->pdev->dev | 1008 | &isci_host->pdev->dev); |
1019 | ); | ||
1020 | 1009 | ||
1021 | } else if (SAS_PROTOCOL_SMP == task->task_proto) { | 1010 | } else if (SAS_PROTOCOL_SMP == task->task_proto) { |
1022 | 1011 | ||
@@ -1045,11 +1034,7 @@ void isci_request_io_request_complete( | |||
1045 | request->complete_in_target = true; | 1034 | request->complete_in_target = true; |
1046 | 1035 | ||
1047 | if (task->task_proto == SAS_PROTOCOL_SMP) { | 1036 | if (task->task_proto == SAS_PROTOCOL_SMP) { |
1048 | 1037 | void *rsp = &request->sci_request_handle->smp.rsp; | |
1049 | u8 *command_iu_address | ||
1050 | = scic_io_request_get_command_iu_address( | ||
1051 | request->sci_request_handle | ||
1052 | ); | ||
1053 | 1038 | ||
1054 | dev_dbg(&isci_host->pdev->dev, | 1039 | dev_dbg(&isci_host->pdev->dev, |
1055 | "%s: SMP protocol completion\n", | 1040 | "%s: SMP protocol completion\n", |
@@ -1057,9 +1042,7 @@ void isci_request_io_request_complete( | |||
1057 | 1042 | ||
1058 | sg_copy_from_buffer( | 1043 | sg_copy_from_buffer( |
1059 | &task->smp_task.smp_resp, 1, | 1044 | &task->smp_task.smp_resp, 1, |
1060 | command_iu_address | 1045 | rsp, sizeof(struct smp_resp)); |
1061 | + sizeof(struct smp_req), | ||
1062 | sizeof(struct smp_resp)); | ||
1063 | } else if (completion_status | 1046 | } else if (completion_status |
1064 | == SCI_IO_SUCCESS_IO_DONE_EARLY) { | 1047 | == SCI_IO_SUCCESS_IO_DONE_EARLY) { |
1065 | 1048 | ||
diff --git a/drivers/scsi/isci/sata.c b/drivers/scsi/isci/sata.c index a08fcf511908..578b1c5d40a9 100644 --- a/drivers/scsi/isci/sata.c +++ b/drivers/scsi/isci/sata.c | |||
@@ -71,24 +71,17 @@ | |||
71 | */ | 71 | */ |
72 | struct host_to_dev_fis *isci_sata_task_to_fis_copy(struct sas_task *task) | 72 | struct host_to_dev_fis *isci_sata_task_to_fis_copy(struct sas_task *task) |
73 | { | 73 | { |
74 | struct isci_request *request = task->lldd_task; | 74 | struct isci_request *ireq = task->lldd_task; |
75 | struct host_to_dev_fis *register_fis = | 75 | struct host_to_dev_fis *fis = &ireq->sci_request_handle->stp.cmd; |
76 | scic_stp_io_request_get_h2d_reg_address( | 76 | |
77 | request->sci_request_handle | 77 | memcpy(fis, &task->ata_task.fis, sizeof(struct host_to_dev_fis)); |
78 | ); | ||
79 | |||
80 | memcpy( | ||
81 | (u8 *)register_fis, | ||
82 | (u8 *)&task->ata_task.fis, | ||
83 | sizeof(struct host_to_dev_fis) | ||
84 | ); | ||
85 | 78 | ||
86 | if (!task->ata_task.device_control_reg_update) | 79 | if (!task->ata_task.device_control_reg_update) |
87 | register_fis->flags |= 0x80; | 80 | fis->flags |= 0x80; |
88 | 81 | ||
89 | register_fis->flags &= 0xF0; | 82 | fis->flags &= 0xF0; |
90 | 83 | ||
91 | return register_fis; | 84 | return fis; |
92 | } | 85 | } |
93 | 86 | ||
94 | /** | 87 | /** |
@@ -161,36 +154,32 @@ void isci_request_process_stp_response(struct sas_task *task, | |||
161 | ts->resp = SAS_TASK_COMPLETE; | 154 | ts->resp = SAS_TASK_COMPLETE; |
162 | } | 155 | } |
163 | 156 | ||
164 | enum sci_status isci_sata_management_task_request_build( | 157 | enum sci_status isci_sata_management_task_request_build(struct isci_request *ireq) |
165 | struct isci_request *isci_request) | ||
166 | { | 158 | { |
159 | struct scic_sds_request *sci_req = ireq->sci_request_handle; | ||
167 | struct isci_tmf *isci_tmf; | 160 | struct isci_tmf *isci_tmf; |
168 | enum sci_status status; | 161 | enum sci_status status; |
169 | 162 | ||
170 | if (tmf_task != isci_request->ttype) | 163 | if (tmf_task != ireq->ttype) |
171 | return SCI_FAILURE; | 164 | return SCI_FAILURE; |
172 | 165 | ||
173 | isci_tmf = isci_request_access_tmf(isci_request); | 166 | isci_tmf = isci_request_access_tmf(ireq); |
174 | 167 | ||
175 | switch (isci_tmf->tmf_code) { | 168 | switch (isci_tmf->tmf_code) { |
176 | 169 | ||
177 | case isci_tmf_sata_srst_high: | 170 | case isci_tmf_sata_srst_high: |
178 | case isci_tmf_sata_srst_low: | 171 | case isci_tmf_sata_srst_low: { |
179 | { | 172 | struct host_to_dev_fis *fis = &sci_req->stp.cmd; |
180 | struct host_to_dev_fis *register_fis = | 173 | |
181 | scic_stp_io_request_get_h2d_reg_address( | 174 | memset(fis, 0, sizeof(*fis)); |
182 | isci_request->sci_request_handle | 175 | |
183 | ); | 176 | fis->fis_type = 0x27; |
184 | 177 | fis->flags &= ~0x80; | |
185 | memset(register_fis, 0, sizeof(*register_fis)); | 178 | fis->flags &= 0xF0; |
186 | |||
187 | register_fis->fis_type = 0x27; | ||
188 | register_fis->flags &= ~0x80; | ||
189 | register_fis->flags &= 0xF0; | ||
190 | if (isci_tmf->tmf_code == isci_tmf_sata_srst_high) | 179 | if (isci_tmf->tmf_code == isci_tmf_sata_srst_high) |
191 | register_fis->control |= ATA_SRST; | 180 | fis->control |= ATA_SRST; |
192 | else | 181 | else |
193 | register_fis->control &= ~ATA_SRST; | 182 | fis->control &= ~ATA_SRST; |
194 | break; | 183 | break; |
195 | } | 184 | } |
196 | /* other management commnd go here... */ | 185 | /* other management commnd go here... */ |
@@ -202,7 +191,7 @@ enum sci_status isci_sata_management_task_request_build( | |||
202 | * based on the h2d fis. | 191 | * based on the h2d fis. |
203 | */ | 192 | */ |
204 | status = scic_task_request_construct_sata( | 193 | status = scic_task_request_construct_sata( |
205 | isci_request->sci_request_handle | 194 | ireq->sci_request_handle |
206 | ); | 195 | ); |
207 | 196 | ||
208 | return status; | 197 | return status; |
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 7d5f79378452..492faeea8b3a 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c | |||
@@ -1431,7 +1431,6 @@ isci_task_request_complete(struct isci_host *ihost, | |||
1431 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); | 1431 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); |
1432 | struct completion *tmf_complete; | 1432 | struct completion *tmf_complete; |
1433 | struct scic_sds_request *sci_req = ireq->sci_request_handle; | 1433 | struct scic_sds_request *sci_req = ireq->sci_request_handle; |
1434 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; | ||
1435 | 1434 | ||
1436 | dev_dbg(&ihost->pdev->dev, | 1435 | dev_dbg(&ihost->pdev->dev, |
1437 | "%s: request = %p, status=%d\n", | 1436 | "%s: request = %p, status=%d\n", |
@@ -1444,11 +1443,11 @@ isci_task_request_complete(struct isci_host *ihost, | |||
1444 | 1443 | ||
1445 | if (tmf->proto == SAS_PROTOCOL_SSP) { | 1444 | if (tmf->proto == SAS_PROTOCOL_SSP) { |
1446 | memcpy(&tmf->resp.resp_iu, | 1445 | memcpy(&tmf->resp.resp_iu, |
1447 | sci_req->response_buffer, | 1446 | &sci_req->ssp.rsp, |
1448 | SSP_RESP_IU_MAX_SIZE); | 1447 | SSP_RESP_IU_MAX_SIZE); |
1449 | } else if (tmf->proto == SAS_PROTOCOL_SATA) { | 1448 | } else if (tmf->proto == SAS_PROTOCOL_SATA) { |
1450 | memcpy(&tmf->resp.d2h_fis, | 1449 | memcpy(&tmf->resp.d2h_fis, |
1451 | &stp_req->d2h_reg_fis, | 1450 | &sci_req->stp.rsp, |
1452 | sizeof(struct dev_to_host_fis)); | 1451 | sizeof(struct dev_to_host_fis)); |
1453 | } | 1452 | } |
1454 | 1453 | ||