diff options
Diffstat (limited to 'drivers/scsi/isci/request.h')
-rw-r--r-- | drivers/scsi/isci/request.h | 357 |
1 files changed, 173 insertions, 184 deletions
diff --git a/drivers/scsi/isci/request.h b/drivers/scsi/isci/request.h index 31d6d5717473..757cd99ae2ed 100644 --- a/drivers/scsi/isci/request.h +++ b/drivers/scsi/isci/request.h | |||
@@ -96,37 +96,42 @@ struct scic_sds_stp_request { | |||
96 | u32 udma; | 96 | u32 udma; |
97 | 97 | ||
98 | struct scic_sds_stp_pio_request { | 98 | struct scic_sds_stp_pio_request { |
99 | /** | 99 | /* |
100 | * Total transfer for the entire PIO request recorded at request constuction | 100 | * Total transfer for the entire PIO request recorded |
101 | * time. | 101 | * at request constuction time. |
102 | * | 102 | * |
103 | * @todo Should we just decrement this value for each byte of data transitted | 103 | * @todo Should we just decrement this value for each |
104 | * or received to elemenate the current_transfer_bytes field? | 104 | * byte of data transitted or received to elemenate |
105 | * the current_transfer_bytes field? | ||
105 | */ | 106 | */ |
106 | u32 total_transfer_bytes; | 107 | u32 total_transfer_bytes; |
107 | 108 | ||
108 | /** | 109 | /* |
109 | * Total number of bytes received/transmitted in data frames since the start | 110 | * Total number of bytes received/transmitted in data |
110 | * of the IO request. At the end of the IO request this should equal the | 111 | * frames since the start of the IO request. At the |
112 | * end of the IO request this should equal the | ||
111 | * total_transfer_bytes. | 113 | * total_transfer_bytes. |
112 | */ | 114 | */ |
113 | u32 current_transfer_bytes; | 115 | u32 current_transfer_bytes; |
114 | 116 | ||
115 | /** | 117 | /* |
116 | * The number of bytes requested in the in the PIO setup. | 118 | * The number of bytes requested in the in the PIO |
119 | * setup. | ||
117 | */ | 120 | */ |
118 | u32 pio_transfer_bytes; | 121 | u32 pio_transfer_bytes; |
119 | 122 | ||
120 | /** | 123 | /* |
121 | * PIO Setup ending status value to tell us if we need to wait for another FIS | 124 | * PIO Setup ending status value to tell us if we need |
122 | * or if the transfer is complete. On the receipt of a D2H FIS this will be | 125 | * to wait for another FIS or if the transfer is |
126 | * complete. On the receipt of a D2H FIS this will be | ||
123 | * the status field of that FIS. | 127 | * the status field of that FIS. |
124 | */ | 128 | */ |
125 | u8 ending_status; | 129 | u8 ending_status; |
126 | 130 | ||
127 | /** | 131 | /* |
128 | * On receipt of a D2H FIS this will be the ending error field if the | 132 | * On receipt of a D2H FIS this will be the ending |
129 | * ending_status has the SATA_STATUS_ERR bit set. | 133 | * error field if the ending_status has the |
134 | * SATA_STATUS_ERR bit set. | ||
130 | */ | 135 | */ |
131 | u8 ending_error; | 136 | u8 ending_error; |
132 | 137 | ||
@@ -138,8 +143,9 @@ struct scic_sds_stp_request { | |||
138 | } pio; | 143 | } pio; |
139 | 144 | ||
140 | struct { | 145 | struct { |
141 | /** | 146 | /* |
142 | * The number of bytes requested in the PIO setup before CDB data frame. | 147 | * The number of bytes requested in the PIO setup |
148 | * before CDB data frame. | ||
143 | */ | 149 | */ |
144 | u32 device_preferred_cdb_length; | 150 | u32 device_preferred_cdb_length; |
145 | } packet; | 151 | } packet; |
@@ -147,57 +153,59 @@ struct scic_sds_stp_request { | |||
147 | }; | 153 | }; |
148 | 154 | ||
149 | struct scic_sds_request { | 155 | struct scic_sds_request { |
150 | /** | 156 | /* |
151 | * This field contains the information for the base request state machine. | 157 | * This field contains the information for the base request state |
158 | * machine. | ||
152 | */ | 159 | */ |
153 | struct sci_base_state_machine state_machine; | 160 | struct sci_base_state_machine sm; |
154 | 161 | ||
155 | /** | 162 | /* |
156 | * This field simply points to the controller to which this IO request | 163 | * This field simply points to the controller to which this IO request |
157 | * is associated. | 164 | * is associated. |
158 | */ | 165 | */ |
159 | struct scic_sds_controller *owning_controller; | 166 | struct scic_sds_controller *owning_controller; |
160 | 167 | ||
161 | /** | 168 | /* |
162 | * This field simply points to the remote device to which this IO request | 169 | * This field simply points to the remote device to which this IO |
163 | * is associated. | 170 | * request is associated. |
164 | */ | 171 | */ |
165 | struct scic_sds_remote_device *target_device; | 172 | struct scic_sds_remote_device *target_device; |
166 | 173 | ||
167 | /** | 174 | /* |
168 | * This field is utilized to determine if the SCI user is managing | 175 | * This field is utilized to determine if the SCI user is managing |
169 | * the IO tag for this request or if the core is managing it. | 176 | * the IO tag for this request or if the core is managing it. |
170 | */ | 177 | */ |
171 | bool was_tag_assigned_by_user; | 178 | bool was_tag_assigned_by_user; |
172 | 179 | ||
173 | /** | 180 | /* |
174 | * This field indicates the IO tag for this request. The IO tag is | 181 | * This field indicates the IO tag for this request. The IO tag is |
175 | * comprised of the task_index and a sequence count. The sequence count | 182 | * comprised of the task_index and a sequence count. The sequence count |
176 | * is utilized to help identify tasks from one life to another. | 183 | * is utilized to help identify tasks from one life to another. |
177 | */ | 184 | */ |
178 | u16 io_tag; | 185 | u16 io_tag; |
179 | 186 | ||
180 | /** | 187 | /* |
181 | * This field specifies the protocol being utilized for this | 188 | * This field specifies the protocol being utilized for this |
182 | * IO request. | 189 | * IO request. |
183 | */ | 190 | */ |
184 | enum sci_request_protocol protocol; | 191 | enum sci_request_protocol protocol; |
185 | 192 | ||
186 | /** | 193 | /* |
187 | * This field indicates the completion status taken from the SCUs | 194 | * This field indicates the completion status taken from the SCUs |
188 | * completion code. It indicates the completion result for the SCU hardware. | 195 | * completion code. It indicates the completion result for the SCU |
196 | * hardware. | ||
189 | */ | 197 | */ |
190 | u32 scu_status; | 198 | u32 scu_status; |
191 | 199 | ||
192 | /** | 200 | /* |
193 | * This field indicates the completion status returned to the SCI user. It | 201 | * This field indicates the completion status returned to the SCI user. |
194 | * indicates the users view of the io request completion. | 202 | * It indicates the users view of the io request completion. |
195 | */ | 203 | */ |
196 | u32 sci_status; | 204 | u32 sci_status; |
197 | 205 | ||
198 | /** | 206 | /* |
199 | * This field contains the value to be utilized when posting (e.g. Post_TC, | 207 | * This field contains the value to be utilized when posting |
200 | * Post_TC_Abort) this request to the silicon. | 208 | * (e.g. Post_TC, * Post_TC_Abort) this request to the silicon. |
201 | */ | 209 | */ |
202 | u32 post_context; | 210 | u32 post_context; |
203 | 211 | ||
@@ -208,26 +216,26 @@ struct scic_sds_request { | |||
208 | #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) | 216 | #define SCU_SGL_SIZE ((SCU_IO_REQUEST_SGE_COUNT + 1) / 2) |
209 | struct scu_sgl_element_pair sg_table[SCU_SGL_SIZE] __attribute__ ((aligned(32))); | 217 | struct scu_sgl_element_pair sg_table[SCU_SGL_SIZE] __attribute__ ((aligned(32))); |
210 | 218 | ||
211 | /** | 219 | /* |
212 | * This field indicates if this request is a task management request or | 220 | * This field indicates if this request is a task management request or |
213 | * normal IO request. | 221 | * normal IO request. |
214 | */ | 222 | */ |
215 | bool is_task_management_request; | 223 | bool is_task_management_request; |
216 | 224 | ||
217 | /** | 225 | /* |
218 | * This field is a pointer to the stored rx frame data. It is used in STP | 226 | * This field is a pointer to the stored rx frame data. It is used in |
219 | * internal requests and SMP response frames. If this field is non-NULL the | 227 | * STP internal requests and SMP response frames. If this field is |
220 | * saved frame must be released on IO request completion. | 228 | * non-NULL the saved frame must be released on IO request completion. |
221 | * | 229 | * |
222 | * @todo In the future do we want to keep a list of RX frame buffers? | 230 | * @todo In the future do we want to keep a list of RX frame buffers? |
223 | */ | 231 | */ |
224 | u32 saved_rx_frame_index; | 232 | u32 saved_rx_frame_index; |
225 | 233 | ||
226 | /** | 234 | /* |
227 | * This field in the recorded device sequence for the io request. This is | 235 | * This field in the recorded device sequence for the io request. |
228 | * recorded during the build operation and is compared in the start | 236 | * This is recorded during the build operation and is compared in the |
229 | * operation. If the sequence is different then there was a change of | 237 | * start operation. If the sequence is different then there was a |
230 | * devices from the build to start operations. | 238 | * change of devices from the build to start operations. |
231 | */ | 239 | */ |
232 | u8 device_sequence; | 240 | u8 device_sequence; |
233 | 241 | ||
@@ -286,7 +294,7 @@ struct isci_request { | |||
286 | dma_addr_t request_daddr; | 294 | dma_addr_t request_daddr; |
287 | dma_addr_t zero_scatter_daddr; | 295 | dma_addr_t zero_scatter_daddr; |
288 | 296 | ||
289 | unsigned int num_sg_entries; /* returned by pci_alloc_sg */ | 297 | unsigned int num_sg_entries; /* returned by pci_alloc_sg */ |
290 | 298 | ||
291 | /** Note: "io_request_completion" is completed in two different ways | 299 | /** Note: "io_request_completion" is completed in two different ways |
292 | * depending on whether this is a TMF or regular request. | 300 | * depending on whether this is a TMF or regular request. |
@@ -315,104 +323,105 @@ static inline struct isci_request *sci_req_to_ireq(struct scic_sds_request *sci_ | |||
315 | * | 323 | * |
316 | */ | 324 | */ |
317 | enum sci_base_request_states { | 325 | enum sci_base_request_states { |
318 | /** | 326 | /* |
319 | * Simply the initial state for the base request state machine. | 327 | * Simply the initial state for the base request state machine. |
320 | */ | 328 | */ |
321 | SCI_BASE_REQUEST_STATE_INITIAL, | 329 | SCI_REQ_INIT, |
322 | 330 | ||
323 | /** | 331 | /* |
324 | * This state indicates that the request has been constructed. This state | 332 | * This state indicates that the request has been constructed. |
325 | * is entered from the INITIAL state. | 333 | * This state is entered from the INITIAL state. |
326 | */ | 334 | */ |
327 | SCI_BASE_REQUEST_STATE_CONSTRUCTED, | 335 | SCI_REQ_CONSTRUCTED, |
328 | 336 | ||
329 | /** | 337 | /* |
330 | * This state indicates that the request has been started. This state is | 338 | * This state indicates that the request has been started. This state |
331 | * entered from the CONSTRUCTED state. | 339 | * is entered from the CONSTRUCTED state. |
332 | */ | 340 | */ |
333 | SCI_BASE_REQUEST_STATE_STARTED, | 341 | SCI_REQ_STARTED, |
334 | 342 | ||
335 | SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE, | 343 | SCI_REQ_STP_UDMA_WAIT_TC_COMP, |
336 | SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE, | 344 | SCI_REQ_STP_UDMA_WAIT_D2H, |
337 | 345 | ||
338 | SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE, | 346 | SCI_REQ_STP_NON_DATA_WAIT_H2D, |
339 | SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE, | 347 | SCI_REQ_STP_NON_DATA_WAIT_D2H, |
340 | 348 | ||
341 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE, | 349 | SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED, |
342 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE, | 350 | SCI_REQ_STP_SOFT_RESET_WAIT_H2D_DIAG, |
343 | SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE, | 351 | SCI_REQ_STP_SOFT_RESET_WAIT_D2H, |
344 | 352 | ||
345 | /** | 353 | /* |
346 | * While in this state the IO request object is waiting for the TC completion | 354 | * While in this state the IO request object is waiting for the TC |
347 | * notification for the H2D Register FIS | 355 | * completion notification for the H2D Register FIS |
348 | */ | 356 | */ |
349 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE, | 357 | SCI_REQ_STP_PIO_WAIT_H2D, |
350 | 358 | ||
351 | /** | 359 | /* |
352 | * While in this state the IO request object is waiting for either a PIO Setup | 360 | * While in this state the IO request object is waiting for either a |
353 | * FIS or a D2H register FIS. The type of frame received is based on the | 361 | * PIO Setup FIS or a D2H register FIS. The type of frame received is |
354 | * result of the prior frame and line conditions. | 362 | * based on the result of the prior frame and line conditions. |
355 | */ | 363 | */ |
356 | SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE, | 364 | SCI_REQ_STP_PIO_WAIT_FRAME, |
357 | 365 | ||
358 | /** | 366 | /* |
359 | * While in this state the IO request object is waiting for a DATA frame from | 367 | * While in this state the IO request object is waiting for a DATA |
360 | * the device. | 368 | * frame from the device. |
361 | */ | 369 | */ |
362 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE, | 370 | SCI_REQ_STP_PIO_DATA_IN, |
363 | 371 | ||
364 | /** | 372 | /* |
365 | * While in this state the IO request object is waiting to transmit the next data | 373 | * While in this state the IO request object is waiting to transmit |
366 | * frame to the device. | 374 | * the next data frame to the device. |
367 | */ | 375 | */ |
368 | SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE, | 376 | SCI_REQ_STP_PIO_DATA_OUT, |
369 | 377 | ||
370 | /** | 378 | /* |
371 | * The AWAIT_TC_COMPLETION sub-state indicates that the started raw | 379 | * The AWAIT_TC_COMPLETION sub-state indicates that the started raw |
372 | * task management request is waiting for the transmission of the | 380 | * task management request is waiting for the transmission of the |
373 | * initial frame (i.e. command, task, etc.). | 381 | * initial frame (i.e. command, task, etc.). |
374 | */ | 382 | */ |
375 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION, | 383 | SCI_REQ_TASK_WAIT_TC_COMP, |
376 | 384 | ||
377 | /** | 385 | /* |
378 | * This sub-state indicates that the started task management request | 386 | * This sub-state indicates that the started task management request |
379 | * is waiting for the reception of an unsolicited frame | 387 | * is waiting for the reception of an unsolicited frame |
380 | * (i.e. response IU). | 388 | * (i.e. response IU). |
381 | */ | 389 | */ |
382 | SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE, | 390 | SCI_REQ_TASK_WAIT_TC_RESP, |
383 | 391 | ||
384 | /** | 392 | /* |
385 | * This sub-state indicates that the started task management request | 393 | * This sub-state indicates that the started task management request |
386 | * is waiting for the reception of an unsolicited frame | 394 | * is waiting for the reception of an unsolicited frame |
387 | * (i.e. response IU). | 395 | * (i.e. response IU). |
388 | */ | 396 | */ |
389 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE, | 397 | SCI_REQ_SMP_WAIT_RESP, |
390 | 398 | ||
391 | /** | 399 | /* |
392 | * The AWAIT_TC_COMPLETION sub-state indicates that the started SMP request is | 400 | * The AWAIT_TC_COMPLETION sub-state indicates that the started SMP |
393 | * waiting for the transmission of the initial frame (i.e. command, task, etc.). | 401 | * request is waiting for the transmission of the initial frame |
402 | * (i.e. command, task, etc.). | ||
394 | */ | 403 | */ |
395 | SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION, | 404 | SCI_REQ_SMP_WAIT_TC_COMP, |
396 | 405 | ||
397 | /** | 406 | /* |
398 | * This state indicates that the request has completed. | 407 | * This state indicates that the request has completed. |
399 | * This state is entered from the STARTED state. This state is entered from | 408 | * This state is entered from the STARTED state. This state is entered |
400 | * the ABORTING state. | 409 | * from the ABORTING state. |
401 | */ | 410 | */ |
402 | SCI_BASE_REQUEST_STATE_COMPLETED, | 411 | SCI_REQ_COMPLETED, |
403 | 412 | ||
404 | /** | 413 | /* |
405 | * This state indicates that the request is in the process of being | 414 | * This state indicates that the request is in the process of being |
406 | * terminated/aborted. | 415 | * terminated/aborted. |
407 | * This state is entered from the CONSTRUCTED state. | 416 | * This state is entered from the CONSTRUCTED state. |
408 | * This state is entered from the STARTED state. | 417 | * This state is entered from the STARTED state. |
409 | */ | 418 | */ |
410 | SCI_BASE_REQUEST_STATE_ABORTING, | 419 | SCI_REQ_ABORTING, |
411 | 420 | ||
412 | /** | 421 | /* |
413 | * Simply the final state for the base request state machine. | 422 | * Simply the final state for the base request state machine. |
414 | */ | 423 | */ |
415 | SCI_BASE_REQUEST_STATE_FINAL, | 424 | SCI_REQ_FINAL, |
416 | }; | 425 | }; |
417 | 426 | ||
418 | /** | 427 | /** |
@@ -498,13 +507,18 @@ enum sci_base_request_states { | |||
498 | 507 | ||
499 | enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req); | 508 | enum sci_status scic_sds_request_start(struct scic_sds_request *sci_req); |
500 | enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req); | 509 | enum sci_status scic_sds_io_request_terminate(struct scic_sds_request *sci_req); |
501 | enum sci_status scic_sds_io_request_event_handler(struct scic_sds_request *sci_req, | 510 | enum sci_status |
502 | u32 event_code); | 511 | scic_sds_io_request_event_handler(struct scic_sds_request *sci_req, |
503 | enum sci_status scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req, | 512 | u32 event_code); |
504 | u32 frame_index); | 513 | enum sci_status |
505 | enum sci_status scic_sds_task_request_terminate(struct scic_sds_request *sci_req); | 514 | scic_sds_io_request_frame_handler(struct scic_sds_request *sci_req, |
506 | extern enum sci_status scic_sds_request_complete(struct scic_sds_request *sci_req); | 515 | u32 frame_index); |
507 | extern enum sci_status scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 code); | 516 | enum sci_status |
517 | scic_sds_task_request_terminate(struct scic_sds_request *sci_req); | ||
518 | extern enum sci_status | ||
519 | scic_sds_request_complete(struct scic_sds_request *sci_req); | ||
520 | extern enum sci_status | ||
521 | scic_sds_io_request_tc_completion(struct scic_sds_request *sci_req, u32 code); | ||
508 | 522 | ||
509 | /* XXX open code in caller */ | 523 | /* XXX open code in caller */ |
510 | static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, | 524 | static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, |
@@ -523,8 +537,8 @@ static inline void *scic_request_get_virt_addr(struct scic_sds_request *sci_req, | |||
523 | } | 537 | } |
524 | 538 | ||
525 | /* XXX open code in caller */ | 539 | /* XXX open code in caller */ |
526 | static inline dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *sci_req, | 540 | static inline dma_addr_t |
527 | void *virt_addr) | 541 | scic_io_request_get_dma_addr(struct scic_sds_request *sci_req, void *virt_addr) |
528 | { | 542 | { |
529 | struct isci_request *ireq = sci_req_to_ireq(sci_req); | 543 | struct isci_request *ireq = sci_req_to_ireq(sci_req); |
530 | 544 | ||
@@ -543,9 +557,8 @@ static inline dma_addr_t scic_io_request_get_dma_addr(struct scic_sds_request *s | |||
543 | * | 557 | * |
544 | * status of the object as a isci_request_status enum. | 558 | * status of the object as a isci_request_status enum. |
545 | */ | 559 | */ |
546 | static inline | 560 | static inline enum isci_request_status |
547 | enum isci_request_status isci_request_get_state( | 561 | isci_request_get_state(struct isci_request *isci_request) |
548 | struct isci_request *isci_request) | ||
549 | { | 562 | { |
550 | BUG_ON(isci_request == NULL); | 563 | BUG_ON(isci_request == NULL); |
551 | 564 | ||
@@ -566,9 +579,9 @@ enum isci_request_status isci_request_get_state( | |||
566 | * @status: This Parameter is the new status of the object | 579 | * @status: This Parameter is the new status of the object |
567 | * | 580 | * |
568 | */ | 581 | */ |
569 | static inline enum isci_request_status isci_request_change_state( | 582 | static inline enum isci_request_status |
570 | struct isci_request *isci_request, | 583 | isci_request_change_state(struct isci_request *isci_request, |
571 | enum isci_request_status status) | 584 | enum isci_request_status status) |
572 | { | 585 | { |
573 | enum isci_request_status old_state; | 586 | enum isci_request_status old_state; |
574 | unsigned long flags; | 587 | unsigned long flags; |
@@ -597,10 +610,10 @@ static inline enum isci_request_status isci_request_change_state( | |||
597 | * | 610 | * |
598 | * state previous to any change. | 611 | * state previous to any change. |
599 | */ | 612 | */ |
600 | static inline enum isci_request_status isci_request_change_started_to_newstate( | 613 | static inline enum isci_request_status |
601 | struct isci_request *isci_request, | 614 | isci_request_change_started_to_newstate(struct isci_request *isci_request, |
602 | struct completion *completion_ptr, | 615 | struct completion *completion_ptr, |
603 | enum isci_request_status newstate) | 616 | enum isci_request_status newstate) |
604 | { | 617 | { |
605 | enum isci_request_status old_state; | 618 | enum isci_request_status old_state; |
606 | unsigned long flags; | 619 | unsigned long flags; |
@@ -615,6 +628,7 @@ static inline enum isci_request_status isci_request_change_started_to_newstate( | |||
615 | isci_request->io_request_completion = completion_ptr; | 628 | isci_request->io_request_completion = completion_ptr; |
616 | isci_request->status = newstate; | 629 | isci_request->status = newstate; |
617 | } | 630 | } |
631 | |||
618 | spin_unlock_irqrestore(&isci_request->state_lock, flags); | 632 | spin_unlock_irqrestore(&isci_request->state_lock, flags); |
619 | 633 | ||
620 | dev_dbg(&isci_request->isci_host->pdev->dev, | 634 | dev_dbg(&isci_request->isci_host->pdev->dev, |
@@ -635,13 +649,13 @@ static inline enum isci_request_status isci_request_change_started_to_newstate( | |||
635 | * | 649 | * |
636 | * state previous to any change. | 650 | * state previous to any change. |
637 | */ | 651 | */ |
638 | static inline enum isci_request_status isci_request_change_started_to_aborted( | 652 | static inline enum isci_request_status |
639 | struct isci_request *isci_request, | 653 | isci_request_change_started_to_aborted(struct isci_request *isci_request, |
640 | struct completion *completion_ptr) | 654 | struct completion *completion_ptr) |
641 | { | 655 | { |
642 | return isci_request_change_started_to_newstate( | 656 | return isci_request_change_started_to_newstate(isci_request, |
643 | isci_request, completion_ptr, aborted | 657 | completion_ptr, |
644 | ); | 658 | aborted); |
645 | } | 659 | } |
646 | /** | 660 | /** |
647 | * isci_request_free() - This function frees the request object. | 661 | * isci_request_free() - This function frees the request object. |
@@ -649,62 +663,33 @@ static inline enum isci_request_status isci_request_change_started_to_aborted( | |||
649 | * @isci_request: This parameter points to the isci_request object | 663 | * @isci_request: This parameter points to the isci_request object |
650 | * | 664 | * |
651 | */ | 665 | */ |
652 | static inline void isci_request_free( | 666 | static inline void isci_request_free(struct isci_host *isci_host, |
653 | struct isci_host *isci_host, | 667 | struct isci_request *isci_request) |
654 | struct isci_request *isci_request) | ||
655 | { | 668 | { |
656 | if (!isci_request) | 669 | if (!isci_request) |
657 | return; | 670 | return; |
658 | 671 | ||
659 | /* release the dma memory if we fail. */ | 672 | /* release the dma memory if we fail. */ |
660 | dma_pool_free(isci_host->dma_pool, isci_request, | 673 | dma_pool_free(isci_host->dma_pool, |
674 | isci_request, | ||
661 | isci_request->request_daddr); | 675 | isci_request->request_daddr); |
662 | } | 676 | } |
663 | 677 | ||
678 | #define isci_request_access_task(req) ((req)->ttype_ptr.io_task_ptr) | ||
664 | 679 | ||
665 | /* #define ISCI_REQUEST_VALIDATE_ACCESS | 680 | #define isci_request_access_tmf(req) ((req)->ttype_ptr.tmf_task_ptr) |
666 | */ | ||
667 | |||
668 | #ifdef ISCI_REQUEST_VALIDATE_ACCESS | ||
669 | |||
670 | static inline | ||
671 | struct sas_task *isci_request_access_task(struct isci_request *isci_request) | ||
672 | { | ||
673 | BUG_ON(isci_request->ttype != io_task); | ||
674 | return isci_request->ttype_ptr.io_task_ptr; | ||
675 | } | ||
676 | |||
677 | static inline | ||
678 | struct isci_tmf *isci_request_access_tmf(struct isci_request *isci_request) | ||
679 | { | ||
680 | BUG_ON(isci_request->ttype != tmf_task); | ||
681 | return isci_request->ttype_ptr.tmf_task_ptr; | ||
682 | } | ||
683 | |||
684 | #else /* not ISCI_REQUEST_VALIDATE_ACCESS */ | ||
685 | |||
686 | #define isci_request_access_task(RequestPtr) \ | ||
687 | ((RequestPtr)->ttype_ptr.io_task_ptr) | ||
688 | |||
689 | #define isci_request_access_tmf(RequestPtr) \ | ||
690 | ((RequestPtr)->ttype_ptr.tmf_task_ptr) | ||
691 | |||
692 | #endif /* not ISCI_REQUEST_VALIDATE_ACCESS */ | ||
693 | |||
694 | 681 | ||
695 | int isci_request_alloc_tmf( | 682 | int isci_request_alloc_tmf(struct isci_host *isci_host, |
696 | struct isci_host *isci_host, | 683 | struct isci_tmf *isci_tmf, |
697 | struct isci_tmf *isci_tmf, | 684 | struct isci_request **isci_request, |
698 | struct isci_request **isci_request, | 685 | struct isci_remote_device *isci_device, |
699 | struct isci_remote_device *isci_device, | 686 | gfp_t gfp_flags); |
700 | gfp_t gfp_flags); | ||
701 | 687 | ||
702 | 688 | ||
703 | int isci_request_execute( | 689 | int isci_request_execute(struct isci_host *isci_host, |
704 | struct isci_host *isci_host, | 690 | struct sas_task *task, |
705 | struct sas_task *task, | 691 | struct isci_request **request, |
706 | struct isci_request **request, | 692 | gfp_t gfp_flags); |
707 | gfp_t gfp_flags); | ||
708 | 693 | ||
709 | /** | 694 | /** |
710 | * isci_request_unmap_sgl() - This function unmaps the DMA address of a given | 695 | * isci_request_unmap_sgl() - This function unmaps the DMA address of a given |
@@ -713,9 +698,8 @@ int isci_request_execute( | |||
713 | * @*pdev: This Parameter is the pci_device struct for the controller | 698 | * @*pdev: This Parameter is the pci_device struct for the controller |
714 | * | 699 | * |
715 | */ | 700 | */ |
716 | static inline void isci_request_unmap_sgl( | 701 | static inline void |
717 | struct isci_request *request, | 702 | isci_request_unmap_sgl(struct isci_request *request, struct pci_dev *pdev) |
718 | struct pci_dev *pdev) | ||
719 | { | 703 | { |
720 | struct sas_task *task = isci_request_access_task(request); | 704 | struct sas_task *task = isci_request_access_task(request); |
721 | 705 | ||
@@ -758,9 +742,9 @@ static inline void isci_request_unmap_sgl( | |||
758 | * | 742 | * |
759 | * pointer to the next sge for specified request. | 743 | * pointer to the next sge for specified request. |
760 | */ | 744 | */ |
761 | static inline void *isci_request_io_request_get_next_sge( | 745 | static inline void * |
762 | struct isci_request *request, | 746 | isci_request_io_request_get_next_sge(struct isci_request *request, |
763 | void *current_sge_address) | 747 | void *current_sge_address) |
764 | { | 748 | { |
765 | struct sas_task *task = isci_request_access_task(request); | 749 | struct sas_task *task = isci_request_access_task(request); |
766 | void *ret = NULL; | 750 | void *ret = NULL; |
@@ -791,15 +775,20 @@ static inline void *isci_request_io_request_get_next_sge( | |||
791 | return ret; | 775 | return ret; |
792 | } | 776 | } |
793 | 777 | ||
794 | void isci_terminate_pending_requests(struct isci_host *isci_host, | 778 | void |
795 | struct isci_remote_device *isci_device, | 779 | isci_terminate_pending_requests(struct isci_host *isci_host, |
796 | enum isci_request_status new_request_state); | 780 | struct isci_remote_device *isci_device, |
797 | enum sci_status scic_task_request_construct(struct scic_sds_controller *scic, | 781 | enum isci_request_status new_request_state); |
798 | struct scic_sds_remote_device *sci_dev, | 782 | enum sci_status |
799 | u16 io_tag, | 783 | scic_task_request_construct(struct scic_sds_controller *scic, |
800 | struct scic_sds_request *sci_req); | 784 | struct scic_sds_remote_device *sci_dev, |
801 | enum sci_status scic_task_request_construct_ssp(struct scic_sds_request *sci_req); | 785 | u16 io_tag, |
802 | enum sci_status scic_task_request_construct_sata(struct scic_sds_request *sci_req); | 786 | struct scic_sds_request *sci_req); |
803 | void scic_stp_io_request_set_ncq_tag(struct scic_sds_request *sci_req, u16 ncq_tag); | 787 | enum sci_status |
788 | scic_task_request_construct_ssp(struct scic_sds_request *sci_req); | ||
789 | enum sci_status | ||
790 | scic_task_request_construct_sata(struct scic_sds_request *sci_req); | ||
791 | void | ||
792 | scic_stp_io_request_set_ncq_tag(struct scic_sds_request *sci_req, u16 ncq_tag); | ||
804 | void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req); | 793 | void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req); |
805 | #endif /* !defined(_ISCI_REQUEST_H_) */ | 794 | #endif /* !defined(_ISCI_REQUEST_H_) */ |