diff options
Diffstat (limited to 'drivers/scsi/isci/remote_node_context.c')
-rw-r--r-- | drivers/scsi/isci/remote_node_context.c | 154 |
1 files changed, 70 insertions, 84 deletions
diff --git a/drivers/scsi/isci/remote_node_context.c b/drivers/scsi/isci/remote_node_context.c index e7fa5bac7d53..24b1d8acf7b8 100644 --- a/drivers/scsi/isci/remote_node_context.c +++ b/drivers/scsi/isci/remote_node_context.c | |||
@@ -84,9 +84,9 @@ | |||
84 | bool scic_sds_remote_node_context_is_ready( | 84 | bool scic_sds_remote_node_context_is_ready( |
85 | struct scic_sds_remote_node_context *sci_rnc) | 85 | struct scic_sds_remote_node_context *sci_rnc) |
86 | { | 86 | { |
87 | u32 current_state = sci_base_state_machine_get_state(&sci_rnc->state_machine); | 87 | u32 current_state = sci_rnc->sm.current_state_id; |
88 | 88 | ||
89 | if (current_state == SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { | 89 | if (current_state == SCI_RNC_READY) { |
90 | return true; | 90 | return true; |
91 | } | 91 | } |
92 | 92 | ||
@@ -268,12 +268,12 @@ static void scic_sds_remote_node_context_invalidate_context_buffer( | |||
268 | 268 | ||
269 | static void scic_sds_remote_node_context_initial_state_enter(struct sci_base_state_machine *sm) | 269 | static void scic_sds_remote_node_context_initial_state_enter(struct sci_base_state_machine *sm) |
270 | { | 270 | { |
271 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 271 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
272 | 272 | ||
273 | /* Check to see if we have gotten back to the initial state because | 273 | /* Check to see if we have gotten back to the initial state because |
274 | * someone requested to destroy the remote node context object. | 274 | * someone requested to destroy the remote node context object. |
275 | */ | 275 | */ |
276 | if (sm->previous_state_id == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE) { | 276 | if (sm->previous_state_id == SCI_RNC_INVALIDATING) { |
277 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; | 277 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; |
278 | scic_sds_remote_node_context_notify_user(rnc); | 278 | scic_sds_remote_node_context_notify_user(rnc); |
279 | } | 279 | } |
@@ -281,21 +281,21 @@ static void scic_sds_remote_node_context_initial_state_enter(struct sci_base_sta | |||
281 | 281 | ||
282 | static void scic_sds_remote_node_context_posting_state_enter(struct sci_base_state_machine *sm) | 282 | static void scic_sds_remote_node_context_posting_state_enter(struct sci_base_state_machine *sm) |
283 | { | 283 | { |
284 | struct scic_sds_remote_node_context *sci_rnc = container_of(sm, typeof(*sci_rnc), state_machine); | 284 | struct scic_sds_remote_node_context *sci_rnc = container_of(sm, typeof(*sci_rnc), sm); |
285 | 285 | ||
286 | scic_sds_remote_node_context_validate_context_buffer(sci_rnc); | 286 | scic_sds_remote_node_context_validate_context_buffer(sci_rnc); |
287 | } | 287 | } |
288 | 288 | ||
289 | static void scic_sds_remote_node_context_invalidating_state_enter(struct sci_base_state_machine *sm) | 289 | static void scic_sds_remote_node_context_invalidating_state_enter(struct sci_base_state_machine *sm) |
290 | { | 290 | { |
291 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 291 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
292 | 292 | ||
293 | scic_sds_remote_node_context_invalidate_context_buffer(rnc); | 293 | scic_sds_remote_node_context_invalidate_context_buffer(rnc); |
294 | } | 294 | } |
295 | 295 | ||
296 | static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_state_machine *sm) | 296 | static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_state_machine *sm) |
297 | { | 297 | { |
298 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 298 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
299 | struct scic_sds_remote_device *sci_dev; | 299 | struct scic_sds_remote_device *sci_dev; |
300 | struct domain_device *dev; | 300 | struct domain_device *dev; |
301 | 301 | ||
@@ -318,7 +318,7 @@ static void scic_sds_remote_node_context_resuming_state_enter(struct sci_base_st | |||
318 | 318 | ||
319 | static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state_machine *sm) | 319 | static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state_machine *sm) |
320 | { | 320 | { |
321 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 321 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
322 | 322 | ||
323 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; | 323 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; |
324 | 324 | ||
@@ -328,41 +328,41 @@ static void scic_sds_remote_node_context_ready_state_enter(struct sci_base_state | |||
328 | 328 | ||
329 | static void scic_sds_remote_node_context_tx_suspended_state_enter(struct sci_base_state_machine *sm) | 329 | static void scic_sds_remote_node_context_tx_suspended_state_enter(struct sci_base_state_machine *sm) |
330 | { | 330 | { |
331 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 331 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
332 | 332 | ||
333 | scic_sds_remote_node_context_continue_state_transitions(rnc); | 333 | scic_sds_remote_node_context_continue_state_transitions(rnc); |
334 | } | 334 | } |
335 | 335 | ||
336 | static void scic_sds_remote_node_context_tx_rx_suspended_state_enter(struct sci_base_state_machine *sm) | 336 | static void scic_sds_remote_node_context_tx_rx_suspended_state_enter(struct sci_base_state_machine *sm) |
337 | { | 337 | { |
338 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), state_machine); | 338 | struct scic_sds_remote_node_context *rnc = container_of(sm, typeof(*rnc), sm); |
339 | 339 | ||
340 | scic_sds_remote_node_context_continue_state_transitions(rnc); | 340 | scic_sds_remote_node_context_continue_state_transitions(rnc); |
341 | } | 341 | } |
342 | 342 | ||
343 | static const struct sci_base_state scic_sds_remote_node_context_state_table[] = { | 343 | static const struct sci_base_state scic_sds_remote_node_context_state_table[] = { |
344 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE] = { | 344 | [SCI_RNC_INITIAL] = { |
345 | .enter_state = scic_sds_remote_node_context_initial_state_enter, | 345 | .enter_state = scic_sds_remote_node_context_initial_state_enter, |
346 | }, | 346 | }, |
347 | [SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE] = { | 347 | [SCI_RNC_POSTING] = { |
348 | .enter_state = scic_sds_remote_node_context_posting_state_enter, | 348 | .enter_state = scic_sds_remote_node_context_posting_state_enter, |
349 | }, | 349 | }, |
350 | [SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE] = { | 350 | [SCI_RNC_INVALIDATING] = { |
351 | .enter_state = scic_sds_remote_node_context_invalidating_state_enter, | 351 | .enter_state = scic_sds_remote_node_context_invalidating_state_enter, |
352 | }, | 352 | }, |
353 | [SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE] = { | 353 | [SCI_RNC_RESUMING] = { |
354 | .enter_state = scic_sds_remote_node_context_resuming_state_enter, | 354 | .enter_state = scic_sds_remote_node_context_resuming_state_enter, |
355 | }, | 355 | }, |
356 | [SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE] = { | 356 | [SCI_RNC_READY] = { |
357 | .enter_state = scic_sds_remote_node_context_ready_state_enter, | 357 | .enter_state = scic_sds_remote_node_context_ready_state_enter, |
358 | }, | 358 | }, |
359 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE] = { | 359 | [SCI_RNC_TX_SUSPENDED] = { |
360 | .enter_state = scic_sds_remote_node_context_tx_suspended_state_enter, | 360 | .enter_state = scic_sds_remote_node_context_tx_suspended_state_enter, |
361 | }, | 361 | }, |
362 | [SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE] = { | 362 | [SCI_RNC_TX_RX_SUSPENDED] = { |
363 | .enter_state = scic_sds_remote_node_context_tx_rx_suspended_state_enter, | 363 | .enter_state = scic_sds_remote_node_context_tx_rx_suspended_state_enter, |
364 | }, | 364 | }, |
365 | [SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE] = { }, | 365 | [SCI_RNC_AWAIT_SUSPENSION] = { }, |
366 | }; | 366 | }; |
367 | 367 | ||
368 | void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc, | 368 | void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context *rnc, |
@@ -373,11 +373,11 @@ void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context | |||
373 | rnc->remote_node_index = remote_node_index; | 373 | rnc->remote_node_index = remote_node_index; |
374 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; | 374 | rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_UNSPECIFIED; |
375 | 375 | ||
376 | sci_base_state_machine_construct(&rnc->state_machine, | 376 | sci_base_state_machine_construct(&rnc->sm, |
377 | scic_sds_remote_node_context_state_table, | 377 | scic_sds_remote_node_context_state_table, |
378 | SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE); | 378 | SCI_RNC_INITIAL); |
379 | 379 | ||
380 | sci_base_state_machine_start(&rnc->state_machine); | 380 | sci_base_state_machine_start(&rnc->sm); |
381 | } | 381 | } |
382 | 382 | ||
383 | enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remote_node_context *sci_rnc, | 383 | enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remote_node_context *sci_rnc, |
@@ -385,26 +385,24 @@ enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remot | |||
385 | { | 385 | { |
386 | enum scis_sds_remote_node_context_states state; | 386 | enum scis_sds_remote_node_context_states state; |
387 | 387 | ||
388 | state = sci_rnc->state_machine.current_state_id; | 388 | state = sci_rnc->sm.current_state_id; |
389 | switch (state) { | 389 | switch (state) { |
390 | case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE: | 390 | case SCI_RNC_POSTING: |
391 | switch (scu_get_event_code(event_code)) { | 391 | switch (scu_get_event_code(event_code)) { |
392 | case SCU_EVENT_POST_RNC_COMPLETE: | 392 | case SCU_EVENT_POST_RNC_COMPLETE: |
393 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 393 | sci_change_state(&sci_rnc->sm, SCI_RNC_READY); |
394 | SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE); | ||
395 | break; | 394 | break; |
396 | default: | 395 | default: |
397 | goto out; | 396 | goto out; |
398 | } | 397 | } |
399 | break; | 398 | break; |
400 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE: | 399 | case SCI_RNC_INVALIDATING: |
401 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) { | 400 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) { |
402 | if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) | 401 | if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) |
403 | state = SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE; | 402 | state = SCI_RNC_INITIAL; |
404 | else | 403 | else |
405 | state = SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE; | 404 | state = SCI_RNC_POSTING; |
406 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 405 | sci_change_state(&sci_rnc->sm, state); |
407 | state); | ||
408 | } else { | 406 | } else { |
409 | switch (scu_get_event_type(event_code)) { | 407 | switch (scu_get_event_type(event_code)) { |
410 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: | 408 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: |
@@ -421,10 +419,9 @@ enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remot | |||
421 | } | 419 | } |
422 | } | 420 | } |
423 | break; | 421 | break; |
424 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 422 | case SCI_RNC_RESUMING: |
425 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RCN_RELEASE) { | 423 | if (scu_get_event_code(event_code) == SCU_EVENT_POST_RCN_RELEASE) { |
426 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 424 | sci_change_state(&sci_rnc->sm, SCI_RNC_READY); |
427 | SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE); | ||
428 | } else { | 425 | } else { |
429 | switch (scu_get_event_type(event_code)) { | 426 | switch (scu_get_event_type(event_code)) { |
430 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: | 427 | case SCU_EVENT_TYPE_RNC_SUSPEND_TX: |
@@ -441,32 +438,28 @@ enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remot | |||
441 | } | 438 | } |
442 | } | 439 | } |
443 | break; | 440 | break; |
444 | case SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE: | 441 | case SCI_RNC_READY: |
445 | switch (scu_get_event_type(event_code)) { | 442 | switch (scu_get_event_type(event_code)) { |
446 | case SCU_EVENT_TL_RNC_SUSPEND_TX: | 443 | case SCU_EVENT_TL_RNC_SUSPEND_TX: |
447 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 444 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_SUSPENDED); |
448 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE); | ||
449 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 445 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
450 | break; | 446 | break; |
451 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: | 447 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: |
452 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 448 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_RX_SUSPENDED); |
453 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE); | ||
454 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 449 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
455 | break; | 450 | break; |
456 | default: | 451 | default: |
457 | goto out; | 452 | goto out; |
458 | } | 453 | } |
459 | break; | 454 | break; |
460 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 455 | case SCI_RNC_AWAIT_SUSPENSION: |
461 | switch (scu_get_event_type(event_code)) { | 456 | switch (scu_get_event_type(event_code)) { |
462 | case SCU_EVENT_TL_RNC_SUSPEND_TX: | 457 | case SCU_EVENT_TL_RNC_SUSPEND_TX: |
463 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 458 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_SUSPENDED); |
464 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE); | ||
465 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 459 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
466 | break; | 460 | break; |
467 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: | 461 | case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: |
468 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 462 | sci_change_state(&sci_rnc->sm, SCI_RNC_TX_RX_SUSPENDED); |
469 | SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE); | ||
470 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); | 463 | sci_rnc->suspension_code = scu_get_event_specifier(event_code); |
471 | break; | 464 | break; |
472 | default: | 465 | default: |
@@ -493,22 +486,21 @@ enum sci_status scic_sds_remote_node_context_destruct(struct scic_sds_remote_nod | |||
493 | { | 486 | { |
494 | enum scis_sds_remote_node_context_states state; | 487 | enum scis_sds_remote_node_context_states state; |
495 | 488 | ||
496 | state = sci_rnc->state_machine.current_state_id; | 489 | state = sci_rnc->sm.current_state_id; |
497 | switch (state) { | 490 | switch (state) { |
498 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE: | 491 | case SCI_RNC_INVALIDATING: |
499 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); | 492 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); |
500 | return SCI_SUCCESS; | 493 | return SCI_SUCCESS; |
501 | case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE: | 494 | case SCI_RNC_POSTING: |
502 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 495 | case SCI_RNC_RESUMING: |
503 | case SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE: | 496 | case SCI_RNC_READY: |
504 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE: | 497 | case SCI_RNC_TX_SUSPENDED: |
505 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE: | 498 | case SCI_RNC_TX_RX_SUSPENDED: |
506 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 499 | case SCI_RNC_AWAIT_SUSPENSION: |
507 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); | 500 | scic_sds_remote_node_context_setup_to_destory(sci_rnc, cb_fn, cb_p); |
508 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 501 | sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING); |
509 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE); | ||
510 | return SCI_SUCCESS; | 502 | return SCI_SUCCESS; |
511 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE: | 503 | case SCI_RNC_INITIAL: |
512 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | 504 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), |
513 | "%s: invalid state %d\n", __func__, state); | 505 | "%s: invalid state %d\n", __func__, state); |
514 | /* We have decided that the destruct request on the remote node context | 506 | /* We have decided that the destruct request on the remote node context |
@@ -530,8 +522,8 @@ enum sci_status scic_sds_remote_node_context_suspend(struct scic_sds_remote_node | |||
530 | { | 522 | { |
531 | enum scis_sds_remote_node_context_states state; | 523 | enum scis_sds_remote_node_context_states state; |
532 | 524 | ||
533 | state = sci_rnc->state_machine.current_state_id; | 525 | state = sci_rnc->sm.current_state_id; |
534 | if (state != SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { | 526 | if (state != SCI_RNC_READY) { |
535 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | 527 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), |
536 | "%s: invalid state %d\n", __func__, state); | 528 | "%s: invalid state %d\n", __func__, state); |
537 | return SCI_FAILURE_INVALID_STATE; | 529 | return SCI_FAILURE_INVALID_STATE; |
@@ -546,8 +538,7 @@ enum sci_status scic_sds_remote_node_context_suspend(struct scic_sds_remote_node | |||
546 | SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX); | 538 | SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX); |
547 | } | 539 | } |
548 | 540 | ||
549 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 541 | sci_change_state(&sci_rnc->sm, SCI_RNC_AWAIT_SUSPENSION); |
550 | SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE); | ||
551 | return SCI_SUCCESS; | 542 | return SCI_SUCCESS; |
552 | } | 543 | } |
553 | 544 | ||
@@ -557,27 +548,26 @@ enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_ | |||
557 | { | 548 | { |
558 | enum scis_sds_remote_node_context_states state; | 549 | enum scis_sds_remote_node_context_states state; |
559 | 550 | ||
560 | state = sci_rnc->state_machine.current_state_id; | 551 | state = sci_rnc->sm.current_state_id; |
561 | switch (state) { | 552 | switch (state) { |
562 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE: | 553 | case SCI_RNC_INITIAL: |
563 | if (sci_rnc->remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) | 554 | if (sci_rnc->remote_node_index == SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) |
564 | return SCI_FAILURE_INVALID_STATE; | 555 | return SCI_FAILURE_INVALID_STATE; |
565 | 556 | ||
566 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | 557 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); |
567 | scic_sds_remote_node_context_construct_buffer(sci_rnc); | 558 | scic_sds_remote_node_context_construct_buffer(sci_rnc); |
568 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 559 | sci_change_state(&sci_rnc->sm, SCI_RNC_POSTING); |
569 | SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE); | ||
570 | return SCI_SUCCESS; | 560 | return SCI_SUCCESS; |
571 | case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE: | 561 | case SCI_RNC_POSTING: |
572 | case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE: | 562 | case SCI_RNC_INVALIDATING: |
573 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 563 | case SCI_RNC_RESUMING: |
574 | if (sci_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) | 564 | if (sci_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) |
575 | return SCI_FAILURE_INVALID_STATE; | 565 | return SCI_FAILURE_INVALID_STATE; |
576 | 566 | ||
577 | sci_rnc->user_callback = cb_fn; | 567 | sci_rnc->user_callback = cb_fn; |
578 | sci_rnc->user_cookie = cb_p; | 568 | sci_rnc->user_cookie = cb_p; |
579 | return SCI_SUCCESS; | 569 | return SCI_SUCCESS; |
580 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE: { | 570 | case SCI_RNC_TX_SUSPENDED: { |
581 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); | 571 | struct scic_sds_remote_device *sci_dev = rnc_to_dev(sci_rnc); |
582 | struct domain_device *dev = sci_dev_to_domain(sci_dev); | 572 | struct domain_device *dev = sci_dev_to_domain(sci_dev); |
583 | 573 | ||
@@ -585,27 +575,23 @@ enum sci_status scic_sds_remote_node_context_resume(struct scic_sds_remote_node_ | |||
585 | 575 | ||
586 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ | 576 | /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ |
587 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) | 577 | if (dev->dev_type == SAS_END_DEV || dev_is_expander(dev)) |
588 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 578 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
589 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
590 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { | 579 | else if (dev->dev_type == SATA_DEV || (dev->tproto & SAS_PROTOCOL_STP)) { |
591 | if (sci_dev->is_direct_attached) { | 580 | if (sci_dev->is_direct_attached) { |
592 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ | 581 | /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ |
593 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 582 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
594 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
595 | } else { | 583 | } else { |
596 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 584 | sci_change_state(&sci_rnc->sm, SCI_RNC_INVALIDATING); |
597 | SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE); | ||
598 | } | 585 | } |
599 | } else | 586 | } else |
600 | return SCI_FAILURE; | 587 | return SCI_FAILURE; |
601 | return SCI_SUCCESS; | 588 | return SCI_SUCCESS; |
602 | } | 589 | } |
603 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE: | 590 | case SCI_RNC_TX_RX_SUSPENDED: |
604 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | 591 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); |
605 | sci_base_state_machine_change_state(&sci_rnc->state_machine, | 592 | sci_change_state(&sci_rnc->sm, SCI_RNC_RESUMING); |
606 | SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE); | ||
607 | return SCI_FAILURE_INVALID_STATE; | 593 | return SCI_FAILURE_INVALID_STATE; |
608 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 594 | case SCI_RNC_AWAIT_SUSPENSION: |
609 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); | 595 | scic_sds_remote_node_context_setup_to_resume(sci_rnc, cb_fn, cb_p); |
610 | return SCI_SUCCESS; | 596 | return SCI_SUCCESS; |
611 | default: | 597 | default: |
@@ -620,8 +606,8 @@ enum sci_status scic_sds_remote_node_context_start_io(struct scic_sds_remote_nod | |||
620 | { | 606 | { |
621 | enum scis_sds_remote_node_context_states state; | 607 | enum scis_sds_remote_node_context_states state; |
622 | 608 | ||
623 | state = sci_rnc->state_machine.current_state_id; | 609 | state = sci_rnc->sm.current_state_id; |
624 | if (state != SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { | 610 | if (state != SCI_RNC_READY) { |
625 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), | 611 | dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)), |
626 | "%s: invalid state %d\n", __func__, state); | 612 | "%s: invalid state %d\n", __func__, state); |
627 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; | 613 | return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; |
@@ -634,14 +620,14 @@ enum sci_status scic_sds_remote_node_context_start_task(struct scic_sds_remote_n | |||
634 | { | 620 | { |
635 | enum scis_sds_remote_node_context_states state; | 621 | enum scis_sds_remote_node_context_states state; |
636 | 622 | ||
637 | state = sci_rnc->state_machine.current_state_id; | 623 | state = sci_rnc->sm.current_state_id; |
638 | switch (state) { | 624 | switch (state) { |
639 | case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE: | 625 | case SCI_RNC_RESUMING: |
640 | case SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE: | 626 | case SCI_RNC_READY: |
641 | case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE: | 627 | case SCI_RNC_AWAIT_SUSPENSION: |
642 | return SCI_SUCCESS; | 628 | return SCI_SUCCESS; |
643 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE: | 629 | case SCI_RNC_TX_SUSPENDED: |
644 | case SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE: | 630 | case SCI_RNC_TX_RX_SUSPENDED: |
645 | scic_sds_remote_node_context_resume(sci_rnc, NULL, NULL); | 631 | scic_sds_remote_node_context_resume(sci_rnc, NULL, NULL); |
646 | return SCI_SUCCESS; | 632 | return SCI_SUCCESS; |
647 | default: | 633 | default: |