aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/task.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2011-05-04 20:53:24 -0400
committerDan Williams <dan.j.williams@intel.com>2011-07-03 07:04:46 -0400
commitaf5ae89350840b9d724fc4fb81d928673bffdd4d (patch)
tree954d27adccdce854c040442fd44d28571924ee13 /drivers/scsi/isci/task.c
parent0cfa890e5a8a9e3b01b75c17a7856cf96e026e27 (diff)
isci: Convert of sci_ssp_response_iu to ssp_response_iu
Converting to Linux native format. However the isci driver does a lot of the calculation based on the max size of this data structure and the Linux data structure only has a pointer to the response data. Thus the sizeof(struct ssp_response_iu) will be incorrect and we need to define the max size. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/task.c')
-rw-r--r--drivers/scsi/isci/task.c100
1 files changed, 34 insertions, 66 deletions
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c
index c4db95933d41..8449d8abd66a 100644
--- a/drivers/scsi/isci/task.c
+++ b/drivers/scsi/isci/task.c
@@ -55,6 +55,7 @@
55 55
56#include <linux/completion.h> 56#include <linux/completion.h>
57#include <linux/irqflags.h> 57#include <linux/irqflags.h>
58#include "sas.h"
58#include "scic_task_request.h" 59#include "scic_task_request.h"
59#include "scic_io_request.h" 60#include "scic_io_request.h"
60#include "remote_device.h" 61#include "remote_device.h"
@@ -63,7 +64,8 @@
63#include "request.h" 64#include "request.h"
64#include "sata.h" 65#include "sata.h"
65#include "task.h" 66#include "task.h"
66#include "core/scic_sds_request.h" 67#include "scic_sds_stp_request.h"
68
67/** 69/**
68* isci_task_refuse() - complete the request to the upper layer driver in 70* isci_task_refuse() - complete the request to the upper layer driver in
69* the case where an I/O needs to be completed back in the submit path. 71* the case where an I/O needs to be completed back in the submit path.
@@ -1411,109 +1413,75 @@ int isci_task_query_task(
1411 return TMF_RESP_FUNC_SUCC; 1413 return TMF_RESP_FUNC_SUCC;
1412} 1414}
1413 1415
1414/** 1416/*
1415 * isci_task_request_complete() - This function is called by the sci core when 1417 * isci_task_request_complete() - This function is called by the sci core when
1416 * an task request completes. 1418 * an task request completes.
1417 * @isci_host: This parameter specifies the ISCI host object 1419 * @ihost: This parameter specifies the ISCI host object
1418 * @request: This parameter is the completed isci_request object. 1420 * @ireq: This parameter is the completed isci_request object.
1419 * @completion_status: This parameter specifies the completion status from the 1421 * @completion_status: This parameter specifies the completion status from the
1420 * sci core. 1422 * sci core.
1421 * 1423 *
1422 * none. 1424 * none.
1423 */ 1425 */
1424void isci_task_request_complete( 1426void
1425 struct isci_host *isci_host, 1427isci_task_request_complete(struct isci_host *ihost,
1426 struct isci_request *request, 1428 struct isci_request *ireq,
1427 enum sci_task_status completion_status) 1429 enum sci_task_status completion_status)
1428{ 1430{
1429 struct isci_remote_device *isci_device = request->isci_device; 1431 struct isci_remote_device *idev = ireq->isci_device;
1430 enum isci_request_status old_state; 1432 enum isci_request_status old_state;
1431 struct isci_tmf *tmf = isci_request_access_tmf(request); 1433 struct isci_tmf *tmf = isci_request_access_tmf(ireq);
1432 struct completion *tmf_complete; 1434 struct completion *tmf_complete;
1435 struct scic_sds_request *sci_req = ireq->sci_request_handle;
1436 struct scic_sds_stp_request *stp_req =
1437 container_of(sci_req, typeof(*stp_req), parent);
1433 1438
1434 dev_dbg(&isci_host->pdev->dev, 1439 dev_dbg(&ihost->pdev->dev,
1435 "%s: request = %p, status=%d\n", 1440 "%s: request = %p, status=%d\n",
1436 __func__, request, completion_status); 1441 __func__, ireq, completion_status);
1437 1442
1438 old_state = isci_request_change_state(request, completed); 1443 old_state = isci_request_change_state(ireq, completed);
1439 1444
1440 tmf->status = completion_status; 1445 tmf->status = completion_status;
1441 request->complete_in_target = true; 1446 ireq->complete_in_target = true;
1442
1443 if (SAS_PROTOCOL_SSP == tmf->proto) {
1444 1447
1448 if (tmf->proto == SAS_PROTOCOL_SSP) {
1445 memcpy(&tmf->resp.resp_iu, 1449 memcpy(&tmf->resp.resp_iu,
1446 scic_io_request_get_response_iu_address( 1450 sci_req->response_buffer,
1447 request->sci_request_handle 1451 SSP_RESP_IU_MAX_SIZE);
1448 ), 1452 } else if (tmf->proto == SAS_PROTOCOL_SATA) {
1449 sizeof(struct sci_ssp_response_iu));
1450
1451 } else if (SAS_PROTOCOL_SATA == tmf->proto) {
1452
1453 memcpy(&tmf->resp.d2h_fis, 1453 memcpy(&tmf->resp.d2h_fis,
1454 scic_stp_io_request_get_d2h_reg_address( 1454 &stp_req->d2h_reg_fis,
1455 request->sci_request_handle),
1456 sizeof(struct dev_to_host_fis)); 1455 sizeof(struct dev_to_host_fis));
1457 } 1456 }
1458 1457
1459 /* Manage the timer if it is still running. */ 1458 /* Manage the timer if it is still running. */
1460 if (tmf->timeout_timer) { 1459 if (tmf->timeout_timer) {
1461 isci_del_timer(isci_host, tmf->timeout_timer); 1460 isci_del_timer(ihost, tmf->timeout_timer);
1462 tmf->timeout_timer = NULL; 1461 tmf->timeout_timer = NULL;
1463 } 1462 }
1464 1463
1465 /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ 1464 /* PRINT_TMF( ((struct isci_tmf *)request->task)); */
1466 tmf_complete = tmf->complete; 1465 tmf_complete = tmf->complete;
1467 1466
1468 scic_controller_complete_io( 1467 scic_controller_complete_io(ihost->core_controller,
1469 isci_host->core_controller, 1468 &idev->sci,
1470 &isci_device->sci, 1469 ireq->sci_request_handle);
1471 request->sci_request_handle); 1470
1472 /* NULL the request handle to make sure it cannot be terminated 1471 /*
1472 * NULL the request handle to make sure it cannot be terminated
1473 * or completed again. 1473 * or completed again.
1474 */ 1474 */
1475 request->sci_request_handle = NULL; 1475 ireq->sci_request_handle = NULL;
1476 1476
1477 isci_request_change_state(request, unallocated); 1477 isci_request_change_state(ireq, unallocated);
1478 list_del_init(&request->dev_node); 1478 list_del_init(&ireq->dev_node);
1479 1479
1480 /* The task management part completes last. */ 1480 /* The task management part completes last. */
1481 complete(tmf_complete); 1481 complete(tmf_complete);
1482} 1482}
1483 1483
1484/** 1484/**
1485 * isci_task_ssp_request_get_response_data_address() - This function is called
1486 * by the sci core to retrieve the response data address for a given task
1487 * request.
1488 * @request: This parameter is the isci_request object.
1489 *
1490 * response data address for specified task request.
1491 */
1492void *isci_task_ssp_request_get_response_data_address(
1493 struct isci_request *request)
1494{
1495 struct isci_tmf *isci_tmf = isci_request_access_tmf(request);
1496
1497 return &isci_tmf->resp.resp_iu;
1498}
1499
1500/**
1501 * isci_task_ssp_request_get_response_data_length() - This function is called
1502 * by the sci core to retrieve the response data length for a given task
1503 * request.
1504 * @request: This parameter is the isci_request object.
1505 *
1506 * response data length for specified task request.
1507 */
1508u32 isci_task_ssp_request_get_response_data_length(
1509 struct isci_request *request)
1510{
1511 struct isci_tmf *isci_tmf = isci_request_access_tmf(request);
1512
1513 return sizeof(isci_tmf->resp.resp_iu);
1514}
1515
1516/**
1517 * isci_bus_reset_handler() - This function performs a target reset of the 1485 * isci_bus_reset_handler() - This function performs a target reset of the
1518 * device referenced by "cmd'. This function is exported through the 1486 * device referenced by "cmd'. This function is exported through the
1519 * "struct scsi_host_template" structure such that it is called when an I/O 1487 * "struct scsi_host_template" structure such that it is called when an I/O