mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 15:01:44 +00:00
isci: unify rnc event handlers
Unify rnc event handlers and delete the state handler. Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
6813820c7b
commit
338e386d12
2 changed files with 111 additions and 270 deletions
|
@ -299,21 +299,6 @@ static enum sci_status scic_sds_remote_node_context_default_start_task_handler(
|
||||||
return SCI_FAILURE;
|
return SCI_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_default_event_handler(
|
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
|
||||||
u32 event_code)
|
|
||||||
{
|
|
||||||
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p requested to process "
|
|
||||||
"event 0x%x while in wrong state %d\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc,
|
|
||||||
event_code,
|
|
||||||
sci_base_state_machine_get_state(&sci_rnc->state_machine));
|
|
||||||
|
|
||||||
return SCI_FAILURE_INVALID_STATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @sci_rnc: The rnc for which the task request is targeted.
|
* @sci_rnc: The rnc for which the task request is targeted.
|
||||||
|
@ -383,41 +368,6 @@ static enum sci_status scic_sds_remote_node_context_initial_state_resume_handler
|
||||||
return SCI_FAILURE_INVALID_STATE;
|
return SCI_FAILURE_INVALID_STATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_posting_state_event_handler(
|
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
|
||||||
u32 event_code)
|
|
||||||
{
|
|
||||||
enum sci_status status;
|
|
||||||
|
|
||||||
switch (scu_get_event_code(event_code)) {
|
|
||||||
case SCU_EVENT_POST_RNC_COMPLETE:
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
status = SCI_FAILURE;
|
|
||||||
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p requested to "
|
|
||||||
"process unexpected event 0x%x while in posting "
|
|
||||||
"state\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc,
|
|
||||||
event_code);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_invalidating_state_destruct_handler(
|
static enum sci_status scic_sds_remote_node_context_invalidating_state_destruct_handler(
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
struct scic_sds_remote_node_context *sci_rnc,
|
||||||
scics_sds_remote_node_context_callback callback,
|
scics_sds_remote_node_context_callback callback,
|
||||||
|
@ -430,110 +380,6 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_destruct_
|
||||||
return SCI_SUCCESS;
|
return SCI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_invalidating_state_event_handler(
|
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
|
||||||
u32 event_code)
|
|
||||||
{
|
|
||||||
enum sci_status status;
|
|
||||||
|
|
||||||
if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) {
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
|
|
||||||
if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) {
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
switch (scu_get_event_type(event_code)) {
|
|
||||||
case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
|
|
||||||
case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
|
|
||||||
/*
|
|
||||||
* We really dont care if the hardware is going to suspend
|
|
||||||
* the device since it's being invalidated anyway */
|
|
||||||
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p was "
|
|
||||||
"suspeneded by hardware while being "
|
|
||||||
"invalidated.\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc);
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p "
|
|
||||||
"requested to process event 0x%x while "
|
|
||||||
"in state %d.\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc,
|
|
||||||
event_code,
|
|
||||||
sci_base_state_machine_get_state(
|
|
||||||
&sci_rnc->state_machine));
|
|
||||||
status = SCI_FAILURE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler(
|
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
|
||||||
u32 event_code)
|
|
||||||
{
|
|
||||||
enum sci_status status;
|
|
||||||
|
|
||||||
if (scu_get_event_code(event_code) == SCU_EVENT_POST_RCN_RELEASE) {
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
switch (scu_get_event_type(event_code)) {
|
|
||||||
case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
|
|
||||||
case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
|
|
||||||
/*
|
|
||||||
* We really dont care if the hardware is going to suspend
|
|
||||||
* the device since it's being resumed anyway */
|
|
||||||
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p was "
|
|
||||||
"suspeneded by hardware while being resumed.\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc);
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p requested "
|
|
||||||
"to process event 0x%x while in state %d.\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc,
|
|
||||||
event_code,
|
|
||||||
sci_base_state_machine_get_state(
|
|
||||||
&sci_rnc->state_machine));
|
|
||||||
status = SCI_FAILURE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @sci_rnc: The remote node context object being suspended.
|
* @sci_rnc: The remote node context object being suspended.
|
||||||
|
@ -582,53 +428,6 @@ static enum sci_status scic_sds_remote_node_context_ready_state_start_io_handler
|
||||||
return SCI_SUCCESS;
|
return SCI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_ready_state_event_handler(
|
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
|
||||||
u32 event_code)
|
|
||||||
{
|
|
||||||
enum sci_status status;
|
|
||||||
|
|
||||||
switch (scu_get_event_type(event_code)) {
|
|
||||||
case SCU_EVENT_TL_RNC_SUSPEND_TX:
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE
|
|
||||||
);
|
|
||||||
|
|
||||||
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCU_EVENT_TL_RNC_SUSPEND_TX_RX:
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE
|
|
||||||
);
|
|
||||||
|
|
||||||
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p requested to "
|
|
||||||
"process event 0x%x while in state %d.\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc,
|
|
||||||
event_code,
|
|
||||||
sci_base_state_machine_get_state(
|
|
||||||
&sci_rnc->state_machine));
|
|
||||||
|
|
||||||
status = SCI_FAILURE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_handler(
|
static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_handler(
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
struct scic_sds_remote_node_context *sci_rnc,
|
||||||
scics_sds_remote_node_context_callback callback,
|
scics_sds_remote_node_context_callback callback,
|
||||||
|
@ -738,61 +537,13 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_start
|
||||||
return SCI_SUCCESS;
|
return SCI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum sci_status scic_sds_remote_node_context_await_suspension_state_event_handler(
|
static struct scic_sds_remote_node_context_handlers scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
|
||||||
u32 event_code)
|
|
||||||
{
|
|
||||||
enum sci_status status;
|
|
||||||
|
|
||||||
switch (scu_get_event_type(event_code)) {
|
|
||||||
case SCU_EVENT_TL_RNC_SUSPEND_TX:
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE
|
|
||||||
);
|
|
||||||
|
|
||||||
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCU_EVENT_TL_RNC_SUSPEND_TX_RX:
|
|
||||||
sci_base_state_machine_change_state(
|
|
||||||
&sci_rnc->state_machine,
|
|
||||||
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE
|
|
||||||
);
|
|
||||||
|
|
||||||
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
|
||||||
status = SCI_SUCCESS;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
|
||||||
"%s: SCIC Remote Node Context 0x%p requested to "
|
|
||||||
"process event 0x%x while in state %d.\n",
|
|
||||||
__func__,
|
|
||||||
sci_rnc,
|
|
||||||
event_code,
|
|
||||||
sci_base_state_machine_get_state(
|
|
||||||
&sci_rnc->state_machine));
|
|
||||||
|
|
||||||
status = SCI_FAILURE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
static struct scic_sds_remote_node_context_handlers
|
|
||||||
scic_sds_remote_node_context_state_handler_table[] = {
|
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_default_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_default_destruct_handler,
|
||||||
.suspend_handler = scic_sds_remote_node_context_default_suspend_handler,
|
.suspend_handler = scic_sds_remote_node_context_default_suspend_handler,
|
||||||
.resume_handler = scic_sds_remote_node_context_initial_state_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_initial_state_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_default_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_default_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_default_event_handler
|
|
||||||
},
|
},
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
||||||
|
@ -800,7 +551,6 @@ scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
.resume_handler = scic_sds_remote_node_context_continue_to_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_continue_to_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_default_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_default_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_posting_state_event_handler
|
|
||||||
},
|
},
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_invalidating_state_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_invalidating_state_destruct_handler,
|
||||||
|
@ -808,7 +558,6 @@ scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
.resume_handler = scic_sds_remote_node_context_continue_to_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_continue_to_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_default_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_default_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_invalidating_state_event_handler
|
|
||||||
},
|
},
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
||||||
|
@ -816,7 +565,6 @@ scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
.resume_handler = scic_sds_remote_node_context_continue_to_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_continue_to_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_success_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_success_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_resuming_state_event_handler
|
|
||||||
},
|
},
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
||||||
|
@ -824,7 +572,6 @@ scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
.resume_handler = scic_sds_remote_node_context_default_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_default_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_ready_state_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_ready_state_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_success_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_success_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_ready_state_event_handler
|
|
||||||
},
|
},
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
||||||
|
@ -832,7 +579,6 @@ scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
.resume_handler = scic_sds_remote_node_context_tx_suspended_state_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_tx_suspended_state_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_default_event_handler
|
|
||||||
},
|
},
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
||||||
|
@ -840,7 +586,6 @@ scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
.resume_handler = scic_sds_remote_node_context_tx_rx_suspended_state_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_tx_rx_suspended_state_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_suspended_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_default_event_handler
|
|
||||||
},
|
},
|
||||||
[SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE] = {
|
[SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE] = {
|
||||||
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
.destruct_handler = scic_sds_remote_node_context_general_destruct_handler,
|
||||||
|
@ -848,7 +593,6 @@ scic_sds_remote_node_context_state_handler_table[] = {
|
||||||
.resume_handler = scic_sds_remote_node_context_await_suspension_state_resume_handler,
|
.resume_handler = scic_sds_remote_node_context_await_suspension_state_resume_handler,
|
||||||
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
.start_io_handler = scic_sds_remote_node_context_default_start_io_handler,
|
||||||
.start_task_handler = scic_sds_remote_node_context_await_suspension_state_start_task_handler,
|
.start_task_handler = scic_sds_remote_node_context_await_suspension_state_start_task_handler,
|
||||||
.event_handler = scic_sds_remote_node_context_await_suspension_state_event_handler
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1172,3 +916,110 @@ void scic_sds_remote_node_context_construct(struct scic_sds_remote_node_context
|
||||||
|
|
||||||
sci_base_state_machine_start(&rnc->state_machine);
|
sci_base_state_machine_start(&rnc->state_machine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remote_node_context *sci_rnc,
|
||||||
|
u32 event_code)
|
||||||
|
{
|
||||||
|
enum scis_sds_remote_node_context_states state;
|
||||||
|
|
||||||
|
state = sci_rnc->state_machine.current_state_id;
|
||||||
|
switch (state) {
|
||||||
|
case SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE:
|
||||||
|
switch (scu_get_event_code(event_code)) {
|
||||||
|
case SCU_EVENT_POST_RNC_COMPLETE:
|
||||||
|
sci_base_state_machine_change_state(&sci_rnc->state_machine,
|
||||||
|
SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE:
|
||||||
|
if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) {
|
||||||
|
if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL)
|
||||||
|
state = SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE;
|
||||||
|
else
|
||||||
|
state = SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE;
|
||||||
|
sci_base_state_machine_change_state(&sci_rnc->state_machine,
|
||||||
|
state);
|
||||||
|
} else {
|
||||||
|
switch (scu_get_event_type(event_code)) {
|
||||||
|
case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
|
||||||
|
case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
|
||||||
|
/* We really dont care if the hardware is going to suspend
|
||||||
|
* the device since it's being invalidated anyway */
|
||||||
|
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
||||||
|
"%s: SCIC Remote Node Context 0x%p was "
|
||||||
|
"suspeneded by hardware while being "
|
||||||
|
"invalidated.\n", __func__, sci_rnc);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE:
|
||||||
|
if (scu_get_event_code(event_code) == SCU_EVENT_POST_RCN_RELEASE) {
|
||||||
|
sci_base_state_machine_change_state(&sci_rnc->state_machine,
|
||||||
|
SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE);
|
||||||
|
} else {
|
||||||
|
switch (scu_get_event_type(event_code)) {
|
||||||
|
case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
|
||||||
|
case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
|
||||||
|
/* We really dont care if the hardware is going to suspend
|
||||||
|
* the device since it's being resumed anyway */
|
||||||
|
dev_dbg(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
||||||
|
"%s: SCIC Remote Node Context 0x%p was "
|
||||||
|
"suspeneded by hardware while being resumed.\n",
|
||||||
|
__func__, sci_rnc);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE:
|
||||||
|
switch (scu_get_event_type(event_code)) {
|
||||||
|
case SCU_EVENT_TL_RNC_SUSPEND_TX:
|
||||||
|
sci_base_state_machine_change_state(&sci_rnc->state_machine,
|
||||||
|
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE);
|
||||||
|
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
||||||
|
break;
|
||||||
|
case SCU_EVENT_TL_RNC_SUSPEND_TX_RX:
|
||||||
|
sci_base_state_machine_change_state(&sci_rnc->state_machine,
|
||||||
|
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE);
|
||||||
|
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE:
|
||||||
|
switch (scu_get_event_type(event_code)) {
|
||||||
|
case SCU_EVENT_TL_RNC_SUSPEND_TX:
|
||||||
|
sci_base_state_machine_change_state(&sci_rnc->state_machine,
|
||||||
|
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE);
|
||||||
|
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
||||||
|
break;
|
||||||
|
case SCU_EVENT_TL_RNC_SUSPEND_TX_RX:
|
||||||
|
sci_base_state_machine_change_state(&sci_rnc->state_machine,
|
||||||
|
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE);
|
||||||
|
sci_rnc->suspension_code = scu_get_event_specifier(event_code);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
||||||
|
"%s: invalid state %d\n", __func__, state);
|
||||||
|
return SCI_FAILURE_INVALID_STATE;
|
||||||
|
}
|
||||||
|
return SCI_SUCCESS;
|
||||||
|
|
||||||
|
out:
|
||||||
|
dev_warn(scirdev_to_dev(rnc_to_dev(sci_rnc)),
|
||||||
|
"%s: code: %#x state: %d\n", __func__, event_code, state);
|
||||||
|
return SCI_FAILURE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -102,11 +102,6 @@ typedef enum sci_status (*scic_sds_remote_node_context_io_request)(
|
||||||
struct scic_sds_request *sci_req
|
struct scic_sds_request *sci_req
|
||||||
);
|
);
|
||||||
|
|
||||||
typedef enum sci_status (*scic_sds_remote_node_context_event_handler)(
|
|
||||||
struct scic_sds_remote_node_context *sci_rnc,
|
|
||||||
u32 event_code
|
|
||||||
);
|
|
||||||
|
|
||||||
struct scic_sds_remote_node_context_handlers {
|
struct scic_sds_remote_node_context_handlers {
|
||||||
/**
|
/**
|
||||||
* This handle is invoked to stop the RNC. The callback is invoked when after
|
* This handle is invoked to stop the RNC. The callback is invoked when after
|
||||||
|
@ -138,12 +133,6 @@ struct scic_sds_remote_node_context_handlers {
|
||||||
* operation.
|
* operation.
|
||||||
*/
|
*/
|
||||||
scic_sds_remote_node_context_io_request start_task_handler;
|
scic_sds_remote_node_context_io_request start_task_handler;
|
||||||
|
|
||||||
/**
|
|
||||||
* This handler is invoked where there is an RNC event that must be processed.
|
|
||||||
*/
|
|
||||||
scic_sds_remote_node_context_event_handler event_handler;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -271,8 +260,9 @@ bool scic_sds_remote_node_context_is_ready(
|
||||||
#define scic_sds_remote_node_context_get_remote_node_index(rcn) \
|
#define scic_sds_remote_node_context_get_remote_node_index(rcn) \
|
||||||
((rnc)->remote_node_index)
|
((rnc)->remote_node_index)
|
||||||
|
|
||||||
#define scic_sds_remote_node_context_event_handler(rnc, event_code) \
|
|
||||||
((rnc)->state_handlers->event_handler(rnc, event_code))
|
enum sci_status scic_sds_remote_node_context_event_handler(struct scic_sds_remote_node_context *sci_rnc,
|
||||||
|
u32 event_code);
|
||||||
|
|
||||||
#define scic_sds_remote_node_context_resume(rnc, callback, parameter) \
|
#define scic_sds_remote_node_context_resume(rnc, callback, parameter) \
|
||||||
((rnc)->state_handlers->resume_handler(rnc, callback, parameter))
|
((rnc)->state_handlers->resume_handler(rnc, callback, parameter))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue