aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/isci/core/intel_sas.h47
-rw-r--r--drivers/scsi/isci/core/scic_sds_request.c108
-rw-r--r--drivers/scsi/isci/request.c121
-rw-r--r--drivers/scsi/isci/sas.h34
-rw-r--r--drivers/scsi/isci/task.c49
5 files changed, 74 insertions, 285 deletions
diff --git a/drivers/scsi/isci/core/intel_sas.h b/drivers/scsi/isci/core/intel_sas.h
index 91c30cfee21d..f7301aa14f02 100644
--- a/drivers/scsi/isci/core/intel_sas.h
+++ b/drivers/scsi/isci/core/intel_sas.h
@@ -160,53 +160,6 @@ enum sci_sas_frame_type {
160 SCI_SAS_TASK_FRAME = 0x16 160 SCI_SAS_TASK_FRAME = 0x16
161}; 161};
162 162
163/**
164 * struct sci_ssp_command_iu - This structure depicts the contents of the SSP
165 * COMMAND INFORMATION UNIT. For specific information on each of these
166 * individual fields please reference the SAS specification SSP transport
167 * layer section.
168 *
169 *
170 */
171struct sci_ssp_command_iu {
172 u32 lun_upper;
173 u32 lun_lower;
174
175 u32 additional_cdb_length:6;
176 u32 reserved0:2;
177 u32 reserved1:8;
178 u32 enable_first_burst:1;
179 u32 task_priority:4;
180 u32 task_attribute:3;
181 u32 reserved2:8;
182
183 u32 cdb[4];
184
185};
186
187/**
188 * struct sci_ssp_task_iu - This structure depicts the contents of the SSP TASK
189 * INFORMATION UNIT. For specific information on each of these individual
190 * fields please reference the SAS specification SSP transport layer section.
191 *
192 *
193 */
194struct sci_ssp_task_iu {
195 u32 lun_upper;
196 u32 lun_lower;
197
198 u32 reserved0:8;
199 u32 task_function:8;
200 u32 reserved1:8;
201 u32 reserved2:8;
202
203 u32 reserved3:16;
204 u32 task_tag:16;
205
206 u32 reserved4[3];
207
208};
209
210#define SSP_RESPONSE_IU_MAX_DATA 64 163#define SSP_RESPONSE_IU_MAX_DATA 64
211 164
212#define SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK (0x03) 165#define SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK (0x03)
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c
index 31df5267c096..b6d1333e01fd 100644
--- a/drivers/scsi/isci/core/scic_sds_request.c
+++ b/drivers/scsi/isci/core/scic_sds_request.c
@@ -54,6 +54,7 @@
54 */ 54 */
55 55
56#include <scsi/sas.h> 56#include <scsi/sas.h>
57#include "sas.h"
57#include "intel_sas.h" 58#include "intel_sas.h"
58#include "scic_controller.h" 59#include "scic_controller.h"
59#include "scic_io_request.h" 60#include "scic_io_request.h"
@@ -98,7 +99,7 @@
98 */ 99 */
99#define scic_ssp_io_request_get_object_size() \ 100#define scic_ssp_io_request_get_object_size() \
100 (\ 101 (\
101 sizeof(struct sci_ssp_command_iu) \ 102 sizeof(struct ssp_cmd_iu) \
102 + sizeof(struct sci_ssp_response_iu) \ 103 + sizeof(struct sci_ssp_response_iu) \
103 ) 104 )
104 105
@@ -109,7 +110,7 @@
109 * memory 110 * memory
110 */ 111 */
111#define scic_sds_ssp_request_get_command_buffer(memory) \ 112#define scic_sds_ssp_request_get_command_buffer(memory) \
112 ((struct sci_ssp_command_iu *)(\ 113 ((struct ssp_cmd_iu *)(\
113 ((char *)(memory)) + sizeof(struct scic_sds_request) \ 114 ((char *)(memory)) + sizeof(struct scic_sds_request) \
114 )) 115 ))
115 116
@@ -122,7 +123,7 @@
122#define scic_sds_ssp_request_get_response_buffer(memory) \ 123#define scic_sds_ssp_request_get_response_buffer(memory) \
123 ((struct sci_ssp_response_iu *)(\ 124 ((struct sci_ssp_response_iu *)(\
124 ((char *)(scic_sds_ssp_request_get_command_buffer(memory))) \ 125 ((char *)(scic_sds_ssp_request_get_command_buffer(memory))) \
125 + sizeof(struct sci_ssp_command_iu) \ 126 + sizeof(struct ssp_cmd_iu) \
126 )) 127 ))
127 128
128/** 129/**
@@ -158,7 +159,7 @@
158 */ 159 */
159#define scic_ssp_task_request_get_object_size() \ 160#define scic_ssp_task_request_get_object_size() \
160 (\ 161 (\
161 sizeof(struct sci_ssp_task_iu) \ 162 sizeof(struct ssp_task_iu) \
162 + sizeof(struct sci_ssp_response_iu) \ 163 + sizeof(struct sci_ssp_response_iu) \
163 ) 164 )
164 165
@@ -169,7 +170,7 @@
169 * memory. Yes its the same as the above macro except for the name. 170 * memory. Yes its the same as the above macro except for the name.
170 */ 171 */
171#define scic_sds_ssp_task_request_get_command_buffer(memory) \ 172#define scic_sds_ssp_task_request_get_command_buffer(memory) \
172 ((struct sci_ssp_task_iu *)(\ 173 ((struct ssp_task_iu *)(\
173 ((char *)(memory)) + sizeof(struct scic_sds_request) \ 174 ((char *)(memory)) + sizeof(struct scic_sds_request) \
174 )) 175 ))
175 176
@@ -182,7 +183,7 @@
182#define scic_sds_ssp_task_request_get_response_buffer(memory) \ 183#define scic_sds_ssp_task_request_get_response_buffer(memory) \
183 ((struct sci_ssp_response_iu *)(\ 184 ((struct sci_ssp_response_iu *)(\
184 ((char *)(scic_sds_ssp_task_request_get_command_buffer(memory))) \ 185 ((char *)(scic_sds_ssp_task_request_get_command_buffer(memory))) \
185 + sizeof(struct sci_ssp_task_iu) \ 186 + sizeof(struct ssp_task_iu) \
186 )) 187 ))
187 188
188/** 189/**
@@ -344,80 +345,49 @@ static void scic_sds_ssp_io_request_assign_buffers(
344 } 345 }
345} 346}
346 347
347/** 348static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req)
348 * This method constructs the SSP Command IU data for this io request object.
349 * @sci_req: This parameter specifies the request object for which the SSP
350 * command information unit is being built.
351 *
352 */
353static void scic_sds_io_request_build_ssp_command_iu(
354 struct scic_sds_request *sds_request)
355{ 349{
356 struct sci_ssp_command_iu *command_frame; 350 struct ssp_cmd_iu *cmd_iu;
357 u32 cdb_length; 351 struct isci_request *ireq = sci_req->ireq;
358 u32 *cdb_buffer; 352 struct sas_task *task = isci_request_access_task(ireq);
359 struct isci_request *isci_request = sds_request->ireq;
360
361 command_frame =
362 (struct sci_ssp_command_iu *)sds_request->command_buffer;
363
364 command_frame->lun_upper = 0;
365 command_frame->lun_lower =
366 isci_request_ssp_io_request_get_lun(isci_request);
367
368 ((u32 *)command_frame)[2] = 0;
369 353
370 cdb_length = isci_request_ssp_io_request_get_cdb_length(isci_request); 354 cmd_iu = sci_req->command_buffer;
371 cdb_buffer = (u32 *)isci_request_ssp_io_request_get_cdb_address(
372 isci_request);
373 355
374 if (cdb_length > 16) { 356 memcpy(cmd_iu->LUN, task->ssp_task.LUN, 8);
375 command_frame->additional_cdb_length = cdb_length - 16; 357 cmd_iu->add_cdb_len = 0;
376 } 358 cmd_iu->_r_a = 0;
359 cmd_iu->_r_b = 0;
360 cmd_iu->en_fburst = 0; /* unsupported */
361 cmd_iu->task_prio = task->ssp_task.task_prio;
362 cmd_iu->task_attr = task->ssp_task.task_attr;
363 cmd_iu->_r_c = 0;
377 364
378 /* / @todo Is it ok to leave junk at the end of the cdb buffer? */
379 scic_word_copy_with_swap( 365 scic_word_copy_with_swap(
380 (u32 *)(&command_frame->cdb), 366 (u32 *)(&cmd_iu->cdb),
381 (u32 *)(cdb_buffer), 367 (u32 *)task->ssp_task.cdb,
382 (cdb_length + 3) / sizeof(u32) 368 sizeof(task->ssp_task.cdb) / sizeof(u32));
383 );
384
385 command_frame->enable_first_burst = 0;
386 command_frame->task_priority =
387 isci_request_ssp_io_request_get_command_priority(isci_request);
388 command_frame->task_attribute =
389 isci_request_ssp_io_request_get_task_attribute(isci_request);
390} 369}
391 370
392 371static void scic_sds_task_request_build_ssp_task_iu(struct scic_sds_request *sci_req)
393/**
394 * This method constructs the SSP Task IU data for this io request object.
395 * @sci_req:
396 *
397 */
398static void scic_sds_task_request_build_ssp_task_iu(
399 struct scic_sds_request *sds_request)
400{ 372{
401 struct sci_ssp_task_iu *command_frame; 373 struct ssp_task_iu *task_iu;
402 struct isci_request *isci_request = sds_request->ireq; 374 struct isci_request *ireq = sci_req->ireq;
375 struct sas_task *task = isci_request_access_task(ireq);
376 struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq);
403 377
404 command_frame = 378 task_iu = sci_req->command_buffer;
405 (struct sci_ssp_task_iu *)sds_request->command_buffer;
406 379
407 command_frame->lun_upper = 0; 380 memset(task_iu, 0, sizeof(struct ssp_task_iu));
408 command_frame->lun_lower = isci_request_ssp_io_request_get_lun(
409 isci_request);
410 381
411 ((u32 *)command_frame)[2] = 0; 382 memcpy(task_iu->LUN, task->ssp_task.LUN, 8);
412 383
413 command_frame->task_function = 384 task_iu->task_func = isci_tmf->tmf_code;
414 isci_task_ssp_request_get_function(isci_request); 385 task_iu->task_tag =
415 command_frame->task_tag = 386 (ireq->ttype == tmf_task) ?
416 isci_task_ssp_request_get_io_tag_to_manage( 387 isci_tmf->io_tag :
417 isci_request); 388 SCI_CONTROLLER_INVALID_IO_TAG;
418} 389}
419 390
420
421/** 391/**
422 * This method is will fill in the SCU Task Context for any type of SSP request. 392 * This method is will fill in the SCU Task Context for any type of SSP request.
423 * @sci_req: 393 * @sci_req:
@@ -533,7 +503,8 @@ static void scu_ssp_io_request_construct_task_context(
533 503
534 scu_ssp_reqeust_construct_task_context(sci_req, task_context); 504 scu_ssp_reqeust_construct_task_context(sci_req, task_context);
535 505
536 task_context->ssp_command_iu_length = sizeof(struct sci_ssp_command_iu) / sizeof(u32); 506 task_context->ssp_command_iu_length =
507 sizeof(struct ssp_cmd_iu) / sizeof(u32);
537 task_context->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME; 508 task_context->type.ssp.frame_type = SCI_SAS_COMMAND_FRAME;
538 509
539 switch (dir) { 510 switch (dir) {
@@ -605,7 +576,8 @@ static void scu_ssp_task_request_construct_task_context(
605 task_context->task_type = SCU_TASK_TYPE_RAW_FRAME; 576 task_context->task_type = SCU_TASK_TYPE_RAW_FRAME;
606 task_context->transfer_length_bytes = 0; 577 task_context->transfer_length_bytes = 0;
607 task_context->type.ssp.frame_type = SCI_SAS_TASK_FRAME; 578 task_context->type.ssp.frame_type = SCI_SAS_TASK_FRAME;
608 task_context->ssp_command_iu_length = sizeof(struct sci_ssp_task_iu) / sizeof(u32); 579 task_context->ssp_command_iu_length =
580 sizeof(struct ssp_task_iu) / sizeof(u32);
609} 581}
610 582
611 583
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index c45e78e41f27..501df3ca4280 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -1241,124 +1241,3 @@ enum dma_data_direction isci_request_io_request_get_data_direction(
1241 1241
1242 return task->data_dir; 1242 return task->data_dir;
1243} 1243}
1244
1245/**
1246 * isci_request_sge_get_address_field() - This function is called by the sci
1247 * core to retrieve the address field contents for a given sge.
1248 * @request: This parameter is the isci_request object.
1249 * @sge_address: This parameter is the sge.
1250 *
1251 * physical address in the specified sge.
1252 */
1253
1254
1255/**
1256 * isci_request_sge_get_length_field() - This function is called by the sci
1257 * core to retrieve the length field contents for a given sge.
1258 * @request: This parameter is the isci_request object.
1259 * @sge_address: This parameter is the sge.
1260 *
1261 * length field value in the specified sge.
1262 */
1263
1264
1265/**
1266 * isci_request_ssp_io_request_get_cdb_address() - This function is called by
1267 * the sci core to retrieve the cdb address for a given request.
1268 * @request: This parameter is the isci_request object.
1269 *
1270 * cdb address for specified request.
1271 */
1272void *isci_request_ssp_io_request_get_cdb_address(
1273 struct isci_request *request)
1274{
1275 struct sas_task *task = isci_request_access_task(request);
1276
1277 dev_dbg(&request->isci_host->pdev->dev,
1278 "%s: request->task->ssp_task.cdb = %p\n",
1279 __func__,
1280 task->ssp_task.cdb);
1281 return task->ssp_task.cdb;
1282}
1283
1284
1285/**
1286 * isci_request_ssp_io_request_get_cdb_length() - This function is called by
1287 * the sci core to retrieve the cdb length for a given request.
1288 * @request: This parameter is the isci_request object.
1289 *
1290 * cdb length for specified request.
1291 */
1292u32 isci_request_ssp_io_request_get_cdb_length(
1293 struct isci_request *request)
1294{
1295 return 16;
1296}
1297
1298
1299/**
1300 * isci_request_ssp_io_request_get_lun() - This function is called by the sci
1301 * core to retrieve the lun for a given request.
1302 * @request: This parameter is the isci_request object.
1303 *
1304 * lun for specified request.
1305 */
1306u32 isci_request_ssp_io_request_get_lun(
1307 struct isci_request *request)
1308{
1309 struct sas_task *task = isci_request_access_task(request);
1310
1311#ifdef DEBUG
1312 int i;
1313
1314 for (i = 0; i < 8; i++)
1315 dev_dbg(&request->isci_host->pdev->dev,
1316 "%s: task->ssp_task.LUN[%d] = %x\n",
1317 __func__, i, task->ssp_task.LUN[i]);
1318
1319#endif
1320
1321 return task->ssp_task.LUN[0];
1322}
1323
1324
1325/**
1326 * isci_request_ssp_io_request_get_task_attribute() - This function is called
1327 * by the sci core to retrieve the task attribute for a given request.
1328 * @request: This parameter is the isci_request object.
1329 *
1330 * task attribute for specified request.
1331 */
1332u32 isci_request_ssp_io_request_get_task_attribute(
1333 struct isci_request *request)
1334{
1335 struct sas_task *task = isci_request_access_task(request);
1336
1337 dev_dbg(&request->isci_host->pdev->dev,
1338 "%s: request->task->ssp_task.task_attr = %x\n",
1339 __func__,
1340 task->ssp_task.task_attr);
1341
1342 return task->ssp_task.task_attr;
1343}
1344
1345
1346/**
1347 * isci_request_ssp_io_request_get_command_priority() - This function is called
1348 * by the sci core to retrieve the command priority for a given request.
1349 * @request: This parameter is the isci_request object.
1350 *
1351 * command priority for specified request.
1352 */
1353u32 isci_request_ssp_io_request_get_command_priority(
1354 struct isci_request *request)
1355{
1356 struct sas_task *task = isci_request_access_task(request);
1357
1358 dev_dbg(&request->isci_host->pdev->dev,
1359 "%s: request->task->ssp_task.task_prio = %x\n",
1360 __func__,
1361 task->ssp_task.task_prio);
1362
1363 return task->ssp_task.task_prio;
1364}
diff --git a/drivers/scsi/isci/sas.h b/drivers/scsi/isci/sas.h
index 05af8bd61453..21ddd63924eb 100644
--- a/drivers/scsi/isci/sas.h
+++ b/drivers/scsi/isci/sas.h
@@ -69,4 +69,38 @@
69#define FIS_PIO_SETUP 0x5F 69#define FIS_PIO_SETUP 0x5F
70#define FIS_DATA 0x46 70#define FIS_DATA 0x46
71 71
72/*
73 * contents of the SSP COMMAND INFORMATION UNIT.
74 * For specific information on each of these individual fields please
75 * reference the SAS specification SSP transport layer section.
76 * XXX: This needs to go into <scsi/sas.h>
77 */
78struct ssp_cmd_iu {
79 u8 LUN[8];
80 u8 add_cdb_len:6;
81 u8 _r_a:2;
82 u8 _r_b;
83 u8 en_fburst:1;
84 u8 task_prio:4;
85 u8 task_attr:3;
86 u8 _r_c;
87
88 u8 cdb[16];
89} __packed;
90
91/*
92 * contents of the SSP TASK INFORMATION UNIT.
93 * For specific information on each of these individual fields please
94 * reference the SAS specification SSP transport layer section.
95 * XXX: This needs to go into <scsi/sas.h>
96 */
97struct ssp_task_iu {
98 u8 LUN[8];
99 u8 _r_a;
100 u8 task_func;
101 u8 _r_b[4];
102 u16 task_tag;
103 u8 _r_c[12];
104} __packed;
105
72#endif 106#endif
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index f9a1c41a5ce8..c4db95933d41 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -1481,55 +1481,6 @@ void isci_task_request_complete(
1481 complete(tmf_complete); 1481 complete(tmf_complete);
1482} 1482}
1483 1483
1484
1485/**
1486 * isci_task_ssp_request_get_lun() - This function is called by the sci core to
1487 * retrieve the lun for a given task request.
1488 * @request: This parameter is the isci_request object.
1489 *
1490 * lun for specified task request.
1491 */
1492
1493/**
1494 * isci_task_ssp_request_get_function() - This function is called by the sci
1495 * core to retrieve the function for a given task request.
1496 * @request: This parameter is the isci_request object.
1497 *
1498 * function code for specified task request.
1499 */
1500u8 isci_task_ssp_request_get_function(struct isci_request *request)
1501{
1502 struct isci_tmf *isci_tmf = isci_request_access_tmf(request);
1503
1504 dev_dbg(&request->isci_host->pdev->dev,
1505 "%s: func = %d\n", __func__, isci_tmf->tmf_code);
1506
1507 return isci_tmf->tmf_code;
1508}
1509
1510/**
1511 * isci_task_ssp_request_get_io_tag_to_manage() - This function is called by
1512 * the sci core to retrieve the io tag for a given task request.
1513 * @request: This parameter is the isci_request object.
1514 *
1515 * io tag for specified task request.
1516 */
1517u16 isci_task_ssp_request_get_io_tag_to_manage(struct isci_request *request)
1518{
1519 u16 io_tag = SCI_CONTROLLER_INVALID_IO_TAG;
1520
1521 if (tmf_task == request->ttype) {
1522 struct isci_tmf *tmf = isci_request_access_tmf(request);
1523 io_tag = tmf->io_tag;
1524 }
1525
1526 dev_dbg(&request->isci_host->pdev->dev,
1527 "%s: request = %p, io_tag = %d\n",
1528 __func__, request, io_tag);
1529
1530 return io_tag;
1531}
1532
1533/** 1484/**
1534 * isci_task_ssp_request_get_response_data_address() - This function is called 1485 * isci_task_ssp_request_get_response_data_address() - This function is called
1535 * by the sci core to retrieve the response data address for a given task 1486 * by the sci core to retrieve the response data address for a given task