diff options
author | Dan Williams <dan.j.williams@intel.com> | 2011-05-12 11:50:23 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-07-03 07:04:49 -0400 |
commit | ed3efb7784cb0772558e9cc9440bd6c9a3139be4 (patch) | |
tree | c61c9ec150b30b0c4ba85075a481f6c124a56b33 | |
parent | c845ae96bcb1625a093003248ffaf13b92a81ac2 (diff) |
isci: unify rnc suspend/resume handlers
Unify rnc suspend/resume handlers and delete the state handlers.
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
-rw-r--r-- | drivers/scsi/isci/remote_node_context.c | 306 | ||||
-rw-r--r-- | drivers/scsi/isci/remote_node_context.h | 32 |
2 files changed, 104 insertions, 234 deletions
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c index 769a3fc6ec4b..095d61288c3b 100644 --- a/drivers/scsi/isci/remote_node_context.c +++ b/drivers/scsi/isci/remote_node_context.c | |||
@@ -195,60 +195,6 @@ static void scic_sds_remote_node_context_setup_to_destory( | |||
195 | sci_rnc->user_cookie = callback_parameter; | 195 | sci_rnc->user_cookie = callback_parameter; |
196 | } | 196 | } |
197 | 197 | ||
198 | /** | ||
199 | * | ||
200 | * @sci_rnc: | ||
201 | * @callback: | ||
202 | * | ||
203 | * This method will continue to resume a remote node context. This is used in | ||
204 | * the states where a resume is requested while a resume is in progress. | ||
205 | */ | ||
206 | static enum sci_status scic_sds_remote_node_context_continue_to_resume_handler( | ||
207 | struct scic_sds_remote_node_context *sci_rnc, | ||
208 | scics_sds_remote_node_context_callback callback, | ||
209 | void *callback_parameter) | ||
210 | { | ||
211 | if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) { | ||
212 | sci_rnc->user_callback = callback; | ||
213 | sci_rnc->user_cookie = callback_parameter; | ||
214 | |||
215 | return SCI_SUCCESS; | ||
216 | } | ||
217 | |||
218 | return SCI_FAILURE_INVALID_STATE; | ||
219 | } | ||
220 | |||
221 | static enum sci_status scic_sds_remote_node_context_default_suspend_handler( | ||
222 | struct scic_sds_remote_node_context *sci_rnc, | ||
223 | u32 suspend_type, | ||
224 | scics_sds_remote_node_context_callback callback, | ||
225 | void *callback_parameter) | ||
226 | { | ||
227 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | ||
228 | "%s: SCIC Remote Node Context 0x%p requested to suspend " | ||
229 | "while in wrong state %d\n", | ||
230 | __func__, | ||
231 | sci_rnc, | ||
232 | sci_base_state_machine_get_state(&sci_rnc->state_machine)); | ||
233 | |||
234 | return SCI_FAILURE_INVALID_STATE; | ||
235 | } | ||
236 | |||
237 | static enum sci_status scic_sds_remote_node_context_default_resume_handler( | ||
238 | struct scic_sds_remote_node_context *sci_rnc, | ||
239 | scics_sds_remote_node_context_callback callback, | ||
240 | void *callback_parameter) | ||
241 | { | ||
242 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | ||
243 | "%s: SCIC Remote Node Context 0x%p requested to resume " | ||
244 | "while in wrong state %d\n", | ||
245 | __func__, | ||
246 | sci_rnc, | ||
247 | sci_base_state_machine_get_state(&sci_rnc->state_machine)); | ||
248 | |||
249 | return SCI_FAILURE_INVALID_STATE; | ||
250 | } | ||
251 | |||
252 | static enum sci_status scic_sds_remote_node_context_default_start_io_handler( | 198 | static enum sci_status scic_sds_remote_node_context_default_start_io_handler( |
253 | struct scic_sds_remote_node_context *sci_rnc, | 199 | struct scic_sds_remote_node_context *sci_rnc, |
254 | struct scic_sds_request *sci_req) | 200 | struct scic_sds_request *sci_req) |
@@ -295,61 +241,6 @@ static enum sci_status scic_sds_remote_node_context_success_start_task_handler( | |||
295 | return SCI_SUCCESS; | 241 | return SCI_SUCCESS; |
296 | } | 242 | } |
297 | 243 | ||
298 | static enum sci_status scic_sds_remote_node_context_initial_state_resume_handler( | ||
299 | struct scic_sds_remote_node_context *sci_rnc, | ||
300 | scics_sds_remote_node_context_callback callback, | ||
301 | void *callback_parameter) | ||
302 | { | ||
303 | if (sci_rnc->remote_node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) { | ||
304 | scic_sds_remote_node_context_setup_to_resume( | ||
305 | sci_rnc, callback, callback_parameter | ||
306 | ); | ||
307 | |||
308 | scic_sds_remote_node_context_construct_buffer(sci_rnc); | ||
309 | |||
310 | sci_base_state_machine_change_state( | ||
311 | &sci_rnc->state_machine, | ||
312 | SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE | ||
313 | ); | ||
314 | |||
315 | return SCI_SUCCESS; | ||
316 | } | ||
317 | |||
318 | return SCI_FAILURE_INVALID_STATE; | ||
319 | } | ||
320 | |||
321 | /** | ||
322 | * | ||
323 | * @sci_rnc: The remote node context object being suspended. | ||
324 | * @callback: The callback when the suspension is complete. | ||
325 | * @callback_parameter: The parameter that is to be passed into the callback. | ||
326 | * | ||
327 | * This method will handle the suspend requests from the ready state. | ||
328 | * SCI_SUCCESS | ||
329 | */ | ||
330 | static enum sci_status scic_sds_remote_node_context_ready_state_suspend_handler( | ||
331 | struct scic_sds_remote_node_context *sci_rnc, | ||
332 | u32 suspend_type, | ||
333 | scics_sds_remote_node_context_callback callback, | ||
334 | void *callback_parameter) | ||
335 | { | ||
336 | sci_rnc->user_callback = callback; | ||
337 | sci_rnc->user_cookie = callback_parameter; | ||
338 | sci_rnc->suspension_code = suspend_type; | ||
339 | |||
340 | if (suspend_type == SCI_SOFTWARE_SUSPENSION) { | ||
341 | scic_sds_remote_device_post_request(rnc_to_dev(sci_rnc), | ||
342 | SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX); | ||
343 | } | ||
344 | |||
345 | sci_base_state_machine_change_state( | ||
346 | &sci_rnc->state_machine, | ||
347 | SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE | ||
348 | ); | ||
349 | |||
350 | return SCI_SUCCESS; | ||
351 | } | ||
352 | |||
353 | /** | 244 | /** |
354 | * | 245 | * |
355 | * @sci_rnc: The rnc for which the io request is targeted. | 246 | * @sci_rnc: The rnc for which the io request is targeted. |
@@ -366,39 +257,6 @@ static enum sci_status scic_sds_remote_node_context_ready_state_start_io_handler | |||
366 | return SCI_SUCCESS; | 257 | return SCI_SUCCESS; |
367 | } | 258 | } |
368 | 259 | ||
369 | static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_handler( | ||
370 | struct scic_sds_remote_node_context *sci_rnc, | ||
371 | scics_sds_remote_node_context_callback callback, | ||
372 | void *callback_parameter) | ||
373 | { | ||
374 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | ||
375 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | ||
376 | enum sci_status status = SCI_SUCCESS; | ||
377 | |||
378 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, callback, | ||
379 | callback_parameter); | ||
380 | |||
381 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ | ||
382 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) | ||
383 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | ||
384 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
385 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | ||
386 | if (sci_dev->is_direct_attached) { | ||
387 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ | ||
388 | sci_base_state_machine_change_state( | ||
389 | &sci_rnc->state_machine, | ||
390 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
391 | } else { | ||
392 | sci_base_state_machine_change_state( | ||
393 | &sci_rnc->state_machine, | ||
394 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE); | ||
395 | } | ||
396 | } else | ||
397 | status = SCI_FAILURE; | ||
398 | |||
399 | return status; | ||
400 | } | ||
401 | |||
402 | /** | 260 | /** |
403 | * | 261 | * |
404 | * @sci_rnc: The remote node context which is to receive the task request. | 262 | * @sci_rnc: The remote node context which is to receive the task request. |
@@ -419,44 +277,6 @@ static enum sci_status scic_sds_remote_node_context_suspended_start_task_handler | |||
419 | return SCI_SUCCESS; | 277 | return SCI_SUCCESS; |
420 | } | 278 | } |
421 | 279 | ||
422 | /* --------------------------------------------------------------------------- */ | ||
423 | |||
424 | static enum sci_status scic_sds_remote_node_context_tx_rx_suspended_state_resume_handler( | ||
425 | struct scic_sds_remote_node_context *sci_rnc, | ||
426 | scics_sds_remote_node_context_callback callback, | ||
427 | void *callback_parameter) | ||
428 | { | ||
429 | scic_sds_remote_node_context_setup_to_resume( | ||
430 | sci_rnc, callback, callback_parameter | ||
431 | ); | ||
432 | |||
433 | sci_base_state_machine_change_state( | ||
434 | &sci_rnc->state_machine, | ||
435 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE | ||
436 | ); | ||
437 | |||
438 | return SCI_FAILURE_INVALID_STATE; | ||
439 | } | ||
440 | |||
441 | /* --------------------------------------------------------------------------- */ | ||
442 | |||
443 | /** | ||
444 | * | ||
445 | * | ||
446 | * | ||
447 | */ | ||
448 | static enum sci_status scic_sds_remote_node_context_await_suspension_state_resume_handler( | ||
449 | struct scic_sds_remote_node_context *sci_rnc, | ||
450 | scics_sds_remote_node_context_callback callback, | ||
451 | void *callback_parameter) | ||
452 | { | ||
453 | scic_sds_remote_node_context_setup_to_resume( | ||
454 | sci_rnc, callback, callback_parameter | ||
455 | ); | ||
456 | |||
457 | return SCI_SUCCESS; | ||
458 | } | ||
459 | |||
460 | /** | 280 | /** |
461 | * | 281 | * |
462 | * @sci_rnc: The remote node context which is to receive the task request. | 282 | * @sci_rnc: The remote node context which is to receive the task request. |
@@ -477,50 +297,34 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_start | |||
477 | 297 | ||
478 | static struct scic_sds_remote_node_context_handlers scic_sds_remote_node_context_state_handler_table[] = { | 298 | static struct scic_sds_remote_node_context_handlers scic_sds_remote_node_context_state_handler_table[] = { |
479 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE] = { | 299 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE] = { |
480 | .suspend_handler = scic_sds_remote_node_context_default_suspend_handler, | ||
481 | .resume_handler = scic_sds_remote_node_context_initial_state_resume_handler, | ||
482 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, | 300 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, |
483 | .start_task_handler = scic_sds_remote_node_context_default_start_task_handler, | 301 | .start_task_handler = scic_sds_remote_node_context_default_start_task_handler, |
484 | }, | 302 | }, |
485 | [SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE] = { | 303 | [SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE] = { |
486 | .suspend_handler = scic_sds_remote_node_context_default_suspend_handler, | ||
487 | .resume_handler = scic_sds_remote_node_context_continue_to_resume_handler, | ||
488 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, | 304 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, |
489 | .start_task_handler = scic_sds_remote_node_context_default_start_task_handler, | 305 | .start_task_handler = scic_sds_remote_node_context_default_start_task_handler, |
490 | }, | 306 | }, |
491 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE] = { | 307 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE] = { |
492 | .suspend_handler = scic_sds_remote_node_context_default_suspend_handler, | ||
493 | .resume_handler = scic_sds_remote_node_context_continue_to_resume_handler, | ||
494 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, | 308 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, |
495 | .start_task_handler = scic_sds_remote_node_context_default_start_task_handler, | 309 | .start_task_handler = scic_sds_remote_node_context_default_start_task_handler, |
496 | }, | 310 | }, |
497 | [SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE] = { | 311 | [SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE] = { |
498 | .suspend_handler = scic_sds_remote_node_context_default_suspend_handler, | ||
499 | .resume_handler = scic_sds_remote_node_context_continue_to_resume_handler, | ||
500 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, | 312 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, |
501 | .start_task_handler = scic_sds_remote_node_context_success_start_task_handler, | 313 | .start_task_handler = scic_sds_remote_node_context_success_start_task_handler, |
502 | }, | 314 | }, |
503 | [SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE] = { | 315 | [SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE] = { |
504 | .suspend_handler = scic_sds_remote_node_context_ready_state_suspend_handler, | ||
505 | .resume_handler = scic_sds_remote_node_context_default_resume_handler, | ||
506 | .start_io_handler = scic_sds_remote_node_context_ready_state_start_io_handler, | 316 | .start_io_handler = scic_sds_remote_node_context_ready_state_start_io_handler, |
507 | .start_task_handler = scic_sds_remote_node_context_success_start_task_handler, | 317 | .start_task_handler = scic_sds_remote_node_context_success_start_task_handler, |
508 | }, | 318 | }, |
509 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE] = { | 319 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE] = { |
510 | .suspend_handler = scic_sds_remote_node_context_default_suspend_handler, | ||
511 | .resume_handler = scic_sds_remote_node_context_tx_suspended_state_resume_handler, | ||
512 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, | 320 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, |
513 | .start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler, | 321 | .start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler, |
514 | }, | 322 | }, |
515 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE] = { | 323 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE] = { |
516 | .suspend_handler = scic_sds_remote_node_context_default_suspend_handler, | ||
517 | .resume_handler = scic_sds_remote_node_context_tx_rx_suspended_state_resume_handler, | ||
518 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, | 324 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, |
519 | .start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler, | 325 | .start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler, |
520 | }, | 326 | }, |
521 | [SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE] = { | 327 | [SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE] = { |
522 | .suspend_handler = scic_sds_remote_node_context_default_suspend_handler, | ||
523 | .resume_handler = scic_sds_remote_node_context_await_suspension_state_resume_handler, | ||
524 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, | 328 | .start_io_handler = scic_sds_remote_node_context_default_start_io_handler, |
525 | .start_task_handler = scic_sds_remote_node_context_await_suspension_state_start_task_handler, | 329 | .start_task_handler = scic_sds_remote_node_context_await_suspension_state_start_task_handler, |
526 | } | 330 | } |
@@ -548,21 +352,11 @@ static void scic_sds_remote_node_context_notify_user( | |||
548 | } | 352 | } |
549 | } | 353 | } |
550 | 354 | ||
551 | /** | 355 | static void scic_sds_remote_node_context_continue_state_transitions(struct scic_sds_remote_node_context *rnc) |
552 | * | ||
553 | * | ||
554 | * This method will continue the remote node context state machine by | ||
555 | * requesting to resume the remote node context state machine from its current | ||
556 | * state. | ||
557 | */ | ||
558 | static void scic_sds_remote_node_context_continue_state_transitions( | ||
559 | struct scic_sds_remote_node_context *rnc) | ||
560 | { | 356 | { |
561 | if (rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) { | 357 | if (rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) |
562 | rnc->state_handlers->resume_handler( | 358 | scic_sds_remote_node_context_resume(rnc, rnc->user_callback, |
563 | rnc, rnc->user_callback, rnc->user_cookie | 359 | rnc->user_cookie); |
564 | ); | ||
565 | } | ||
566 | } | 360 | } |
567 | 361 | ||
568 | /** | 362 | /** |
@@ -989,3 +783,95 @@ enum sci_status scic_sds_remote_node_context_destruct(struct scic_sds_remote_nod | |||
989 | return SCI_FAILURE_INVALID_STATE; | 783 | return SCI_FAILURE_INVALID_STATE; |
990 | } | 784 | } |
991 | } | 785 | } |
786 | |||
787 | enum sci_status scic_sds_remote_node_context_suspend(struct scic_sds_remote_node_context *sci_rnc, | ||
788 | u32 suspend_type, | ||
789 | scics_sds_remote_node_context_callback cb_fn, | ||
790 | void *cb_p) | ||
791 | { | ||
792 | enum scis_sds_remote_node_context_states state; | ||
793 | |||
794 | state = sci_rnc->state_machine.current_state_id; | ||
795 | if (state != SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { | ||
796 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | ||
797 | "%s: invalid state %d\n", __func__, state); | ||
798 | return SCI_FAILURE_INVALID_STATE; | ||
799 | } | ||
800 | |||
801 | sci_rnc->user_callback = cb_fn; | ||
802 | sci_rnc->user_cookie = cb_p; | ||
803 | sci_rnc->suspension_code = suspend_type; | ||
804 | |||
805 | if (suspend_type == SCI_SOFTWARE_SUSPENSION) { | ||
806 | scic_sds_remote_device_post_request(rnc_to_dev(sci_rnc), | ||
807 | SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX); | ||
808 | } | ||
809 | |||
810 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | ||
811 | SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE); | ||
812 | return SCI_SUCCESS; | ||
813 | } | ||
814 | |||
815 | enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_context *sci_rnc, | ||
816 | scics_sds_remote_node_context_callback cb_fn, | ||
817 | void *cb_p) | ||
818 | { | ||
819 | enum scis_sds_remote_node_context_states state; | ||
820 | |||
821 | state = sci_rnc->state_machine.current_state_id; | ||
822 | switch (state) { | ||
823 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE: | ||
824 | if (sci_rnc->remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) | ||
825 | return SCI_FAILURE_INVALID_STATE; | ||
826 | |||
827 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | ||
828 | scic_sds_remote_node_context_construct_buffer(sci_rnc); | ||
829 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | ||
830 | SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE); | ||
831 | return SCI_SUCCESS; | ||
832 | case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE: | ||
833 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE: | ||
834 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | ||
835 | if (sci_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) | ||
836 | return SCI_FAILURE_INVALID_STATE; | ||
837 | |||
838 | sci_rnc->user_callback = cb_fn; | ||
839 | sci_rnc->user_cookie = cb_p; | ||
840 | return SCI_SUCCESS; | ||
841 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE: { | ||
842 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | ||
843 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | ||
844 | |||
845 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | ||
846 | |||
847 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ | ||
848 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) | ||
849 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | ||
850 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
851 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | ||
852 | if (sci_dev->is_direct_attached) { | ||
853 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ | ||
854 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | ||
855 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
856 | } else { | ||
857 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | ||
858 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE); | ||
859 | } | ||
860 | } else | ||
861 | return SCI_FAILURE; | ||
862 | return SCI_SUCCESS; | ||
863 | } | ||
864 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE: | ||
865 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | ||
866 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | ||
867 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
868 | return SCI_FAILURE_INVALID_STATE; | ||
869 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | ||
870 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | ||
871 | return SCI_SUCCESS; | ||
872 | default: | ||
873 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | ||
874 | "%s: invalid state %d\n", __func__, state); | ||
875 | return SCI_FAILURE_INVALID_STATE; | ||
876 | } | ||
877 | } | ||
diff --git a/drivers/scsi/isci/remote_node_context.h b/drivers/scsi/isci/remote_node_context.h index 1cd323438292..68983748eba9 100644 --- a/drivers/scsi/isci/remote_node_context.h +++ b/drivers/scsi/isci/remote_node_context.h | |||
@@ -90,13 +90,6 @@ typedef enum sci_status (*scic_sds_remote_node_context_operation)( | |||
90 | void *callback_parameter | 90 | void *callback_parameter |
91 | ); | 91 | ); |
92 | 92 | ||
93 | typedef enum sci_status (*scic_sds_remote_node_context_suspend_operation)( | ||
94 | struct scic_sds_remote_node_context *sci_rnc, | ||
95 | u32 suspension_type, | ||
96 | scics_sds_remote_node_context_callback callback, | ||
97 | void *callback_parameter | ||
98 | ); | ||
99 | |||
100 | typedef enum sci_status (*scic_sds_remote_node_context_io_request)( | 93 | typedef enum sci_status (*scic_sds_remote_node_context_io_request)( |
101 | struct scic_sds_remote_node_context *sci_rnc, | 94 | struct scic_sds_remote_node_context *sci_rnc, |
102 | struct scic_sds_request *sci_req | 95 | struct scic_sds_request *sci_req |
@@ -104,19 +97,6 @@ typedef enum sci_status (*scic_sds_remote_node_context_io_request)( | |||
104 | 97 | ||
105 | struct scic_sds_remote_node_context_handlers { | 98 | struct scic_sds_remote_node_context_handlers { |
106 | /** | 99 | /** |
107 | * This handler is invoked when there is a request to suspend the RNC. The | ||
108 | * callback is invoked after the hardware notification that the remote node is | ||
109 | * suspended. | ||
110 | */ | ||
111 | scic_sds_remote_node_context_suspend_operation suspend_handler; | ||
112 | |||
113 | /** | ||
114 | * This handler is invoked when there is a request to resume the RNC. The | ||
115 | * callback is invoked when after the RNC has reached the ready state. | ||
116 | */ | ||
117 | scic_sds_remote_node_context_operation resume_handler; | ||
118 | |||
119 | /** | ||
120 | * This handler is invoked when there is a request to start an io request | 100 | * This handler is invoked when there is a request to start an io request |
121 | * operation. | 101 | * operation. |
122 | */ | 102 | */ |
@@ -260,11 +240,15 @@ enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remot | |||
260 | enum sci_status scic_sds_remote_node_context_destruct(struct scic_sds_remote_node_context *sci_rnc, | 240 | enum sci_status scic_sds_remote_node_context_destruct(struct scic_sds_remote_node_context *sci_rnc, |
261 | scics_sds_remote_node_context_callback callback, | 241 | scics_sds_remote_node_context_callback callback, |
262 | void *callback_parameter); | 242 | void *callback_parameter); |
263 | #define scic_sds_remote_node_context_resume(rnc, callback, parameter) \ | ||
264 | ((rnc)->state_handlers->resume_handler(rnc, callback, parameter)) | ||
265 | 243 | ||
266 | #define scic_sds_remote_node_context_suspend(rnc, suspend_type, callback, parameter) \ | 244 | enum sci_status scic_sds_remote_node_context_suspend(struct scic_sds_remote_node_context *sci_rnc, |
267 | ((rnc)->state_handlers->suspend_handler(rnc, suspend_type, callback, parameter)) | 245 | u32 suspend_type, |
246 | scics_sds_remote_node_context_callback cb_fn, | ||
247 | void *cb_p); | ||
248 | |||
249 | enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_context *sci_rnc, | ||
250 | scics_sds_remote_node_context_callback cb_fn, | ||
251 | void *cb_p); | ||
268 | 252 | ||
269 | #define scic_sds_remote_node_context_start_io(rnc, request) \ | 253 | #define scic_sds_remote_node_context_start_io(rnc, request) \ |
270 | ((rnc)->state_handlers->start_io_handler(rnc, request)) | 254 | ((rnc)->state_handlers->start_io_handler(rnc, request)) |