diff options
Diffstat (limited to 'drivers/scsi/isci')
-rw-r--r-- | drivers/scsi/isci/core/sci_util.c | 9 | ||||
-rw-r--r-- | drivers/scsi/isci/core/sci_util.h | 3 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_io_request.h | 33 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_controller.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.c | 53 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_request.h | 14 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_sds_stp_request.c | 4 | ||||
-rw-r--r-- | drivers/scsi/isci/core/scic_task_request.h | 36 | ||||
-rw-r--r-- | drivers/scsi/isci/host.c | 8 | ||||
-rw-r--r-- | drivers/scsi/isci/host.h | 1 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 2 | ||||
-rw-r--r-- | drivers/scsi/isci/request.c | 168 | ||||
-rw-r--r-- | drivers/scsi/isci/request.h | 12 | ||||
-rw-r--r-- | drivers/scsi/isci/sata.c | 10 | ||||
-rw-r--r-- | drivers/scsi/isci/task.c | 30 |
15 files changed, 128 insertions, 257 deletions
diff --git a/drivers/scsi/isci/core/sci_util.c b/drivers/scsi/isci/core/sci_util.c index 0c75d14240a1..4e60d55836e9 100644 --- a/drivers/scsi/isci/core/sci_util.c +++ b/drivers/scsi/isci/core/sci_util.c | |||
@@ -59,14 +59,14 @@ | |||
59 | 59 | ||
60 | void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, dma_addr_t phys_addr) | 60 | void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, dma_addr_t phys_addr) |
61 | { | 61 | { |
62 | struct isci_request *ireq = sci_req->ireq; | 62 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
63 | dma_addr_t offset; | 63 | dma_addr_t offset; |
64 | 64 | ||
65 | BUG_ON(phys_addr < ireq->request_daddr); | 65 | BUG_ON(phys_addr < ireq->request_daddr); |
66 | 66 | ||
67 | offset = phys_addr - ireq->request_daddr; | 67 | offset = phys_addr - ireq->request_daddr; |
68 | 68 | ||
69 | BUG_ON(offset >= ireq->request_alloc_size); | 69 | BUG_ON(offset >= sizeof(*ireq)); |
70 | 70 | ||
71 | return (char *)ireq + offset; | 71 | return (char *)ireq + offset; |
72 | } | 72 | } |
@@ -74,14 +74,13 @@ void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, dma_addr_t ph | |||
74 | dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *sds_request, | 74 | dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *sds_request, |
75 | void *virt_addr) | 75 | void *virt_addr) |
76 | { | 76 | { |
77 | struct isci_request *isci_request = sds_request->ireq; | 77 | struct isci_request *isci_request = sci_req_to_ireq(sds_request); |
78 | 78 | ||
79 | char *requested_addr = (char *)virt_addr; | 79 | char *requested_addr = (char *)virt_addr; |
80 | char *base_addr = (char *)isci_request; | 80 | char *base_addr = (char *)isci_request; |
81 | 81 | ||
82 | BUG_ON(requested_addr < base_addr); | 82 | BUG_ON(requested_addr < base_addr); |
83 | BUG_ON((requested_addr - base_addr) >= | 83 | BUG_ON((requested_addr - base_addr) >= sizeof(*isci_request)); |
84 | isci_request->request_alloc_size); | ||
85 | 84 | ||
86 | return isci_request->request_daddr + (requested_addr - base_addr); | 85 | return isci_request->request_daddr + (requested_addr - base_addr); |
87 | } | 86 | } |
diff --git a/drivers/scsi/isci/core/sci_util.h b/drivers/scsi/isci/core/sci_util.h index 4e9c3189cf95..0f9dd0fe1266 100644 --- a/drivers/scsi/isci/core/sci_util.h +++ b/drivers/scsi/isci/core/sci_util.h | |||
@@ -66,9 +66,6 @@ | |||
66 | | ((char_buffer)[3]) \ | 66 | | ((char_buffer)[3]) \ |
67 | ) | 67 | ) |
68 | 68 | ||
69 | #define SCI_FIELD_OFFSET(type, field) ((unsigned long)&(((type *)0)->field)) | ||
70 | |||
71 | |||
72 | #define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \ | 69 | #define sci_cb_make_physical_address(physical_addr, addr_upper, addr_lower) \ |
73 | ((physical_addr) = (addr_lower) | ((u64)addr_upper) << 32) | 70 | ((physical_addr) = (addr_lower) | ((u64)addr_upper) << 32) |
74 | 71 | ||
diff --git a/drivers/scsi/isci/core/scic_io_request.h b/drivers/scsi/isci/core/scic_io_request.h index cb3667decb3c..f7c6d426f8c0 100644 --- a/drivers/scsi/isci/core/scic_io_request.h +++ b/drivers/scsi/isci/core/scic_io_request.h | |||
@@ -102,41 +102,10 @@ typedef enum { | |||
102 | 102 | ||
103 | } SCIC_TRANSPORT_PROTOCOL; | 103 | } SCIC_TRANSPORT_PROTOCOL; |
104 | 104 | ||
105 | |||
106 | /** | ||
107 | * scic_io_request_construct() - This method is called by the SCI user to | ||
108 | * construct all SCI Core IO requests. Memory initialization and | ||
109 | * functionality common to all IO request types is performed in this method. | ||
110 | * @scic_controller: the handle to the core controller object for which to | ||
111 | * build an IO request. | ||
112 | * @scic_remote_device: the handle to the core remote device object for which | ||
113 | * to build an IO request. | ||
114 | * @io_tag: This parameter specifies the IO tag to be associated with this | ||
115 | * request. If SCI_CONTROLLER_INVALID_IO_TAG is passed, then a copy of the | ||
116 | * request is built internally. The request will be copied into the actual | ||
117 | * controller request memory when the IO tag is allocated internally during | ||
118 | * the scic_controller_start_io() method. | ||
119 | * @user_io_request_object: This parameter specifies the user IO request to be | ||
120 | * utilized during IO construction. This IO pointer will become the | ||
121 | * associated object for the core IO request object. | ||
122 | * @scic_io_request_memory: This parameter specifies the memory location to be | ||
123 | * utilized when building the core request. | ||
124 | * @new_scic_io_request_handle: This parameter specifies a pointer to the | ||
125 | * handle the core will expect in further interactions with the core IO | ||
126 | * request object. | ||
127 | * | ||
128 | * The SCI core implementation will create an association between the user IO | ||
129 | * request object and the core IO request object. Indicate if the controller | ||
130 | * successfully built the IO request. SCI_SUCCESS This value is returned if the | ||
131 | * IO request was successfully built. | ||
132 | */ | ||
133 | enum sci_status scic_io_request_construct( | 105 | enum sci_status scic_io_request_construct( |
134 | struct scic_sds_controller *scic_controller, | 106 | struct scic_sds_controller *scic_controller, |
135 | struct scic_sds_remote_device *scic_remote_device, | 107 | struct scic_sds_remote_device *scic_remote_device, |
136 | u16 io_tag, | 108 | u16 io_tag, struct scic_sds_request *sci_req); |
137 | void *user_io_request_object, | ||
138 | struct scic_sds_request *scic_io_request_memory, | ||
139 | struct scic_sds_request **new_scic_io_request_handle); | ||
140 | 109 | ||
141 | /** | 110 | /** |
142 | * scic_io_request_construct_basic_ssp() - This method is called by the SCI | 111 | * scic_io_request_construct_basic_ssp() - This method is called by the SCI |
diff --git a/drivers/scsi/isci/core/scic_sds_controller.c b/drivers/scsi/isci/core/scic_sds_controller.c index 4179bdf3eda7..852b7d52f84f 100644 --- a/drivers/scsi/isci/core/scic_sds_controller.c +++ b/drivers/scsi/isci/core/scic_sds_controller.c | |||
@@ -1572,7 +1572,7 @@ void scic_sds_controller_copy_task_context( | |||
1572 | 1572 | ||
1573 | memcpy(task_context_buffer, | 1573 | memcpy(task_context_buffer, |
1574 | sci_req->task_context_buffer, | 1574 | sci_req->task_context_buffer, |
1575 | SCI_FIELD_OFFSET(struct scu_task_context, sgl_snapshot_ac)); | 1575 | offsetof(struct scu_task_context, sgl_snapshot_ac)); |
1576 | 1576 | ||
1577 | /* | 1577 | /* |
1578 | * Now that the soft copy of the TC has been copied into the TC | 1578 | * Now that the soft copy of the TC has been copied into the TC |
diff --git a/drivers/scsi/isci/core/scic_sds_request.c b/drivers/scsi/isci/core/scic_sds_request.c index 36c2b310c175..50dd19bba3db 100644 --- a/drivers/scsi/isci/core/scic_sds_request.c +++ b/drivers/scsi/isci/core/scic_sds_request.c | |||
@@ -117,7 +117,7 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair( | |||
117 | */ | 117 | */ |
118 | void scic_sds_request_build_sgl(struct scic_sds_request *sds_request) | 118 | void scic_sds_request_build_sgl(struct scic_sds_request *sds_request) |
119 | { | 119 | { |
120 | struct isci_request *isci_request = sds_request->ireq; | 120 | struct isci_request *isci_request = sci_req_to_ireq(sds_request); |
121 | struct isci_host *isci_host = isci_request->isci_host; | 121 | struct isci_host *isci_host = isci_request->isci_host; |
122 | struct sas_task *task = isci_request_access_task(isci_request); | 122 | struct sas_task *task = isci_request_access_task(isci_request); |
123 | struct scatterlist *sg = NULL; | 123 | struct scatterlist *sg = NULL; |
@@ -190,7 +190,7 @@ static void scic_sds_ssp_io_request_assign_buffers(struct scic_sds_request *sci_ | |||
190 | static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req) | 190 | static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sci_req) |
191 | { | 191 | { |
192 | struct ssp_cmd_iu *cmd_iu; | 192 | struct ssp_cmd_iu *cmd_iu; |
193 | struct isci_request *ireq = sci_req->ireq; | 193 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
194 | struct sas_task *task = isci_request_access_task(ireq); | 194 | struct sas_task *task = isci_request_access_task(ireq); |
195 | 195 | ||
196 | cmd_iu = &sci_req->ssp.cmd; | 196 | cmd_iu = &sci_req->ssp.cmd; |
@@ -211,7 +211,7 @@ static void scic_sds_io_request_build_ssp_command_iu(struct scic_sds_request *sc | |||
211 | static void scic_sds_task_request_build_ssp_task_iu(struct scic_sds_request *sci_req) | 211 | static void scic_sds_task_request_build_ssp_task_iu(struct scic_sds_request *sci_req) |
212 | { | 212 | { |
213 | struct ssp_task_iu *task_iu; | 213 | struct ssp_task_iu *task_iu; |
214 | struct isci_request *ireq = sci_req->ireq; | 214 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
215 | struct sas_task *task = isci_request_access_task(ireq); | 215 | struct sas_task *task = isci_request_access_task(ireq); |
216 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); | 216 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); |
217 | 217 | ||
@@ -429,7 +429,7 @@ scic_io_request_construct_sata(struct scic_sds_request *sci_req, | |||
429 | bool copy) | 429 | bool copy) |
430 | { | 430 | { |
431 | enum sci_status status = SCI_SUCCESS; | 431 | enum sci_status status = SCI_SUCCESS; |
432 | struct isci_request *ireq = sci_req->ireq; | 432 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
433 | struct sas_task *task = isci_request_access_task(ireq); | 433 | struct sas_task *task = isci_request_access_task(ireq); |
434 | 434 | ||
435 | /* check for management protocols */ | 435 | /* check for management protocols */ |
@@ -478,7 +478,7 @@ scic_io_request_construct_sata(struct scic_sds_request *sci_req, | |||
478 | enum sci_status scic_io_request_construct_basic_ssp( | 478 | enum sci_status scic_io_request_construct_basic_ssp( |
479 | struct scic_sds_request *sci_req) | 479 | struct scic_sds_request *sci_req) |
480 | { | 480 | { |
481 | struct isci_request *ireq = sci_req->ireq; | 481 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
482 | struct sas_task *task = isci_request_access_task(ireq); | 482 | struct sas_task *task = isci_request_access_task(ireq); |
483 | 483 | ||
484 | sci_req->protocol = SCIC_SSP_PROTOCOL; | 484 | sci_req->protocol = SCIC_SSP_PROTOCOL; |
@@ -519,7 +519,7 @@ enum sci_status scic_io_request_construct_basic_sata( | |||
519 | enum sci_status status; | 519 | enum sci_status status; |
520 | struct scic_sds_stp_request *stp_req; | 520 | struct scic_sds_stp_request *stp_req; |
521 | bool copy = false; | 521 | bool copy = false; |
522 | struct isci_request *isci_request = sci_req->ireq; | 522 | struct isci_request *isci_request = sci_req_to_ireq(sci_req); |
523 | struct sas_task *task = isci_request_access_task(isci_request); | 523 | struct sas_task *task = isci_request_access_task(isci_request); |
524 | 524 | ||
525 | stp_req = &sci_req->stp.req; | 525 | stp_req = &sci_req->stp.req; |
@@ -540,11 +540,10 @@ enum sci_status scic_io_request_construct_basic_sata( | |||
540 | } | 540 | } |
541 | 541 | ||
542 | 542 | ||
543 | enum sci_status scic_task_request_construct_sata( | 543 | enum sci_status scic_task_request_construct_sata(struct scic_sds_request *sci_req) |
544 | struct scic_sds_request *sci_req) | ||
545 | { | 544 | { |
546 | enum sci_status status = SCI_SUCCESS; | 545 | enum sci_status status = SCI_SUCCESS; |
547 | struct isci_request *ireq = sci_req->ireq; | 546 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
548 | 547 | ||
549 | /* check for management protocols */ | 548 | /* check for management protocols */ |
550 | if (ireq->ttype == tmf_task) { | 549 | if (ireq->ttype == tmf_task) { |
@@ -740,7 +739,7 @@ void scic_sds_io_request_copy_response(struct scic_sds_request *sci_req) | |||
740 | void *resp_buf; | 739 | void *resp_buf; |
741 | u32 len; | 740 | u32 len; |
742 | struct ssp_response_iu *ssp_response; | 741 | struct ssp_response_iu *ssp_response; |
743 | struct isci_request *ireq = sci_req->ireq; | 742 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
744 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); | 743 | struct isci_tmf *isci_tmf = isci_request_access_tmf(ireq); |
745 | 744 | ||
746 | ssp_response = &sci_req->ssp.rsp; | 745 | ssp_response = &sci_req->ssp.rsp; |
@@ -1342,7 +1341,7 @@ static void scic_sds_request_completed_state_enter(void *object) | |||
1342 | struct scic_sds_controller *scic = | 1341 | struct scic_sds_controller *scic = |
1343 | scic_sds_request_get_controller(sci_req); | 1342 | scic_sds_request_get_controller(sci_req); |
1344 | struct isci_host *ihost = scic_to_ihost(scic); | 1343 | struct isci_host *ihost = scic_to_ihost(scic); |
1345 | struct isci_request *ireq = sci_req->ireq; | 1344 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
1346 | 1345 | ||
1347 | SET_STATE_HANDLER(sci_req, | 1346 | SET_STATE_HANDLER(sci_req, |
1348 | scic_sds_request_state_handler_table, | 1347 | scic_sds_request_state_handler_table, |
@@ -1424,16 +1423,13 @@ static const struct sci_base_state scic_sds_request_state_table[] = { | |||
1424 | 1423 | ||
1425 | static void scic_sds_general_request_construct(struct scic_sds_controller *scic, | 1424 | static void scic_sds_general_request_construct(struct scic_sds_controller *scic, |
1426 | struct scic_sds_remote_device *sci_dev, | 1425 | struct scic_sds_remote_device *sci_dev, |
1427 | u16 io_tag, | 1426 | u16 io_tag, struct scic_sds_request *sci_req) |
1428 | void *user_io_request_object, | ||
1429 | struct scic_sds_request *sci_req) | ||
1430 | { | 1427 | { |
1431 | sci_base_state_machine_construct(&sci_req->state_machine, sci_req, | 1428 | sci_base_state_machine_construct(&sci_req->state_machine, sci_req, |
1432 | scic_sds_request_state_table, SCI_BASE_REQUEST_STATE_INITIAL); | 1429 | scic_sds_request_state_table, SCI_BASE_REQUEST_STATE_INITIAL); |
1433 | sci_base_state_machine_start(&sci_req->state_machine); | 1430 | sci_base_state_machine_start(&sci_req->state_machine); |
1434 | 1431 | ||
1435 | sci_req->io_tag = io_tag; | 1432 | sci_req->io_tag = io_tag; |
1436 | sci_req->user_request = user_io_request_object; | ||
1437 | sci_req->owning_controller = scic; | 1433 | sci_req->owning_controller = scic; |
1438 | sci_req->target_device = sci_dev; | 1434 | sci_req->target_device = sci_dev; |
1439 | sci_req->has_started_substate_machine = false; | 1435 | sci_req->has_started_substate_machine = false; |
@@ -1461,20 +1457,13 @@ static void scic_sds_general_request_construct(struct scic_sds_controller *scic, | |||
1461 | enum sci_status | 1457 | enum sci_status |
1462 | scic_io_request_construct(struct scic_sds_controller *scic, | 1458 | scic_io_request_construct(struct scic_sds_controller *scic, |
1463 | struct scic_sds_remote_device *sci_dev, | 1459 | struct scic_sds_remote_device *sci_dev, |
1464 | u16 io_tag, | 1460 | u16 io_tag, struct scic_sds_request *sci_req) |
1465 | void *user_req, | ||
1466 | struct scic_sds_request *sci_req, | ||
1467 | struct scic_sds_request **new_sci_req) | ||
1468 | { | 1461 | { |
1469 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 1462 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
1470 | enum sci_status status = SCI_SUCCESS; | 1463 | enum sci_status status = SCI_SUCCESS; |
1471 | 1464 | ||
1472 | /* Build the common part of the request */ | 1465 | /* Build the common part of the request */ |
1473 | scic_sds_general_request_construct(scic, | 1466 | scic_sds_general_request_construct(scic, sci_dev, io_tag, sci_req); |
1474 | sci_dev, | ||
1475 | io_tag, | ||
1476 | user_req, | ||
1477 | sci_req); | ||
1478 | 1467 | ||
1479 | if (sci_dev->rnc.remote_node_index == | 1468 | if (sci_dev->rnc.remote_node_index == |
1480 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) | 1469 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) |
@@ -1493,10 +1482,8 @@ scic_io_request_construct(struct scic_sds_controller *scic, | |||
1493 | status = SCI_FAILURE_UNSUPPORTED_PROTOCOL; | 1482 | status = SCI_FAILURE_UNSUPPORTED_PROTOCOL; |
1494 | 1483 | ||
1495 | if (status == SCI_SUCCESS) { | 1484 | if (status == SCI_SUCCESS) { |
1496 | memset(sci_req->task_context_buffer, | 1485 | memset(sci_req->task_context_buffer, 0, |
1497 | 0, | 1486 | offsetof(struct scu_task_context, sgl_pair_ab)); |
1498 | SCI_FIELD_OFFSET(struct scu_task_context, sgl_pair_ab)); | ||
1499 | *new_sci_req = sci_req; | ||
1500 | } | 1487 | } |
1501 | 1488 | ||
1502 | return status; | 1489 | return status; |
@@ -1504,18 +1491,13 @@ scic_io_request_construct(struct scic_sds_controller *scic, | |||
1504 | 1491 | ||
1505 | enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | 1492 | enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, |
1506 | struct scic_sds_remote_device *sci_dev, | 1493 | struct scic_sds_remote_device *sci_dev, |
1507 | u16 io_tag, | 1494 | u16 io_tag, struct scic_sds_request *sci_req) |
1508 | void *user_io_request_object, | ||
1509 | struct scic_sds_request *sci_req, | ||
1510 | struct scic_sds_request **new_sci_req) | ||
1511 | { | 1495 | { |
1512 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 1496 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
1513 | enum sci_status status = SCI_SUCCESS; | 1497 | enum sci_status status = SCI_SUCCESS; |
1514 | 1498 | ||
1515 | /* Build the common part of the request */ | 1499 | /* Build the common part of the request */ |
1516 | scic_sds_general_request_construct(scic, sci_dev, io_tag, | 1500 | scic_sds_general_request_construct(scic, sci_dev, io_tag, sci_req); |
1517 | user_io_request_object, | ||
1518 | sci_req); | ||
1519 | 1501 | ||
1520 | if (dev->dev_type == SAS_END_DEV) { | 1502 | if (dev->dev_type == SAS_END_DEV) { |
1521 | scic_sds_ssp_task_request_assign_buffers(sci_req); | 1503 | scic_sds_ssp_task_request_assign_buffers(sci_req); |
@@ -1537,7 +1519,6 @@ enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | |||
1537 | if (status == SCI_SUCCESS) { | 1519 | if (status == SCI_SUCCESS) { |
1538 | sci_req->is_task_management_request = true; | 1520 | sci_req->is_task_management_request = true; |
1539 | memset(sci_req->task_context_buffer, 0, sizeof(struct scu_task_context)); | 1521 | memset(sci_req->task_context_buffer, 0, sizeof(struct scu_task_context)); |
1540 | *new_sci_req = sci_req; | ||
1541 | } | 1522 | } |
1542 | 1523 | ||
1543 | return status; | 1524 | return status; |
diff --git a/drivers/scsi/isci/core/scic_sds_request.h b/drivers/scsi/isci/core/scic_sds_request.h index 3f551eaf3dfa..1dd98aabe32d 100644 --- a/drivers/scsi/isci/core/scic_sds_request.h +++ b/drivers/scsi/isci/core/scic_sds_request.h | |||
@@ -113,26 +113,12 @@ enum scic_sds_smp_request_started_substates { | |||
113 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION, | 113 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION, |
114 | }; | 114 | }; |
115 | 115 | ||
116 | struct isci_request; | ||
117 | /** | ||
118 | * struct scic_sds_request - This structure contains or references all of | ||
119 | * the data necessary to process a task management or normal IO request. | ||
120 | * | ||
121 | * | ||
122 | */ | ||
123 | struct scic_sds_request { | 116 | struct scic_sds_request { |
124 | /** | 117 | /** |
125 | * The field specifies that the peer object for the request object. | ||
126 | */ | ||
127 | struct isci_request *ireq; | ||
128 | |||
129 | /** | ||
130 | * This field contains the information for the base request state machine. | 118 | * This field contains the information for the base request state machine. |
131 | */ | 119 | */ |
132 | struct sci_base_state_machine state_machine; | 120 | struct sci_base_state_machine state_machine; |
133 | 121 | ||
134 | void *user_request; | ||
135 | |||
136 | /** | 122 | /** |
137 | * This field simply points to the controller to which this IO request | 123 | * This field simply points to the controller to which this IO request |
138 | * is associated. | 124 | * is associated. |
diff --git a/drivers/scsi/isci/core/scic_sds_stp_request.c b/drivers/scsi/isci/core/scic_sds_stp_request.c index c7a8931a3bcb..2677393db6f4 100644 --- a/drivers/scsi/isci/core/scic_sds_stp_request.c +++ b/drivers/scsi/isci/core/scic_sds_stp_request.c | |||
@@ -627,7 +627,7 @@ scic_sds_stp_request_pio_data_in_copy_data_buffer(struct scic_sds_stp_request *s | |||
627 | int total_len = len; | 627 | int total_len = len; |
628 | 628 | ||
629 | sci_req = to_sci_req(stp_req); | 629 | sci_req = to_sci_req(stp_req); |
630 | ireq = scic_sds_request_get_user_request(sci_req); | 630 | ireq = sci_req_to_ireq(sci_req); |
631 | task = isci_request_access_task(ireq); | 631 | task = isci_request_access_task(ireq); |
632 | src_addr = data_buf; | 632 | src_addr = data_buf; |
633 | 633 | ||
@@ -737,7 +737,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(struct | |||
737 | { | 737 | { |
738 | struct scic_sds_controller *scic = sci_req->owning_controller; | 738 | struct scic_sds_controller *scic = sci_req->owning_controller; |
739 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; | 739 | struct scic_sds_stp_request *stp_req = &sci_req->stp.req; |
740 | struct isci_request *ireq = sci_req->ireq; | 740 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
741 | struct sas_task *task = isci_request_access_task(ireq); | 741 | struct sas_task *task = isci_request_access_task(ireq); |
742 | struct dev_to_host_fis *frame_header; | 742 | struct dev_to_host_fis *frame_header; |
743 | enum sci_status status; | 743 | enum sci_status status; |
diff --git a/drivers/scsi/isci/core/scic_task_request.h b/drivers/scsi/isci/core/scic_task_request.h index 7e6d20aa0f02..98cfaa9e6d38 100644 --- a/drivers/scsi/isci/core/scic_task_request.h +++ b/drivers/scsi/isci/core/scic_task_request.h | |||
@@ -72,44 +72,10 @@ struct scic_sds_remote_device; | |||
72 | struct scic_sds_controller; | 72 | struct scic_sds_controller; |
73 | 73 | ||
74 | 74 | ||
75 | /** | ||
76 | * scic_task_request_construct() - This method is called by the SCI user to | ||
77 | * construct all SCI Core task management requests, regardless of protocol. | ||
78 | * Memory initialization and functionality common to all task request types | ||
79 | * is performed in this method. | ||
80 | * @scic_controller: the handle to the core controller object for which to | ||
81 | * build the task managmement request. | ||
82 | * @scic_remote_device: the handle to the core remote device object for which | ||
83 | * to build the task management request. passed, then a copy of the request | ||
84 | * is built internally. The request will be copied into the actual | ||
85 | * controller request memory when the task is allocated internally during | ||
86 | * the scic_controller_start_task() method. | ||
87 | * @io_tag: This parameter specifies the IO tag to be associated with this | ||
88 | * request. If SCI_CONTROLLER_INVALID_IO_TAG is passed, then a copy of the | ||
89 | * request is built internally. The request will be copied into the actual | ||
90 | * controller request memory when the IO tag is allocated internally during | ||
91 | * the scic_controller_start_io() method. | ||
92 | * @user_task_request_object: This parameter specifies the user task request to | ||
93 | * be utilized during construction. This task pointer will become the | ||
94 | * associated object for the core task request object. | ||
95 | * @scic_task_request_memory: This parameter specifies the memory location to | ||
96 | * be utilized when building the core request. | ||
97 | * @new_scic_task_request_handle: This parameter specifies a pointer to the | ||
98 | * handle the core will expect in further interactions with the core task | ||
99 | * request object. | ||
100 | * | ||
101 | * The SCI core implementation will create an association between the user task | ||
102 | * request object and the core task request object. Indicate if the controller | ||
103 | * successfully built the task request. SCI_SUCCESS This value is returned if | ||
104 | * the task request was successfully built. | ||
105 | */ | ||
106 | enum sci_status scic_task_request_construct( | 75 | enum sci_status scic_task_request_construct( |
107 | struct scic_sds_controller *scic_controller, | 76 | struct scic_sds_controller *scic_controller, |
108 | struct scic_sds_remote_device *scic_remote_device, | 77 | struct scic_sds_remote_device *scic_remote_device, |
109 | u16 io_tag, | 78 | u16 io_tag, struct scic_sds_request *sci_req); |
110 | void *user_task_request_object, | ||
111 | void *scic_task_request_memory, | ||
112 | struct scic_sds_request **new_scic_task_request_handle); | ||
113 | 79 | ||
114 | /** | 80 | /** |
115 | * scic_task_request_construct_ssp() - This method is called by the SCI user to | 81 | * scic_task_request_construct_ssp() - This method is called by the SCI user to |
diff --git a/drivers/scsi/isci/host.c b/drivers/scsi/isci/host.c index 4d0ee7bf847b..271a7e171e7d 100644 --- a/drivers/scsi/isci/host.c +++ b/drivers/scsi/isci/host.c | |||
@@ -428,14 +428,8 @@ int isci_host_init(struct isci_host *isci_host) | |||
428 | if (err) | 428 | if (err) |
429 | return err; | 429 | return err; |
430 | 430 | ||
431 | /* | ||
432 | * keep the pool alloc size around, will use it for a bounds checking | ||
433 | * when trying to convert virtual addresses to physical addresses | ||
434 | */ | ||
435 | isci_host->dma_pool_alloc_size = sizeof(struct isci_request) + | ||
436 | sizeof(struct scic_sds_request); | ||
437 | isci_host->dma_pool = dmam_pool_create(DRV_NAME, &isci_host->pdev->dev, | 431 | isci_host->dma_pool = dmam_pool_create(DRV_NAME, &isci_host->pdev->dev, |
438 | isci_host->dma_pool_alloc_size, | 432 | sizeof(struct isci_request), |
439 | SLAB_HWCACHE_ALIGN, 0); | 433 | SLAB_HWCACHE_ALIGN, 0); |
440 | 434 | ||
441 | if (!isci_host->dma_pool) | 435 | if (!isci_host->dma_pool) |
diff --git a/drivers/scsi/isci/host.h b/drivers/scsi/isci/host.h index 5a414c31a877..afa41e83eaa7 100644 --- a/drivers/scsi/isci/host.h +++ b/drivers/scsi/isci/host.h | |||
@@ -82,7 +82,6 @@ struct isci_host { | |||
82 | struct list_head timers; | 82 | struct list_head timers; |
83 | void *core_ctrl_memory; | 83 | void *core_ctrl_memory; |
84 | struct dma_pool *dma_pool; | 84 | struct dma_pool *dma_pool; |
85 | unsigned int dma_pool_alloc_size; | ||
86 | struct isci_phy phys[SCI_MAX_PHYS]; | 85 | struct isci_phy phys[SCI_MAX_PHYS]; |
87 | struct isci_port ports[SCI_MAX_PORTS + 1]; /* includes dummy port */ | 86 | struct isci_port ports[SCI_MAX_PORTS + 1]; /* includes dummy port */ |
88 | struct sas_ha_struct sas_ha; | 87 | struct sas_ha_struct sas_ha; |
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index a441c23b6859..8b1ef19a6732 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c | |||
@@ -473,7 +473,7 @@ enum sci_status scic_sds_remote_device_start_io(struct scic_sds_controller *scic | |||
473 | struct sci_base_state_machine *sm = &sci_dev->state_machine; | 473 | struct sci_base_state_machine *sm = &sci_dev->state_machine; |
474 | enum scic_sds_remote_device_states state = sm->current_state_id; | 474 | enum scic_sds_remote_device_states state = sm->current_state_id; |
475 | struct scic_sds_port *sci_port = sci_dev->owning_port; | 475 | struct scic_sds_port *sci_port = sci_dev->owning_port; |
476 | struct isci_request *ireq = sci_req->ireq; | 476 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
477 | enum sci_status status; | 477 | enum sci_status status; |
478 | 478 | ||
479 | switch (state) { | 479 | switch (state) { |
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c index a5b9b22d3b3a..4961ee347091 100644 --- a/drivers/scsi/isci/request.c +++ b/drivers/scsi/isci/request.c | |||
@@ -73,9 +73,7 @@ static enum sci_status isci_request_ssp_request_construct( | |||
73 | "%s: request = %p\n", | 73 | "%s: request = %p\n", |
74 | __func__, | 74 | __func__, |
75 | request); | 75 | request); |
76 | status = scic_io_request_construct_basic_ssp( | 76 | status = scic_io_request_construct_basic_ssp(&request->sci); |
77 | request->sci_request_handle | ||
78 | ); | ||
79 | return status; | 77 | return status; |
80 | } | 78 | } |
81 | 79 | ||
@@ -96,9 +94,7 @@ static enum sci_status isci_request_stp_request_construct( | |||
96 | */ | 94 | */ |
97 | register_fis = isci_sata_task_to_fis_copy(task); | 95 | register_fis = isci_sata_task_to_fis_copy(task); |
98 | 96 | ||
99 | status = scic_io_request_construct_basic_sata( | 97 | status = scic_io_request_construct_basic_sata(&request->sci); |
100 | request->sci_request_handle | ||
101 | ); | ||
102 | 98 | ||
103 | /* Set the ncq tag in the fis, from the queue | 99 | /* Set the ncq tag in the fis, from the queue |
104 | * command in the task. | 100 | * command in the task. |
@@ -125,7 +121,7 @@ static enum sci_status isci_smp_request_build(struct isci_request *ireq) | |||
125 | { | 121 | { |
126 | enum sci_status status = SCI_FAILURE; | 122 | enum sci_status status = SCI_FAILURE; |
127 | struct sas_task *task = isci_request_access_task(ireq); | 123 | struct sas_task *task = isci_request_access_task(ireq); |
128 | struct scic_sds_request *sci_req = ireq->sci_request_handle; | 124 | struct scic_sds_request *sci_req = &ireq->sci; |
129 | 125 | ||
130 | dev_dbg(&ireq->isci_host->pdev->dev, | 126 | dev_dbg(&ireq->isci_host->pdev->dev, |
131 | "%s: request = %p\n", __func__, ireq); | 127 | "%s: request = %p\n", __func__, ireq); |
@@ -201,8 +197,7 @@ static enum sci_status isci_io_request_build( | |||
201 | */ | 197 | */ |
202 | status = scic_io_request_construct(&isci_host->sci, sci_device, | 198 | status = scic_io_request_construct(&isci_host->sci, sci_device, |
203 | SCI_CONTROLLER_INVALID_IO_TAG, | 199 | SCI_CONTROLLER_INVALID_IO_TAG, |
204 | request, request->sci_req, | 200 | &request->sci); |
205 | &request->sci_request_handle); | ||
206 | 201 | ||
207 | if (status != SCI_SUCCESS) { | 202 | if (status != SCI_SUCCESS) { |
208 | dev_warn(&isci_host->pdev->dev, | 203 | dev_warn(&isci_host->pdev->dev, |
@@ -211,8 +206,6 @@ static enum sci_status isci_io_request_build( | |||
211 | return SCI_FAILURE; | 206 | return SCI_FAILURE; |
212 | } | 207 | } |
213 | 208 | ||
214 | request->sci_request_handle->ireq = request; | ||
215 | |||
216 | switch (task->task_proto) { | 209 | switch (task->task_proto) { |
217 | case SAS_PROTOCOL_SMP: | 210 | case SAS_PROTOCOL_SMP: |
218 | status = isci_smp_request_build(request); | 211 | status = isci_smp_request_build(request); |
@@ -276,8 +269,8 @@ static int isci_request_alloc_core( | |||
276 | request->isci_host = isci_host; | 269 | request->isci_host = isci_host; |
277 | request->isci_device = isci_device; | 270 | request->isci_device = isci_device; |
278 | request->io_request_completion = NULL; | 271 | request->io_request_completion = NULL; |
272 | request->terminated = false; | ||
279 | 273 | ||
280 | request->request_alloc_size = isci_host->dma_pool_alloc_size; | ||
281 | request->num_sg_entries = 0; | 274 | request->num_sg_entries = 0; |
282 | 275 | ||
283 | request->complete_in_target = false; | 276 | request->complete_in_target = false; |
@@ -381,80 +374,74 @@ int isci_request_execute( | |||
381 | goto out; | 374 | goto out; |
382 | 375 | ||
383 | status = isci_io_request_build(isci_host, request, isci_device); | 376 | status = isci_io_request_build(isci_host, request, isci_device); |
384 | if (status == SCI_SUCCESS) { | 377 | if (status != SCI_SUCCESS) { |
385 | 378 | dev_warn(&isci_host->pdev->dev, | |
386 | spin_lock_irqsave(&isci_host->scic_lock, flags); | 379 | "%s: request_construct failed - status = 0x%x\n", |
387 | 380 | __func__, | |
388 | /* send the request, let the core assign the IO TAG. */ | 381 | status); |
389 | status = scic_controller_start_io( | 382 | goto out; |
390 | &isci_host->sci, | 383 | } |
391 | sci_device, | ||
392 | request->sci_request_handle, | ||
393 | SCI_CONTROLLER_INVALID_IO_TAG | ||
394 | ); | ||
395 | |||
396 | if (status == SCI_SUCCESS || | ||
397 | status == SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) { | ||
398 | |||
399 | /* Either I/O started OK, or the core has signaled that | ||
400 | * the device needs a target reset. | ||
401 | * | ||
402 | * In either case, hold onto the I/O for later. | ||
403 | * | ||
404 | * Update it's status and add it to the list in the | ||
405 | * remote device object. | ||
406 | */ | ||
407 | isci_request_change_state(request, started); | ||
408 | list_add(&request->dev_node, | ||
409 | &isci_device->reqs_in_process); | ||
410 | |||
411 | if (status == SCI_SUCCESS) { | ||
412 | /* Save the tag for possible task mgmt later. */ | ||
413 | request->io_tag = scic_io_request_get_io_tag( | ||
414 | request->sci_request_handle); | ||
415 | } else { | ||
416 | /* The request did not really start in the | ||
417 | * hardware, so clear the request handle | ||
418 | * here so no terminations will be done. | ||
419 | */ | ||
420 | request->sci_request_handle = NULL; | ||
421 | } | ||
422 | 384 | ||
423 | } else | 385 | spin_lock_irqsave(&isci_host->scic_lock, flags); |
424 | dev_warn(&isci_host->pdev->dev, | ||
425 | "%s: failed request start (0x%x)\n", | ||
426 | __func__, status); | ||
427 | 386 | ||
387 | /* send the request, let the core assign the IO TAG. */ | ||
388 | status = scic_controller_start_io(&isci_host->sci, sci_device, | ||
389 | &request->sci, | ||
390 | SCI_CONTROLLER_INVALID_IO_TAG); | ||
391 | if (status != SCI_SUCCESS && | ||
392 | status != SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) { | ||
393 | dev_warn(&isci_host->pdev->dev, | ||
394 | "%s: failed request start (0x%x)\n", | ||
395 | __func__, status); | ||
428 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); | 396 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); |
397 | goto out; | ||
398 | } | ||
429 | 399 | ||
430 | if (status == | 400 | /* Either I/O started OK, or the core has signaled that |
431 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) { | 401 | * the device needs a target reset. |
432 | /* Signal libsas that we need the SCSI error | 402 | * |
433 | * handler thread to work on this I/O and that | 403 | * In either case, hold onto the I/O for later. |
434 | * we want a device reset. | 404 | * |
435 | */ | 405 | * Update it's status and add it to the list in the |
436 | spin_lock_irqsave(&task->task_state_lock, flags); | 406 | * remote device object. |
437 | task->task_state_flags |= SAS_TASK_NEED_DEV_RESET; | 407 | */ |
438 | spin_unlock_irqrestore(&task->task_state_lock, flags); | 408 | isci_request_change_state(request, started); |
439 | 409 | list_add(&request->dev_node, &isci_device->reqs_in_process); | |
440 | /* Cause this task to be scheduled in the SCSI error | ||
441 | * handler thread. | ||
442 | */ | ||
443 | isci_execpath_callback(isci_host, task, | ||
444 | sas_task_abort); | ||
445 | |||
446 | /* Change the status, since we are holding | ||
447 | * the I/O until it is managed by the SCSI | ||
448 | * error handler. | ||
449 | */ | ||
450 | status = SCI_SUCCESS; | ||
451 | } | ||
452 | 410 | ||
453 | } else | 411 | if (status == SCI_SUCCESS) { |
454 | dev_warn(&isci_host->pdev->dev, | 412 | /* Save the tag for possible task mgmt later. */ |
455 | "%s: request_construct failed - status = 0x%x\n", | 413 | request->io_tag = scic_io_request_get_io_tag(&request->sci); |
456 | __func__, | 414 | } else { |
457 | status); | 415 | /* The request did not really start in the |
416 | * hardware, so clear the request handle | ||
417 | * here so no terminations will be done. | ||
418 | */ | ||
419 | request->terminated = true; | ||
420 | } | ||
421 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); | ||
422 | |||
423 | if (status == | ||
424 | SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED) { | ||
425 | /* Signal libsas that we need the SCSI error | ||
426 | * handler thread to work on this I/O and that | ||
427 | * we want a device reset. | ||
428 | */ | ||
429 | spin_lock_irqsave(&task->task_state_lock, flags); | ||
430 | task->task_state_flags |= SAS_TASK_NEED_DEV_RESET; | ||
431 | spin_unlock_irqrestore(&task->task_state_lock, flags); | ||
432 | |||
433 | /* Cause this task to be scheduled in the SCSI error | ||
434 | * handler thread. | ||
435 | */ | ||
436 | isci_execpath_callback(isci_host, task, | ||
437 | sas_task_abort); | ||
438 | |||
439 | /* Change the status, since we are holding | ||
440 | * the I/O until it is managed by the SCSI | ||
441 | * error handler. | ||
442 | */ | ||
443 | status = SCI_SUCCESS; | ||
444 | } | ||
458 | 445 | ||
459 | out: | 446 | out: |
460 | if (status != SCI_SUCCESS) { | 447 | if (status != SCI_SUCCESS) { |
@@ -554,9 +541,7 @@ static void isci_request_handle_controller_specific_errors( | |||
554 | { | 541 | { |
555 | unsigned int cstatus; | 542 | unsigned int cstatus; |
556 | 543 | ||
557 | cstatus = scic_request_get_controller_status( | 544 | cstatus = scic_request_get_controller_status(&request->sci); |
558 | request->sci_request_handle | ||
559 | ); | ||
560 | 545 | ||
561 | dev_dbg(&request->isci_host->pdev->dev, | 546 | dev_dbg(&request->isci_host->pdev->dev, |
562 | "%s: %p SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR " | 547 | "%s: %p SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR " |
@@ -997,13 +982,13 @@ void isci_request_io_request_complete( | |||
997 | task); | 982 | task); |
998 | 983 | ||
999 | if (sas_protocol_ata(task->task_proto)) { | 984 | if (sas_protocol_ata(task->task_proto)) { |
1000 | resp_buf = &request->sci_request_handle->stp.rsp; | 985 | resp_buf = &request->sci.stp.rsp; |
1001 | isci_request_process_stp_response(task, | 986 | isci_request_process_stp_response(task, |
1002 | resp_buf); | 987 | resp_buf); |
1003 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { | 988 | } else if (SAS_PROTOCOL_SSP == task->task_proto) { |
1004 | 989 | ||
1005 | /* crack the iu response buffer. */ | 990 | /* crack the iu response buffer. */ |
1006 | resp_iu = &request->sci_request_handle->ssp.rsp; | 991 | resp_iu = &request->sci.ssp.rsp; |
1007 | isci_request_process_response_iu(task, resp_iu, | 992 | isci_request_process_response_iu(task, resp_iu, |
1008 | &isci_host->pdev->dev); | 993 | &isci_host->pdev->dev); |
1009 | 994 | ||
@@ -1034,7 +1019,7 @@ void isci_request_io_request_complete( | |||
1034 | request->complete_in_target = true; | 1019 | request->complete_in_target = true; |
1035 | 1020 | ||
1036 | if (task->task_proto == SAS_PROTOCOL_SMP) { | 1021 | if (task->task_proto == SAS_PROTOCOL_SMP) { |
1037 | void *rsp = &request->sci_request_handle->smp.rsp; | 1022 | void *rsp = &request->sci.smp.rsp; |
1038 | 1023 | ||
1039 | dev_dbg(&isci_host->pdev->dev, | 1024 | dev_dbg(&isci_host->pdev->dev, |
1040 | "%s: SMP protocol completion\n", | 1025 | "%s: SMP protocol completion\n", |
@@ -1051,8 +1036,7 @@ void isci_request_io_request_complete( | |||
1051 | * the maximum was transferred. | 1036 | * the maximum was transferred. |
1052 | */ | 1037 | */ |
1053 | u32 transferred_length | 1038 | u32 transferred_length |
1054 | = scic_io_request_get_number_of_bytes_transferred( | 1039 | = scic_io_request_get_number_of_bytes_transferred(&request->sci); |
1055 | request->sci_request_handle); | ||
1056 | 1040 | ||
1057 | task->task_status.residual | 1041 | task->task_status.residual |
1058 | = task->total_xfer_len - transferred_length; | 1042 | = task->total_xfer_len - transferred_length; |
@@ -1165,12 +1149,12 @@ void isci_request_io_request_complete( | |||
1165 | /* complete the io request to the core. */ | 1149 | /* complete the io request to the core. */ |
1166 | scic_controller_complete_io(&isci_host->sci, | 1150 | scic_controller_complete_io(&isci_host->sci, |
1167 | &isci_device->sci, | 1151 | &isci_device->sci, |
1168 | request->sci_request_handle); | 1152 | &request->sci); |
1169 | /* NULL the request handle so it cannot be completed or | 1153 | /* set terminated handle so it cannot be completed or |
1170 | * terminated again, and to cause any calls into abort | 1154 | * terminated again, and to cause any calls into abort |
1171 | * task to recognize the already completed case. | 1155 | * task to recognize the already completed case. |
1172 | */ | 1156 | */ |
1173 | request->sci_request_handle = NULL; | 1157 | request->terminated = true; |
1174 | 1158 | ||
1175 | isci_host_can_dequeue(isci_host, 1); | 1159 | isci_host_can_dequeue(isci_host, 1); |
1176 | } | 1160 | } |
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h index ddfbf71c97e5..89d8b0a27dfe 100644 --- a/drivers/scsi/isci/request.h +++ b/drivers/scsi/isci/request.h | |||
@@ -82,11 +82,11 @@ enum task_type { | |||
82 | }; | 82 | }; |
83 | 83 | ||
84 | struct isci_request { | 84 | struct isci_request { |
85 | struct scic_sds_request *sci_request_handle; | ||
86 | enum isci_request_status status; | 85 | enum isci_request_status status; |
87 | enum task_type ttype; | 86 | enum task_type ttype; |
88 | unsigned short io_tag; | 87 | unsigned short io_tag; |
89 | bool complete_in_target; | 88 | bool complete_in_target; |
89 | bool terminated; | ||
90 | 90 | ||
91 | union ttype_ptr_union { | 91 | union ttype_ptr_union { |
92 | struct sas_task *io_task_ptr; /* When ttype==io_task */ | 92 | struct sas_task *io_task_ptr; /* When ttype==io_task */ |
@@ -103,7 +103,6 @@ struct isci_request { | |||
103 | dma_addr_t zero_scatter_daddr; | 103 | dma_addr_t zero_scatter_daddr; |
104 | 104 | ||
105 | unsigned int num_sg_entries; /* returned by pci_alloc_sg */ | 105 | unsigned int num_sg_entries; /* returned by pci_alloc_sg */ |
106 | unsigned int request_alloc_size; /* size of block from dma_pool_alloc */ | ||
107 | 106 | ||
108 | /** Note: "io_request_completion" is completed in two different ways | 107 | /** Note: "io_request_completion" is completed in two different ways |
109 | * depending on whether this is a TMF or regular request. | 108 | * depending on whether this is a TMF or regular request. |
@@ -115,9 +114,16 @@ struct isci_request { | |||
115 | * TMF was aborting is guaranteed to have completed. | 114 | * TMF was aborting is guaranteed to have completed. |
116 | */ | 115 | */ |
117 | struct completion *io_request_completion; | 116 | struct completion *io_request_completion; |
118 | struct scic_sds_request sci_req[0] ____cacheline_aligned; | 117 | struct scic_sds_request sci; |
119 | }; | 118 | }; |
120 | 119 | ||
120 | static inline struct isci_request *sci_req_to_ireq(struct scic_sds_request *sci_req) | ||
121 | { | ||
122 | struct isci_request *ireq = container_of(sci_req, typeof(*ireq), sci); | ||
123 | |||
124 | return ireq; | ||
125 | } | ||
126 | |||
121 | /** | 127 | /** |
122 | * This function gets the status of the request object. | 128 | * This function gets the status of the request object. |
123 | * @request: This parameter points to the isci_request object | 129 | * @request: This parameter points to the isci_request object |
diff --git a/drivers/scsi/isci/sata.c b/drivers/scsi/isci/sata.c index 578b1c5d40a9..08dabf08f7d7 100644 --- a/drivers/scsi/isci/sata.c +++ b/drivers/scsi/isci/sata.c | |||
@@ -72,7 +72,7 @@ | |||
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 *ireq = task->lldd_task; | 74 | struct isci_request *ireq = task->lldd_task; |
75 | struct host_to_dev_fis *fis = &ireq->sci_request_handle->stp.cmd; | 75 | struct host_to_dev_fis *fis = &ireq->sci.stp.cmd; |
76 | 76 | ||
77 | memcpy(fis, &task->ata_task.fis, sizeof(struct host_to_dev_fis)); | 77 | memcpy(fis, &task->ata_task.fis, sizeof(struct host_to_dev_fis)); |
78 | 78 | ||
@@ -118,7 +118,7 @@ void isci_sata_set_ncq_tag( | |||
118 | struct isci_request *request = task->lldd_task; | 118 | struct isci_request *request = task->lldd_task; |
119 | 119 | ||
120 | register_fis->sector_count = qc->tag << 3; | 120 | register_fis->sector_count = qc->tag << 3; |
121 | scic_stp_io_request_set_ncq_tag(request->sci_request_handle, qc->tag); | 121 | scic_stp_io_request_set_ncq_tag(&request->sci, qc->tag); |
122 | } | 122 | } |
123 | 123 | ||
124 | /** | 124 | /** |
@@ -156,7 +156,7 @@ void isci_request_process_stp_response(struct sas_task *task, | |||
156 | 156 | ||
157 | enum sci_status isci_sata_management_task_request_build(struct isci_request *ireq) | 157 | enum sci_status isci_sata_management_task_request_build(struct isci_request *ireq) |
158 | { | 158 | { |
159 | struct scic_sds_request *sci_req = ireq->sci_request_handle; | 159 | struct scic_sds_request *sci_req = &ireq->sci; |
160 | struct isci_tmf *isci_tmf; | 160 | struct isci_tmf *isci_tmf; |
161 | enum sci_status status; | 161 | enum sci_status status; |
162 | 162 | ||
@@ -190,9 +190,7 @@ enum sci_status isci_sata_management_task_request_build(struct isci_request *ire | |||
190 | /* core builds the protocol specific request | 190 | /* core builds the protocol specific request |
191 | * based on the h2d fis. | 191 | * based on the h2d fis. |
192 | */ | 192 | */ |
193 | status = scic_task_request_construct_sata( | 193 | status = scic_task_request_construct_sata(&ireq->sci); |
194 | ireq->sci_request_handle | ||
195 | ); | ||
196 | 194 | ||
197 | return status; | 195 | return status; |
198 | } | 196 | } |
diff --git a/drivers/scsi/isci/task.c b/drivers/scsi/isci/task.c index 492faeea8b3a..7adaf71c19d1 100644 --- a/drivers/scsi/isci/task.c +++ b/drivers/scsi/isci/task.c | |||
@@ -300,8 +300,7 @@ static enum sci_status isci_task_request_build( | |||
300 | /* let the core do it's construct. */ | 300 | /* let the core do it's construct. */ |
301 | status = scic_task_request_construct(&isci_host->sci, sci_device, | 301 | status = scic_task_request_construct(&isci_host->sci, sci_device, |
302 | SCI_CONTROLLER_INVALID_IO_TAG, | 302 | SCI_CONTROLLER_INVALID_IO_TAG, |
303 | request, &request->sci_req, | 303 | &request->sci); |
304 | &request->sci_request_handle); | ||
305 | 304 | ||
306 | if (status != SCI_SUCCESS) { | 305 | if (status != SCI_SUCCESS) { |
307 | dev_warn(&isci_host->pdev->dev, | 306 | dev_warn(&isci_host->pdev->dev, |
@@ -312,14 +311,10 @@ static enum sci_status isci_task_request_build( | |||
312 | goto errout; | 311 | goto errout; |
313 | } | 312 | } |
314 | 313 | ||
315 | request->sci_request_handle->ireq = request; | ||
316 | |||
317 | /* XXX convert to get this from task->tproto like other drivers */ | 314 | /* XXX convert to get this from task->tproto like other drivers */ |
318 | if (dev->dev_type == SAS_END_DEV) { | 315 | if (dev->dev_type == SAS_END_DEV) { |
319 | isci_tmf->proto = SAS_PROTOCOL_SSP; | 316 | isci_tmf->proto = SAS_PROTOCOL_SSP; |
320 | status = scic_task_request_construct_ssp( | 317 | status = scic_task_request_construct_ssp(&request->sci); |
321 | request->sci_request_handle | ||
322 | ); | ||
323 | if (status != SCI_SUCCESS) | 318 | if (status != SCI_SUCCESS) |
324 | goto errout; | 319 | goto errout; |
325 | } | 320 | } |
@@ -376,8 +371,7 @@ static void isci_tmf_timeout_cb(void *tmf_request_arg) | |||
376 | status = scic_controller_terminate_request( | 371 | status = scic_controller_terminate_request( |
377 | &request->isci_host->sci, | 372 | &request->isci_host->sci, |
378 | &request->isci_device->sci, | 373 | &request->isci_device->sci, |
379 | request->sci_request_handle | 374 | &request->sci); |
380 | ); | ||
381 | 375 | ||
382 | dev_dbg(&request->isci_host->pdev->dev, | 376 | dev_dbg(&request->isci_host->pdev->dev, |
383 | "%s: tmf_request = %p; tmf = %p; status = %d\n", | 377 | "%s: tmf_request = %p; tmf = %p; status = %d\n", |
@@ -467,9 +461,8 @@ int isci_task_execute_tmf( | |||
467 | status = scic_controller_start_task( | 461 | status = scic_controller_start_task( |
468 | &isci_host->sci, | 462 | &isci_host->sci, |
469 | sci_device, | 463 | sci_device, |
470 | request->sci_request_handle, | 464 | &request->sci, |
471 | SCI_CONTROLLER_INVALID_IO_TAG | 465 | SCI_CONTROLLER_INVALID_IO_TAG); |
472 | ); | ||
473 | 466 | ||
474 | if (status != SCI_TASK_SUCCESS) { | 467 | if (status != SCI_TASK_SUCCESS) { |
475 | dev_warn(&isci_host->pdev->dev, | 468 | dev_warn(&isci_host->pdev->dev, |
@@ -764,13 +757,13 @@ static void isci_terminate_request_core( | |||
764 | * device condition (if the request handle is NULL, then the | 757 | * device condition (if the request handle is NULL, then the |
765 | * request completed but needed additional handling here). | 758 | * request completed but needed additional handling here). |
766 | */ | 759 | */ |
767 | if (isci_request->sci_request_handle != NULL) { | 760 | if (!isci_request->terminated) { |
768 | was_terminated = true; | 761 | was_terminated = true; |
769 | needs_cleanup_handling = true; | 762 | needs_cleanup_handling = true; |
770 | status = scic_controller_terminate_request( | 763 | status = scic_controller_terminate_request( |
771 | &isci_host->sci, | 764 | &isci_host->sci, |
772 | &isci_device->sci, | 765 | &isci_device->sci, |
773 | isci_request->sci_request_handle); | 766 | &isci_request->sci); |
774 | } | 767 | } |
775 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); | 768 | spin_unlock_irqrestore(&isci_host->scic_lock, flags); |
776 | 769 | ||
@@ -1430,7 +1423,7 @@ isci_task_request_complete(struct isci_host *ihost, | |||
1430 | enum isci_request_status old_state; | 1423 | enum isci_request_status old_state; |
1431 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); | 1424 | struct isci_tmf *tmf = isci_request_access_tmf(ireq); |
1432 | struct completion *tmf_complete; | 1425 | struct completion *tmf_complete; |
1433 | struct scic_sds_request *sci_req = ireq->sci_request_handle; | 1426 | struct scic_sds_request *sci_req = &ireq->sci; |
1434 | 1427 | ||
1435 | dev_dbg(&ihost->pdev->dev, | 1428 | dev_dbg(&ihost->pdev->dev, |
1436 | "%s: request = %p, status=%d\n", | 1429 | "%s: request = %p, status=%d\n", |
@@ -1460,12 +1453,11 @@ isci_task_request_complete(struct isci_host *ihost, | |||
1460 | /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ | 1453 | /* PRINT_TMF( ((struct isci_tmf *)request->task)); */ |
1461 | tmf_complete = tmf->complete; | 1454 | tmf_complete = tmf->complete; |
1462 | 1455 | ||
1463 | scic_controller_complete_io(&ihost->sci, &idev->sci, | 1456 | scic_controller_complete_io(&ihost->sci, &idev->sci, &ireq->sci); |
1464 | ireq->sci_request_handle); | 1457 | /* set the 'terminated' flag handle to make sure it cannot be terminated |
1465 | /* NULL the request handle to make sure it cannot be terminated | ||
1466 | * or completed again. | 1458 | * or completed again. |
1467 | */ | 1459 | */ |
1468 | ireq->sci_request_handle = NULL; | 1460 | ireq->terminated = true;; |
1469 | 1461 | ||
1470 | isci_request_change_state(ireq, unallocated); | 1462 | isci_request_change_state(ireq, unallocated); |
1471 | list_del_init(&ireq->dev_node); | 1463 | list_del_init(&ireq->dev_node); |