提交 e2023b87 编写于 作者: D Dave Jiang 提交者: Dan Williams

isci: replace this_* and the_* variables with more meaningful names

Removed any instances of the_* and this_* to variable names that are more
meaningful and tell us what they actually are.
Signed-off-by: NDave Jiang <dave.jiang@intel.com>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
上级 2d70de5a
...@@ -73,8 +73,8 @@ ...@@ -73,8 +73,8 @@
* *
* Private operation for the pool * Private operation for the pool
*/ */
#define SCI_POOL_INCREMENT(this_pool, index) \ #define SCI_POOL_INCREMENT(pool, index) \
(((index) + 1) == (this_pool).size ? 0 : (index) + 1) (((index) + 1) == (pool).size ? 0 : (index) + 1)
/** /**
* SCI_POOL_CREATE() - * SCI_POOL_CREATE() -
...@@ -98,8 +98,8 @@ ...@@ -98,8 +98,8 @@
* This macro evaluates the pool and returns true if the pool is empty. If the * This macro evaluates the pool and returns true if the pool is empty. If the
* pool is empty the user should not perform any get operation on the pool. * pool is empty the user should not perform any get operation on the pool.
*/ */
#define sci_pool_empty(this_pool) \ #define sci_pool_empty(pool) \
((this_pool).get == (this_pool).put) ((pool).get == (pool).put)
/** /**
* sci_pool_full() - * sci_pool_full() -
...@@ -107,8 +107,8 @@ ...@@ -107,8 +107,8 @@
* This macro evaluates the pool and returns true if the pool is full. If the * This macro evaluates the pool and returns true if the pool is full. If the
* pool is full the user should not perform any put operation. * pool is full the user should not perform any put operation.
*/ */
#define sci_pool_full(this_pool) \ #define sci_pool_full(pool) \
(SCI_POOL_INCREMENT(this_pool, (this_pool).put) == (this_pool).get) (SCI_POOL_INCREMENT(pool, (pool).put) == (pool).get)
/** /**
* sci_pool_size() - * sci_pool_size() -
...@@ -118,25 +118,25 @@ ...@@ -118,25 +118,25 @@
* pointers can be written simultaneously by different users. As a result, * pointers can be written simultaneously by different users. As a result,
* this macro subtracts 1 from the internal size * this macro subtracts 1 from the internal size
*/ */
#define sci_pool_size(this_pool) \ #define sci_pool_size(pool) \
((this_pool).size - 1) ((pool).size - 1)
/** /**
* sci_pool_count() - * sci_pool_count() -
* *
* This macro indicates the number of elements currently contained in the pool. * This macro indicates the number of elements currently contained in the pool.
*/ */
#define sci_pool_count(this_pool) \ #define sci_pool_count(pool) \
(\ (\
sci_pool_empty((this_pool)) \ sci_pool_empty((pool)) \
? 0 \ ? 0 \
: (\ : (\
sci_pool_full((this_pool)) \ sci_pool_full((pool)) \
? sci_pool_size((this_pool)) \ ? sci_pool_size((pool)) \
: (\ : (\
(this_pool).get > (this_pool).put \ (pool).get > (pool).put \
? ((this_pool).size - (this_pool).get + (this_pool).put) \ ? ((pool).size - (pool).get + (pool).put) \
: ((this_pool).put - (this_pool).get) \ : ((pool).put - (pool).get) \
) \ ) \
) \ ) \
) )
...@@ -146,11 +146,11 @@ ...@@ -146,11 +146,11 @@
* *
* This macro initializes the pool to an empty condition. * This macro initializes the pool to an empty condition.
*/ */
#define sci_pool_initialize(this_pool) \ #define sci_pool_initialize(pool) \
{ \ { \
(this_pool).size = (sizeof((this_pool).array) / sizeof((this_pool).array[0])); \ (pool).size = (sizeof((pool).array) / sizeof((pool).array[0])); \
(this_pool).get = 0; \ (pool).get = 0; \
(this_pool).put = 0; \ (pool).put = 0; \
} }
/** /**
...@@ -159,10 +159,10 @@ ...@@ -159,10 +159,10 @@
* This macro will get the next free element from the pool. This should only be * This macro will get the next free element from the pool. This should only be
* called if the pool is not empty. * called if the pool is not empty.
*/ */
#define sci_pool_get(this_pool, my_value) \ #define sci_pool_get(pool, my_value) \
{ \ { \
(my_value) = (this_pool).array[(this_pool).get]; \ (my_value) = (pool).array[(pool).get]; \
(this_pool).get = SCI_POOL_INCREMENT((this_pool), (this_pool).get); \ (pool).get = SCI_POOL_INCREMENT((pool), (pool).get); \
} }
/** /**
...@@ -171,10 +171,10 @@ ...@@ -171,10 +171,10 @@
* This macro will put the value into the pool. This should only be called if * This macro will put the value into the pool. This should only be called if
* the pool is not full. * the pool is not full.
*/ */
#define sci_pool_put(this_pool, the_value) \ #define sci_pool_put(pool, value) \
{ \ { \
(this_pool).array[(this_pool).put] = (the_value); \ (pool).array[(pool).put] = (value); \
(this_pool).put = SCI_POOL_INCREMENT((this_pool), (this_pool).put); \ (pool).put = SCI_POOL_INCREMENT((pool), (pool).put); \
} }
/** /**
...@@ -183,16 +183,16 @@ ...@@ -183,16 +183,16 @@
* This macro will search the pool and remove any elements in the pool matching * This macro will search the pool and remove any elements in the pool matching
* the supplied value. This method can only be utilized on pools * the supplied value. This method can only be utilized on pools
*/ */
#define sci_pool_erase(this_pool, type, the_value) \ #define sci_pool_erase(pool, type, value) \
{ \ { \
type tmp_value; \ type tmp_value; \
u32 index; \ u32 index; \
u32 element_count = sci_pool_count((this_pool)); \ u32 element_count = sci_pool_count((pool)); \
\ \
for (index = 0; index < element_count; index++) { \ for (index = 0; index < element_count; index++) { \
sci_pool_get((this_pool), tmp_value); \ sci_pool_get((pool), tmp_value); \
if (tmp_value != (the_value)) \ if (tmp_value != (value)) \
sci_pool_put((this_pool), tmp_value); \ sci_pool_put((pool), tmp_value); \
} \ } \
} }
......
...@@ -290,7 +290,7 @@ int scic_controller_mem_init(struct scic_sds_controller *scic) ...@@ -290,7 +290,7 @@ int scic_controller_mem_init(struct scic_sds_controller *scic)
/** /**
* This method initializes the task context data for the controller. * This method initializes the task context data for the controller.
* @this_controller: * @scic:
* *
*/ */
static void static void
...@@ -321,22 +321,22 @@ scic_sds_controller_assign_task_entries(struct scic_sds_controller *controller) ...@@ -321,22 +321,22 @@ scic_sds_controller_assign_task_entries(struct scic_sds_controller *controller)
* *
*/ */
static void scic_sds_controller_initialize_completion_queue( static void scic_sds_controller_initialize_completion_queue(
struct scic_sds_controller *this_controller) struct scic_sds_controller *scic)
{ {
u32 index; u32 index;
u32 completion_queue_control_value; u32 completion_queue_control_value;
u32 completion_queue_get_value; u32 completion_queue_get_value;
u32 completion_queue_put_value; u32 completion_queue_put_value;
this_controller->completion_queue_get = 0; scic->completion_queue_get = 0;
completion_queue_control_value = ( completion_queue_control_value = (
SMU_CQC_QUEUE_LIMIT_SET(this_controller->completion_queue_entries - 1) SMU_CQC_QUEUE_LIMIT_SET(scic->completion_queue_entries - 1)
| SMU_CQC_EVENT_LIMIT_SET(this_controller->completion_event_entries - 1) | SMU_CQC_EVENT_LIMIT_SET(scic->completion_event_entries - 1)
); );
writel(completion_queue_control_value, writel(completion_queue_control_value,
&this_controller->smu_registers->completion_queue_control); &scic->smu_registers->completion_queue_control);
/* Set the completion queue get pointer and enable the queue */ /* Set the completion queue get pointer and enable the queue */
...@@ -348,7 +348,7 @@ static void scic_sds_controller_initialize_completion_queue( ...@@ -348,7 +348,7 @@ static void scic_sds_controller_initialize_completion_queue(
); );
writel(completion_queue_get_value, writel(completion_queue_get_value,
&this_controller->smu_registers->completion_queue_get); &scic->smu_registers->completion_queue_get);
/* Set the completion queue put pointer */ /* Set the completion queue put pointer */
completion_queue_put_value = ( completion_queue_put_value = (
...@@ -357,16 +357,15 @@ static void scic_sds_controller_initialize_completion_queue( ...@@ -357,16 +357,15 @@ static void scic_sds_controller_initialize_completion_queue(
); );
writel(completion_queue_put_value, writel(completion_queue_put_value,
&this_controller->smu_registers->completion_queue_put); &scic->smu_registers->completion_queue_put);
/* Initialize the cycle bit of the completion queue entries */ /* Initialize the cycle bit of the completion queue entries */
for (index = 0; index < this_controller->completion_queue_entries; index++) { for (index = 0; index < scic->completion_queue_entries; index++) {
/* /*
* If get.cycle_bit != completion_queue.cycle_bit * If get.cycle_bit != completion_queue.cycle_bit
* its not a valid completion queue entry * its not a valid completion queue entry
* so at system start all entries are invalid */ * so at system start all entries are invalid */
this_controller->completion_queue[index] = 0x80000000; scic->completion_queue[index] = 0x80000000;
} }
} }
...@@ -376,7 +375,7 @@ static void scic_sds_controller_initialize_completion_queue( ...@@ -376,7 +375,7 @@ static void scic_sds_controller_initialize_completion_queue(
* *
*/ */
static void scic_sds_controller_initialize_unsolicited_frame_queue( static void scic_sds_controller_initialize_unsolicited_frame_queue(
struct scic_sds_controller *this_controller) struct scic_sds_controller *scic)
{ {
u32 frame_queue_control_value; u32 frame_queue_control_value;
u32 frame_queue_get_value; u32 frame_queue_get_value;
...@@ -384,10 +383,11 @@ static void scic_sds_controller_initialize_unsolicited_frame_queue( ...@@ -384,10 +383,11 @@ static void scic_sds_controller_initialize_unsolicited_frame_queue(
/* Write the queue size */ /* Write the queue size */
frame_queue_control_value = frame_queue_control_value =
SCU_UFQC_GEN_VAL(QUEUE_SIZE, this_controller->uf_control.address_table.count); SCU_UFQC_GEN_VAL(QUEUE_SIZE,
scic->uf_control.address_table.count);
writel(frame_queue_control_value, writel(frame_queue_control_value,
&this_controller->scu_registers->sdma.unsolicited_frame_queue_control); &scic->scu_registers->sdma.unsolicited_frame_queue_control);
/* Setup the get pointer for the unsolicited frame queue */ /* Setup the get pointer for the unsolicited frame queue */
frame_queue_get_value = ( frame_queue_get_value = (
...@@ -396,11 +396,11 @@ static void scic_sds_controller_initialize_unsolicited_frame_queue( ...@@ -396,11 +396,11 @@ static void scic_sds_controller_initialize_unsolicited_frame_queue(
); );
writel(frame_queue_get_value, writel(frame_queue_get_value,
&this_controller->scu_registers->sdma.unsolicited_frame_get_pointer); &scic->scu_registers->sdma.unsolicited_frame_get_pointer);
/* Setup the put pointer for the unsolicited frame queue */ /* Setup the put pointer for the unsolicited frame queue */
frame_queue_put_value = SCU_UFQPP_GEN_VAL(POINTER, 0); frame_queue_put_value = SCU_UFQPP_GEN_VAL(POINTER, 0);
writel(frame_queue_put_value, writel(frame_queue_put_value,
&this_controller->scu_registers->sdma.unsolicited_frame_put_pointer); &scic->scu_registers->sdma.unsolicited_frame_put_pointer);
} }
/** /**
...@@ -409,16 +409,17 @@ static void scic_sds_controller_initialize_unsolicited_frame_queue( ...@@ -409,16 +409,17 @@ static void scic_sds_controller_initialize_unsolicited_frame_queue(
* *
*/ */
static void scic_sds_controller_enable_port_task_scheduler( static void scic_sds_controller_enable_port_task_scheduler(
struct scic_sds_controller *this_controller) struct scic_sds_controller *scic)
{ {
u32 port_task_scheduler_value; u32 port_task_scheduler_value;
port_task_scheduler_value = port_task_scheduler_value =
readl(&this_controller->scu_registers->peg0.ptsg.control); readl(&scic->scu_registers->peg0.ptsg.control);
port_task_scheduler_value |= port_task_scheduler_value |=
(SCU_PTSGCR_GEN_BIT(ETM_ENABLE) | SCU_PTSGCR_GEN_BIT(PTSG_ENABLE)); (SCU_PTSGCR_GEN_BIT(ETM_ENABLE) |
SCU_PTSGCR_GEN_BIT(PTSG_ENABLE));
writel(port_task_scheduler_value, writel(port_task_scheduler_value,
&this_controller->scu_registers->peg0.ptsg.control); &scic->scu_registers->peg0.ptsg.control);
} }
/** /**
...@@ -564,7 +565,7 @@ static void scic_sds_controller_afe_initialization(struct scic_sds_controller *s ...@@ -564,7 +565,7 @@ static void scic_sds_controller_afe_initialization(struct scic_sds_controller *s
* This method will attempt to transition into the ready state for the * This method will attempt to transition into the ready state for the
* controller and indicate that the controller start operation has completed * controller and indicate that the controller start operation has completed
* if all criteria are met. * if all criteria are met.
* @this_controller: This parameter indicates the controller object for which * @scic: This parameter indicates the controller object for which
* to transition to ready. * to transition to ready.
* @status: This parameter indicates the status value to be pass into the call * @status: This parameter indicates the status value to be pass into the call
* to scic_cb_controller_start_complete(). * to scic_cb_controller_start_complete().
...@@ -858,30 +859,30 @@ static void scic_sds_controller_power_control_timer_restart(struct scic_sds_cont ...@@ -858,30 +859,30 @@ static void scic_sds_controller_power_control_timer_restart(struct scic_sds_cont
static void scic_sds_controller_power_control_timer_handler( static void scic_sds_controller_power_control_timer_handler(
void *controller) void *controller)
{ {
struct scic_sds_controller *this_controller; struct scic_sds_controller *scic;
this_controller = (struct scic_sds_controller *)controller; scic = (struct scic_sds_controller *)controller;
this_controller->power_control.phys_granted_power = 0; scic->power_control.phys_granted_power = 0;
if (this_controller->power_control.phys_waiting == 0) { if (scic->power_control.phys_waiting == 0) {
this_controller->power_control.timer_started = false; scic->power_control.timer_started = false;
} else { } else {
struct scic_sds_phy *the_phy = NULL; struct scic_sds_phy *sci_phy = NULL;
u8 i; u8 i;
for (i = 0; for (i = 0;
(i < SCI_MAX_PHYS) (i < SCI_MAX_PHYS)
&& (this_controller->power_control.phys_waiting != 0); && (scic->power_control.phys_waiting != 0);
i++) { i++) {
if (this_controller->power_control.requesters[i] != NULL) { if (scic->power_control.requesters[i] != NULL) {
if (this_controller->power_control.phys_granted_power < if (scic->power_control.phys_granted_power <
this_controller->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) { scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) {
the_phy = this_controller->power_control.requesters[i]; sci_phy = scic->power_control.requesters[i];
this_controller->power_control.requesters[i] = NULL; scic->power_control.requesters[i] = NULL;
this_controller->power_control.phys_waiting--; scic->power_control.phys_waiting--;
this_controller->power_control.phys_granted_power++; scic->power_control.phys_granted_power++;
scic_sds_phy_consume_power_handler(the_phy); scic_sds_phy_consume_power_handler(sci_phy);
} else { } else {
break; break;
} }
...@@ -892,56 +893,56 @@ static void scic_sds_controller_power_control_timer_handler( ...@@ -892,56 +893,56 @@ static void scic_sds_controller_power_control_timer_handler(
* It doesn't matter if the power list is empty, we need to start the * It doesn't matter if the power list is empty, we need to start the
* timer in case another phy becomes ready. * timer in case another phy becomes ready.
*/ */
scic_sds_controller_power_control_timer_start(this_controller); scic_sds_controller_power_control_timer_start(scic);
} }
} }
/** /**
* This method inserts the phy in the stagger spinup control queue. * This method inserts the phy in the stagger spinup control queue.
* @this_controller: * @scic:
* *
* *
*/ */
void scic_sds_controller_power_control_queue_insert( void scic_sds_controller_power_control_queue_insert(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
BUG_ON(the_phy == NULL); BUG_ON(sci_phy == NULL);
if (this_controller->power_control.phys_granted_power < if (scic->power_control.phys_granted_power <
this_controller->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) { scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) {
this_controller->power_control.phys_granted_power++; scic->power_control.phys_granted_power++;
scic_sds_phy_consume_power_handler(the_phy); scic_sds_phy_consume_power_handler(sci_phy);
/* /*
* stop and start the power_control timer. When the timer fires, the * stop and start the power_control timer. When the timer fires, the
* no_of_phys_granted_power will be set to 0 * no_of_phys_granted_power will be set to 0
*/ */
scic_sds_controller_power_control_timer_restart(this_controller); scic_sds_controller_power_control_timer_restart(scic);
} else { } else {
/* Add the phy in the waiting list */ /* Add the phy in the waiting list */
this_controller->power_control.requesters[the_phy->phy_index] = the_phy; scic->power_control.requesters[sci_phy->phy_index] = sci_phy;
this_controller->power_control.phys_waiting++; scic->power_control.phys_waiting++;
} }
} }
/** /**
* This method removes the phy from the stagger spinup control queue. * This method removes the phy from the stagger spinup control queue.
* @this_controller: * @scic:
* *
* *
*/ */
void scic_sds_controller_power_control_queue_remove( void scic_sds_controller_power_control_queue_remove(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
BUG_ON(the_phy == NULL); BUG_ON(sci_phy == NULL);
if (this_controller->power_control.requesters[the_phy->phy_index] != NULL) { if (scic->power_control.requesters[sci_phy->phy_index] != NULL) {
this_controller->power_control.phys_waiting--; scic->power_control.phys_waiting--;
} }
this_controller->power_control.requesters[the_phy->phy_index] = NULL; scic->power_control.requesters[sci_phy->phy_index] = NULL;
} }
/* /*
...@@ -952,23 +953,20 @@ void scic_sds_controller_power_control_queue_remove( ...@@ -952,23 +953,20 @@ void scic_sds_controller_power_control_queue_remove(
/** /**
* This method returns a true value if the completion queue has entries that * This method returns a true value if the completion queue has entries that
* can be processed * can be processed
* @this_controller: * @scic:
* *
* bool true if the completion queue has entries to process false if the * bool true if the completion queue has entries to process false if the
* completion queue has no entries to process * completion queue has no entries to process
*/ */
static bool scic_sds_controller_completion_queue_has_entries( static bool scic_sds_controller_completion_queue_has_entries(
struct scic_sds_controller *this_controller) struct scic_sds_controller *scic)
{ {
u32 get_value = this_controller->completion_queue_get; u32 get_value = scic->completion_queue_get;
u32 get_index = get_value & SMU_COMPLETION_QUEUE_GET_POINTER_MASK; u32 get_index = get_value & SMU_COMPLETION_QUEUE_GET_POINTER_MASK;
if ( if (NORMALIZE_GET_POINTER_CYCLE_BIT(get_value) ==
NORMALIZE_GET_POINTER_CYCLE_BIT(get_value) COMPLETION_QUEUE_CYCLE_BIT(scic->completion_queue[get_index]))
== COMPLETION_QUEUE_CYCLE_BIT(this_controller->completion_queue[get_index])
) {
return true; return true;
}
return false; return false;
} }
...@@ -976,19 +974,19 @@ static bool scic_sds_controller_completion_queue_has_entries( ...@@ -976,19 +974,19 @@ static bool scic_sds_controller_completion_queue_has_entries(
/** /**
* This method processes a task completion notification. This is called from * This method processes a task completion notification. This is called from
* within the controller completion handler. * within the controller completion handler.
* @this_controller: * @scic:
* @completion_entry: * @completion_entry:
* *
*/ */
static void scic_sds_controller_task_completion( static void scic_sds_controller_task_completion(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u32 completion_entry) u32 completion_entry)
{ {
u32 index; u32 index;
struct scic_sds_request *io_request; struct scic_sds_request *io_request;
index = SCU_GET_COMPLETION_INDEX(completion_entry); index = SCU_GET_COMPLETION_INDEX(completion_entry);
io_request = this_controller->io_request_table[index]; io_request = scic->io_request_table[index];
/* Make sure that we really want to process this IO request */ /* Make sure that we really want to process this IO request */
if ( if (
...@@ -996,7 +994,7 @@ static void scic_sds_controller_task_completion( ...@@ -996,7 +994,7 @@ static void scic_sds_controller_task_completion(
&& (io_request->io_tag != SCI_CONTROLLER_INVALID_IO_TAG) && (io_request->io_tag != SCI_CONTROLLER_INVALID_IO_TAG)
&& ( && (
scic_sds_io_tag_get_sequence(io_request->io_tag) scic_sds_io_tag_get_sequence(io_request->io_tag)
== this_controller->io_request_sequence[index] == scic->io_request_sequence[index]
) )
) { ) {
/* Yep this is a valid io request pass it along to the io request handler */ /* Yep this is a valid io request pass it along to the io request handler */
...@@ -1007,12 +1005,12 @@ static void scic_sds_controller_task_completion( ...@@ -1007,12 +1005,12 @@ static void scic_sds_controller_task_completion(
/** /**
* This method processes an SDMA completion event. This is called from within * This method processes an SDMA completion event. This is called from within
* the controller completion handler. * the controller completion handler.
* @this_controller: * @scic:
* @completion_entry: * @completion_entry:
* *
*/ */
static void scic_sds_controller_sdma_completion( static void scic_sds_controller_sdma_completion(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u32 completion_entry) u32 completion_entry)
{ {
u32 index; u32 index;
...@@ -1024,8 +1022,8 @@ static void scic_sds_controller_sdma_completion( ...@@ -1024,8 +1022,8 @@ static void scic_sds_controller_sdma_completion(
switch (scu_get_command_request_type(completion_entry)) { switch (scu_get_command_request_type(completion_entry)) {
case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC: case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC:
case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC: case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC:
io_request = this_controller->io_request_table[index]; io_request = scic->io_request_table[index];
dev_warn(scic_to_dev(this_controller), dev_warn(scic_to_dev(scic),
"%s: SCIC SDS Completion type SDMA %x for io request " "%s: SCIC SDS Completion type SDMA %x for io request "
"%p\n", "%p\n",
__func__, __func__,
...@@ -1039,8 +1037,8 @@ static void scic_sds_controller_sdma_completion( ...@@ -1039,8 +1037,8 @@ static void scic_sds_controller_sdma_completion(
case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC: case SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC:
case SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC: case SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC:
case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC: case SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC:
device = this_controller->device_table[index]; device = scic->device_table[index];
dev_warn(scic_to_dev(this_controller), dev_warn(scic_to_dev(scic),
"%s: SCIC SDS Completion type SDMA %x for remote " "%s: SCIC SDS Completion type SDMA %x for remote "
"device %p\n", "device %p\n",
__func__, __func__,
...@@ -1052,7 +1050,7 @@ static void scic_sds_controller_sdma_completion( ...@@ -1052,7 +1050,7 @@ static void scic_sds_controller_sdma_completion(
break; break;
default: default:
dev_warn(scic_to_dev(this_controller), dev_warn(scic_to_dev(scic),
"%s: SCIC SDS Completion unknown SDMA completion " "%s: SCIC SDS Completion unknown SDMA completion "
"type %x\n", "type %x\n",
__func__, __func__,
...@@ -1064,14 +1062,14 @@ static void scic_sds_controller_sdma_completion( ...@@ -1064,14 +1062,14 @@ static void scic_sds_controller_sdma_completion(
/** /**
* *
* @this_controller: * @scic:
* @completion_entry: * @completion_entry:
* *
* This method processes an unsolicited frame message. This is called from * This method processes an unsolicited frame message. This is called from
* within the controller completion handler. none * within the controller completion handler. none
*/ */
static void scic_sds_controller_unsolicited_frame( static void scic_sds_controller_unsolicited_frame(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u32 completion_entry) u32 completion_entry)
{ {
u32 index; u32 index;
...@@ -1086,8 +1084,8 @@ static void scic_sds_controller_unsolicited_frame( ...@@ -1086,8 +1084,8 @@ static void scic_sds_controller_unsolicited_frame(
frame_index = SCU_GET_FRAME_INDEX(completion_entry); frame_index = SCU_GET_FRAME_INDEX(completion_entry);
frame_header frame_header
= this_controller->uf_control.buffers.array[frame_index].header; = scic->uf_control.buffers.array[frame_index].header;
this_controller->uf_control.buffers.array[frame_index].state scic->uf_control.buffers.array[frame_index].state
= UNSOLICITED_FRAME_IN_USE; = UNSOLICITED_FRAME_IN_USE;
if (SCU_GET_FRAME_ERROR(completion_entry)) { if (SCU_GET_FRAME_ERROR(completion_entry)) {
...@@ -1095,13 +1093,13 @@ static void scic_sds_controller_unsolicited_frame( ...@@ -1095,13 +1093,13 @@ static void scic_sds_controller_unsolicited_frame(
* / @todo If the IAF frame or SIGNATURE FIS frame has an error will * / @todo If the IAF frame or SIGNATURE FIS frame has an error will
* / this cause a problem? We expect the phy initialization will * / this cause a problem? We expect the phy initialization will
* / fail if there is an error in the frame. */ * / fail if there is an error in the frame. */
scic_sds_controller_release_frame(this_controller, frame_index); scic_sds_controller_release_frame(scic, frame_index);
return; return;
} }
if (frame_header->is_address_frame) { if (frame_header->is_address_frame) {
index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry);
phy = &this_controller->phy_table[index]; phy = &scic->phy_table[index];
if (phy != NULL) { if (phy != NULL) {
result = scic_sds_phy_frame_handler(phy, frame_index); result = scic_sds_phy_frame_handler(phy, frame_index);
} }
...@@ -1115,18 +1113,18 @@ static void scic_sds_controller_unsolicited_frame( ...@@ -1115,18 +1113,18 @@ static void scic_sds_controller_unsolicited_frame(
* device that has not yet been created. In either case forwared * device that has not yet been created. In either case forwared
* the frame to the PE and let it take care of the frame data. */ * the frame to the PE and let it take care of the frame data. */
index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry);
phy = &this_controller->phy_table[index]; phy = &scic->phy_table[index];
result = scic_sds_phy_frame_handler(phy, frame_index); result = scic_sds_phy_frame_handler(phy, frame_index);
} else { } else {
if (index < this_controller->remote_node_entries) if (index < scic->remote_node_entries)
device = this_controller->device_table[index]; device = scic->device_table[index];
else else
device = NULL; device = NULL;
if (device != NULL) if (device != NULL)
result = scic_sds_remote_device_frame_handler(device, frame_index); result = scic_sds_remote_device_frame_handler(device, frame_index);
else else
scic_sds_controller_release_frame(this_controller, frame_index); scic_sds_controller_release_frame(scic, frame_index);
} }
} }
...@@ -1140,12 +1138,12 @@ static void scic_sds_controller_unsolicited_frame( ...@@ -1140,12 +1138,12 @@ static void scic_sds_controller_unsolicited_frame(
/** /**
* This method processes an event completion entry. This is called from within * This method processes an event completion entry. This is called from within
* the controller completion handler. * the controller completion handler.
* @this_controller: * @scic:
* @completion_entry: * @completion_entry:
* *
*/ */
static void scic_sds_controller_event_completion( static void scic_sds_controller_event_completion(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u32 completion_entry) u32 completion_entry)
{ {
u32 index; u32 index;
...@@ -1158,11 +1156,11 @@ static void scic_sds_controller_event_completion( ...@@ -1158,11 +1156,11 @@ static void scic_sds_controller_event_completion(
switch (scu_get_event_type(completion_entry)) { switch (scu_get_event_type(completion_entry)) {
case SCU_EVENT_TYPE_SMU_COMMAND_ERROR: case SCU_EVENT_TYPE_SMU_COMMAND_ERROR:
/* / @todo The driver did something wrong and we need to fix the condtion. */ /* / @todo The driver did something wrong and we need to fix the condtion. */
dev_err(scic_to_dev(this_controller), dev_err(scic_to_dev(scic),
"%s: SCIC Controller 0x%p received SMU command error " "%s: SCIC Controller 0x%p received SMU command error "
"0x%x\n", "0x%x\n",
__func__, __func__,
this_controller, scic,
completion_entry); completion_entry);
break; break;
...@@ -1172,16 +1170,16 @@ static void scic_sds_controller_event_completion( ...@@ -1172,16 +1170,16 @@ static void scic_sds_controller_event_completion(
/* /*
* / @todo This is a hardware failure and its likely that we want to * / @todo This is a hardware failure and its likely that we want to
* / reset the controller. */ * / reset the controller. */
dev_err(scic_to_dev(this_controller), dev_err(scic_to_dev(scic),
"%s: SCIC Controller 0x%p received fatal controller " "%s: SCIC Controller 0x%p received fatal controller "
"event 0x%x\n", "event 0x%x\n",
__func__, __func__,
this_controller, scic,
completion_entry); completion_entry);
break; break;
case SCU_EVENT_TYPE_TRANSPORT_ERROR: case SCU_EVENT_TYPE_TRANSPORT_ERROR:
io_request = this_controller->io_request_table[index]; io_request = scic->io_request_table[index];
scic_sds_io_request_event_handler(io_request, completion_entry); scic_sds_io_request_event_handler(io_request, completion_entry);
break; break;
...@@ -1189,31 +1187,31 @@ static void scic_sds_controller_event_completion( ...@@ -1189,31 +1187,31 @@ static void scic_sds_controller_event_completion(
switch (scu_get_event_specifier(completion_entry)) { switch (scu_get_event_specifier(completion_entry)) {
case SCU_EVENT_SPECIFIC_SMP_RESPONSE_NO_PE: case SCU_EVENT_SPECIFIC_SMP_RESPONSE_NO_PE:
case SCU_EVENT_SPECIFIC_TASK_TIMEOUT: case SCU_EVENT_SPECIFIC_TASK_TIMEOUT:
io_request = this_controller->io_request_table[index]; io_request = scic->io_request_table[index];
if (io_request != NULL) if (io_request != NULL)
scic_sds_io_request_event_handler(io_request, completion_entry); scic_sds_io_request_event_handler(io_request, completion_entry);
else else
dev_warn(scic_to_dev(this_controller), dev_warn(scic_to_dev(scic),
"%s: SCIC Controller 0x%p received " "%s: SCIC Controller 0x%p received "
"event 0x%x for io request object " "event 0x%x for io request object "
"that doesnt exist.\n", "that doesnt exist.\n",
__func__, __func__,
this_controller, scic,
completion_entry); completion_entry);
break; break;
case SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT: case SCU_EVENT_SPECIFIC_IT_NEXUS_TIMEOUT:
device = this_controller->device_table[index]; device = scic->device_table[index];
if (device != NULL) if (device != NULL)
scic_sds_remote_device_event_handler(device, completion_entry); scic_sds_remote_device_event_handler(device, completion_entry);
else else
dev_warn(scic_to_dev(this_controller), dev_warn(scic_to_dev(scic),
"%s: SCIC Controller 0x%p received " "%s: SCIC Controller 0x%p received "
"event 0x%x for remote device object " "event 0x%x for remote device object "
"that doesnt exist.\n", "that doesnt exist.\n",
__func__, __func__,
this_controller, scic,
completion_entry); completion_entry);
break; break;
...@@ -1230,32 +1228,32 @@ static void scic_sds_controller_event_completion( ...@@ -1230,32 +1228,32 @@ static void scic_sds_controller_event_completion(
* we get the event notification. This is a type 4 event. */ * we get the event notification. This is a type 4 event. */
case SCU_EVENT_TYPE_OSSP_EVENT: case SCU_EVENT_TYPE_OSSP_EVENT:
index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry); index = SCU_GET_PROTOCOL_ENGINE_INDEX(completion_entry);
phy = &this_controller->phy_table[index]; phy = &scic->phy_table[index];
scic_sds_phy_event_handler(phy, completion_entry); scic_sds_phy_event_handler(phy, completion_entry);
break; break;
case SCU_EVENT_TYPE_RNC_SUSPEND_TX: case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
case SCU_EVENT_TYPE_RNC_OPS_MISC: case SCU_EVENT_TYPE_RNC_OPS_MISC:
if (index < this_controller->remote_node_entries) { if (index < scic->remote_node_entries) {
device = this_controller->device_table[index]; device = scic->device_table[index];
if (device != NULL) if (device != NULL)
scic_sds_remote_device_event_handler(device, completion_entry); scic_sds_remote_device_event_handler(device, completion_entry);
} else } else
dev_err(scic_to_dev(this_controller), dev_err(scic_to_dev(scic),
"%s: SCIC Controller 0x%p received event 0x%x " "%s: SCIC Controller 0x%p received event 0x%x "
"for remote device object 0x%0x that doesnt " "for remote device object 0x%0x that doesnt "
"exist.\n", "exist.\n",
__func__, __func__,
this_controller, scic,
completion_entry, completion_entry,
index); index);
break; break;
default: default:
dev_warn(scic_to_dev(this_controller), dev_warn(scic_to_dev(scic),
"%s: SCIC Controller received unknown event code %x\n", "%s: SCIC Controller received unknown event code %x\n",
__func__, __func__,
completion_entry); completion_entry);
...@@ -1265,11 +1263,11 @@ static void scic_sds_controller_event_completion( ...@@ -1265,11 +1263,11 @@ static void scic_sds_controller_event_completion(
/** /**
* This method is a private routine for processing the completion queue entries. * This method is a private routine for processing the completion queue entries.
* @this_controller: * @scic:
* *
*/ */
static void scic_sds_controller_process_completions( static void scic_sds_controller_process_completions(
struct scic_sds_controller *this_controller) struct scic_sds_controller *scic)
{ {
u32 completion_count = 0; u32 completion_count = 0;
u32 completion_entry; u32 completion_entry;
...@@ -1278,60 +1276,60 @@ static void scic_sds_controller_process_completions( ...@@ -1278,60 +1276,60 @@ static void scic_sds_controller_process_completions(
u32 event_index; u32 event_index;
u32 event_cycle; u32 event_cycle;
dev_dbg(scic_to_dev(this_controller), dev_dbg(scic_to_dev(scic),
"%s: completion queue begining get:0x%08x\n", "%s: completion queue begining get:0x%08x\n",
__func__, __func__,
this_controller->completion_queue_get); scic->completion_queue_get);
/* Get the component parts of the completion queue */ /* Get the component parts of the completion queue */
get_index = NORMALIZE_GET_POINTER(this_controller->completion_queue_get); get_index = NORMALIZE_GET_POINTER(scic->completion_queue_get);
get_cycle = SMU_CQGR_CYCLE_BIT & this_controller->completion_queue_get; get_cycle = SMU_CQGR_CYCLE_BIT & scic->completion_queue_get;
event_index = NORMALIZE_EVENT_POINTER(this_controller->completion_queue_get); event_index = NORMALIZE_EVENT_POINTER(scic->completion_queue_get);
event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & this_controller->completion_queue_get; event_cycle = SMU_CQGR_EVENT_CYCLE_BIT & scic->completion_queue_get;
while ( while (
NORMALIZE_GET_POINTER_CYCLE_BIT(get_cycle) NORMALIZE_GET_POINTER_CYCLE_BIT(get_cycle)
== COMPLETION_QUEUE_CYCLE_BIT(this_controller->completion_queue[get_index]) == COMPLETION_QUEUE_CYCLE_BIT(scic->completion_queue[get_index])
) { ) {
completion_count++; completion_count++;
completion_entry = this_controller->completion_queue[get_index]; completion_entry = scic->completion_queue[get_index];
INCREMENT_COMPLETION_QUEUE_GET(this_controller, get_index, get_cycle); INCREMENT_COMPLETION_QUEUE_GET(scic, get_index, get_cycle);
dev_dbg(scic_to_dev(this_controller), dev_dbg(scic_to_dev(scic),
"%s: completion queue entry:0x%08x\n", "%s: completion queue entry:0x%08x\n",
__func__, __func__,
completion_entry); completion_entry);
switch (SCU_GET_COMPLETION_TYPE(completion_entry)) { switch (SCU_GET_COMPLETION_TYPE(completion_entry)) {
case SCU_COMPLETION_TYPE_TASK: case SCU_COMPLETION_TYPE_TASK:
scic_sds_controller_task_completion(this_controller, completion_entry); scic_sds_controller_task_completion(scic, completion_entry);
break; break;
case SCU_COMPLETION_TYPE_SDMA: case SCU_COMPLETION_TYPE_SDMA:
scic_sds_controller_sdma_completion(this_controller, completion_entry); scic_sds_controller_sdma_completion(scic, completion_entry);
break; break;
case SCU_COMPLETION_TYPE_UFI: case SCU_COMPLETION_TYPE_UFI:
scic_sds_controller_unsolicited_frame(this_controller, completion_entry); scic_sds_controller_unsolicited_frame(scic, completion_entry);
break; break;
case SCU_COMPLETION_TYPE_EVENT: case SCU_COMPLETION_TYPE_EVENT:
INCREMENT_EVENT_QUEUE_GET(this_controller, event_index, event_cycle); INCREMENT_EVENT_QUEUE_GET(scic, event_index, event_cycle);
scic_sds_controller_event_completion(this_controller, completion_entry); scic_sds_controller_event_completion(scic, completion_entry);
break; break;
case SCU_COMPLETION_TYPE_NOTIFY: case SCU_COMPLETION_TYPE_NOTIFY:
/* /*
* Presently we do the same thing with a notify event that we do with the * Presently we do the same thing with a notify event that we do with the
* other event codes. */ * other event codes. */
INCREMENT_EVENT_QUEUE_GET(this_controller, event_index, event_cycle); INCREMENT_EVENT_QUEUE_GET(scic, event_index, event_cycle);
scic_sds_controller_event_completion(this_controller, completion_entry); scic_sds_controller_event_completion(scic, completion_entry);
break; break;
default: default:
dev_warn(scic_to_dev(this_controller), dev_warn(scic_to_dev(scic),
"%s: SCIC Controller received unknown " "%s: SCIC Controller received unknown "
"completion type %x\n", "completion type %x\n",
__func__, __func__,
...@@ -1342,21 +1340,23 @@ static void scic_sds_controller_process_completions( ...@@ -1342,21 +1340,23 @@ static void scic_sds_controller_process_completions(
/* Update the get register if we completed one or more entries */ /* Update the get register if we completed one or more entries */
if (completion_count > 0) { if (completion_count > 0) {
this_controller->completion_queue_get = scic->completion_queue_get =
SMU_CQGR_GEN_BIT(ENABLE) SMU_CQGR_GEN_BIT(ENABLE) |
| SMU_CQGR_GEN_BIT(EVENT_ENABLE) SMU_CQGR_GEN_BIT(EVENT_ENABLE) |
| event_cycle | SMU_CQGR_GEN_VAL(EVENT_POINTER, event_index) event_cycle |
| get_cycle | SMU_CQGR_GEN_VAL(POINTER, get_index); SMU_CQGR_GEN_VAL(EVENT_POINTER, event_index) |
get_cycle |
SMU_CQGR_GEN_VAL(POINTER, get_index);
writel(this_controller->completion_queue_get, writel(scic->completion_queue_get,
&this_controller->smu_registers->completion_queue_get); &scic->smu_registers->completion_queue_get);
} }
dev_dbg(scic_to_dev(this_controller), dev_dbg(scic_to_dev(scic),
"%s: completion queue ending get:0x%08x\n", "%s: completion queue ending get:0x%08x\n",
__func__, __func__,
this_controller->completion_queue_get); scic->completion_queue_get);
} }
...@@ -1540,29 +1540,29 @@ void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic, ...@@ -1540,29 +1540,29 @@ void scic_sds_controller_remote_device_stopped(struct scic_sds_controller *scic,
/** /**
* This method will write to the SCU PCP register the request value. The method * This method will write to the SCU PCP register the request value. The method
* is used to suspend/resume ports, devices, and phys. * is used to suspend/resume ports, devices, and phys.
* @this_controller: * @scic:
* *
* *
*/ */
void scic_sds_controller_post_request( void scic_sds_controller_post_request(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u32 request) u32 request)
{ {
dev_dbg(scic_to_dev(this_controller), dev_dbg(scic_to_dev(scic),
"%s: SCIC Controller 0x%p post request 0x%08x\n", "%s: SCIC Controller 0x%p post request 0x%08x\n",
__func__, __func__,
this_controller, scic,
request); request);
writel(request, &this_controller->smu_registers->post_context_port); writel(request, &scic->smu_registers->post_context_port);
} }
/** /**
* This method will copy the soft copy of the task context into the physical * This method will copy the soft copy of the task context into the physical
* memory accessible by the controller. * memory accessible by the controller.
* @this_controller: This parameter specifies the controller for which to copy * @scic: This parameter specifies the controller for which to copy
* the task context. * the task context.
* @this_request: This parameter specifies the request for which the task * @sci_req: This parameter specifies the request for which the task
* context is being copied. * context is being copied.
* *
* After this call is made the SCIC_SDS_IO_REQUEST object will always point to * After this call is made the SCIC_SDS_IO_REQUEST object will always point to
...@@ -1571,43 +1571,40 @@ void scic_sds_controller_post_request( ...@@ -1571,43 +1571,40 @@ void scic_sds_controller_post_request(
* memory). none * memory). none
*/ */
void scic_sds_controller_copy_task_context( void scic_sds_controller_copy_task_context(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
struct scic_sds_request *this_request) struct scic_sds_request *sci_req)
{ {
struct scu_task_context *task_context_buffer; struct scu_task_context *task_context_buffer;
task_context_buffer = scic_sds_controller_get_task_context_buffer( task_context_buffer = scic_sds_controller_get_task_context_buffer(
this_controller, this_request->io_tag scic, sci_req->io_tag);
);
memcpy( memcpy(task_context_buffer,
task_context_buffer, sci_req->task_context_buffer,
this_request->task_context_buffer, SCI_FIELD_OFFSET(struct scu_task_context, sgl_snapshot_ac));
SCI_FIELD_OFFSET(struct scu_task_context, sgl_snapshot_ac)
);
/* /*
* Now that the soft copy of the TC has been copied into the TC * Now that the soft copy of the TC has been copied into the TC
* table accessible by the silicon. Thus, any further changes to * table accessible by the silicon. Thus, any further changes to
* the TC (e.g. TC termination) occur in the appropriate location. */ * the TC (e.g. TC termination) occur in the appropriate location. */
this_request->task_context_buffer = task_context_buffer; sci_req->task_context_buffer = task_context_buffer;
} }
/** /**
* This method returns the task context buffer for the given io tag. * This method returns the task context buffer for the given io tag.
* @this_controller: * @scic:
* @io_tag: * @io_tag:
* *
* struct scu_task_context* * struct scu_task_context*
*/ */
struct scu_task_context *scic_sds_controller_get_task_context_buffer( struct scu_task_context *scic_sds_controller_get_task_context_buffer(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u16 io_tag u16 io_tag
) { ) {
u16 task_index = scic_sds_io_tag_get_index(io_tag); u16 task_index = scic_sds_io_tag_get_index(io_tag);
if (task_index < this_controller->task_context_entries) { if (task_index < scic->task_context_entries) {
return &this_controller->task_context_table[task_index]; return &scic->task_context_table[task_index];
} }
return NULL; return NULL;
...@@ -1615,7 +1612,7 @@ struct scu_task_context *scic_sds_controller_get_task_context_buffer( ...@@ -1615,7 +1612,7 @@ struct scu_task_context *scic_sds_controller_get_task_context_buffer(
/** /**
* This method returnst the sequence value from the io tag value * This method returnst the sequence value from the io tag value
* @this_controller: * @scic:
* @io_tag: * @io_tag:
* *
* u16 * u16
...@@ -1623,13 +1620,13 @@ struct scu_task_context *scic_sds_controller_get_task_context_buffer( ...@@ -1623,13 +1620,13 @@ struct scu_task_context *scic_sds_controller_get_task_context_buffer(
/** /**
* This method returns the IO request associated with the tag value * This method returns the IO request associated with the tag value
* @this_controller: * @scic:
* @io_tag: * @io_tag:
* *
* SCIC_SDS_IO_REQUEST_T* NULL if there is no valid IO request at the tag value * SCIC_SDS_IO_REQUEST_T* NULL if there is no valid IO request at the tag value
*/ */
struct scic_sds_request *scic_sds_controller_get_io_request_from_tag( struct scic_sds_request *scic_sds_controller_get_io_request_from_tag(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u16 io_tag u16 io_tag
) { ) {
u16 task_index; u16 task_index;
...@@ -1637,12 +1634,12 @@ struct scic_sds_request *scic_sds_controller_get_io_request_from_tag( ...@@ -1637,12 +1634,12 @@ struct scic_sds_request *scic_sds_controller_get_io_request_from_tag(
task_index = scic_sds_io_tag_get_index(io_tag); task_index = scic_sds_io_tag_get_index(io_tag);
if (task_index < this_controller->task_context_entries) { if (task_index < scic->task_context_entries) {
if (this_controller->io_request_table[task_index] != NULL) { if (scic->io_request_table[task_index] != NULL) {
task_sequence = scic_sds_io_tag_get_sequence(io_tag); task_sequence = scic_sds_io_tag_get_sequence(io_tag);
if (task_sequence == this_controller->io_request_sequence[task_index]) { if (task_sequence == scic->io_request_sequence[task_index]) {
return this_controller->io_request_table[task_index]; return scic->io_request_table[task_index];
} }
} }
} }
...@@ -1654,9 +1651,9 @@ struct scic_sds_request *scic_sds_controller_get_io_request_from_tag( ...@@ -1654,9 +1651,9 @@ struct scic_sds_request *scic_sds_controller_get_io_request_from_tag(
* This method allocates remote node index and the reserves the remote node * This method allocates remote node index and the reserves the remote node
* context space for use. This method can fail if there are no more remote * context space for use. This method can fail if there are no more remote
* node index available. * node index available.
* @this_controller: This is the controller object which contains the set of * @scic: This is the controller object which contains the set of
* free remote node ids * free remote node ids
* @the_devce: This is the device object which is requesting the a remote node * @sci_dev: This is the device object which is requesting the a remote node
* id * id
* @node_id: This is the remote node id that is assinged to the device if one * @node_id: This is the remote node id that is assinged to the device if one
* is available * is available
...@@ -1665,19 +1662,19 @@ struct scic_sds_request *scic_sds_controller_get_io_request_from_tag( ...@@ -1665,19 +1662,19 @@ struct scic_sds_request *scic_sds_controller_get_io_request_from_tag(
* node index available. * node index available.
*/ */
enum sci_status scic_sds_controller_allocate_remote_node_context( enum sci_status scic_sds_controller_allocate_remote_node_context(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
u16 *node_id) u16 *node_id)
{ {
u16 node_index; u16 node_index;
u32 remote_node_count = scic_sds_remote_device_node_count(the_device); u32 remote_node_count = scic_sds_remote_device_node_count(sci_dev);
node_index = scic_sds_remote_node_table_allocate_remote_node( node_index = scic_sds_remote_node_table_allocate_remote_node(
&this_controller->available_remote_nodes, remote_node_count &scic->available_remote_nodes, remote_node_count
); );
if (node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) { if (node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) {
this_controller->device_table[node_index] = the_device; scic->device_table[node_index] = sci_dev;
*node_id = node_index; *node_id = node_index;
...@@ -1691,23 +1688,23 @@ enum sci_status scic_sds_controller_allocate_remote_node_context( ...@@ -1691,23 +1688,23 @@ enum sci_status scic_sds_controller_allocate_remote_node_context(
* This method frees the remote node index back to the available pool. Once * This method frees the remote node index back to the available pool. Once
* this is done the remote node context buffer is no longer valid and can * this is done the remote node context buffer is no longer valid and can
* not be used. * not be used.
* @this_controller: * @scic:
* @the_device: * @sci_dev:
* @node_id: * @node_id:
* *
*/ */
void scic_sds_controller_free_remote_node_context( void scic_sds_controller_free_remote_node_context(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
u16 node_id) u16 node_id)
{ {
u32 remote_node_count = scic_sds_remote_device_node_count(the_device); u32 remote_node_count = scic_sds_remote_device_node_count(sci_dev);
if (this_controller->device_table[node_id] == the_device) { if (scic->device_table[node_id] == sci_dev) {
this_controller->device_table[node_id] = NULL; scic->device_table[node_id] = NULL;
scic_sds_remote_node_table_release_remote_node_index( scic_sds_remote_node_table_release_remote_node_index(
&this_controller->available_remote_nodes, remote_node_count, node_id &scic->available_remote_nodes, remote_node_count, node_id
); );
} }
} }
...@@ -1715,20 +1712,20 @@ void scic_sds_controller_free_remote_node_context( ...@@ -1715,20 +1712,20 @@ void scic_sds_controller_free_remote_node_context(
/** /**
* This method returns the union scu_remote_node_context for the specified remote * This method returns the union scu_remote_node_context for the specified remote
* node id. * node id.
* @this_controller: * @scic:
* @node_id: * @node_id:
* *
* union scu_remote_node_context* * union scu_remote_node_context*
*/ */
union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u16 node_id u16 node_id
) { ) {
if ( if (
(node_id < this_controller->remote_node_entries) (node_id < scic->remote_node_entries)
&& (this_controller->device_table[node_id] != NULL) && (scic->device_table[node_id] != NULL)
) { ) {
return &this_controller->remote_node_context_table[node_id]; return &scic->remote_node_context_table[node_id];
} }
return NULL; return NULL;
...@@ -1767,18 +1764,18 @@ void scic_sds_controller_copy_sata_response( ...@@ -1767,18 +1764,18 @@ void scic_sds_controller_copy_sata_response(
* re-use by the hardware. The data contained in the frame header and frame * re-use by the hardware. The data contained in the frame header and frame
* buffer is no longer valid. The UF queue get pointer is only updated if UF * buffer is no longer valid. The UF queue get pointer is only updated if UF
* control indicates this is appropriate. * control indicates this is appropriate.
* @this_controller: * @scic:
* @frame_index: * @frame_index:
* *
*/ */
void scic_sds_controller_release_frame( void scic_sds_controller_release_frame(
struct scic_sds_controller *this_controller, struct scic_sds_controller *scic,
u32 frame_index) u32 frame_index)
{ {
if (scic_sds_unsolicited_frame_control_release_frame( if (scic_sds_unsolicited_frame_control_release_frame(
&this_controller->uf_control, frame_index) == true) &scic->uf_control, frame_index) == true)
writel(this_controller->uf_control.get, writel(scic->uf_control.get,
&this_controller->scu_registers->sdma.unsolicited_frame_get_pointer); &scic->scu_registers->sdma.unsolicited_frame_get_pointer);
} }
/** /**
...@@ -2888,11 +2885,11 @@ enum sci_status scic_controller_start(struct scic_sds_controller *scic, ...@@ -2888,11 +2885,11 @@ enum sci_status scic_controller_start(struct scic_sds_controller *scic,
static void scic_sds_controller_initial_state_enter( static void scic_sds_controller_initial_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_controller *this_controller; struct scic_sds_controller *scic;
this_controller = (struct scic_sds_controller *)object; scic = (struct scic_sds_controller *)object;
sci_base_state_machine_change_state(&this_controller->state_machine, sci_base_state_machine_change_state(&scic->state_machine,
SCI_BASE_CONTROLLER_STATE_RESET); SCI_BASE_CONTROLLER_STATE_RESET);
} }
...@@ -2925,13 +2922,13 @@ static inline void scic_sds_controller_starting_state_exit( ...@@ -2925,13 +2922,13 @@ static inline void scic_sds_controller_starting_state_exit(
static void scic_sds_controller_ready_state_enter( static void scic_sds_controller_ready_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_controller *this_controller; struct scic_sds_controller *scic;
this_controller = (struct scic_sds_controller *)object; scic = (struct scic_sds_controller *)object;
/* set the default interrupt coalescence number and timeout value. */ /* set the default interrupt coalescence number and timeout value. */
scic_controller_set_interrupt_coalescence( scic_controller_set_interrupt_coalescence(
this_controller, 0x10, 250); scic, 0x10, 250);
} }
/** /**
...@@ -2945,12 +2942,12 @@ static void scic_sds_controller_ready_state_enter( ...@@ -2945,12 +2942,12 @@ static void scic_sds_controller_ready_state_enter(
static void scic_sds_controller_ready_state_exit( static void scic_sds_controller_ready_state_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_controller *this_controller; struct scic_sds_controller *scic;
this_controller = (struct scic_sds_controller *)object; scic = (struct scic_sds_controller *)object;
/* disable interrupt coalescence. */ /* disable interrupt coalescence. */
scic_controller_set_interrupt_coalescence(this_controller, 0, 0); scic_controller_set_interrupt_coalescence(scic, 0, 0);
} }
/** /**
...@@ -2966,14 +2963,14 @@ static void scic_sds_controller_ready_state_exit( ...@@ -2966,14 +2963,14 @@ static void scic_sds_controller_ready_state_exit(
static void scic_sds_controller_stopping_state_enter( static void scic_sds_controller_stopping_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_controller *this_controller; struct scic_sds_controller *scic;
this_controller = (struct scic_sds_controller *)object; scic = (struct scic_sds_controller *)object;
/* Stop all of the components for this controller */ /* Stop all of the components for this controller */
scic_sds_controller_stop_phys(this_controller); scic_sds_controller_stop_phys(scic);
scic_sds_controller_stop_ports(this_controller); scic_sds_controller_stop_ports(scic);
scic_sds_controller_stop_devices(this_controller); scic_sds_controller_stop_devices(scic);
} }
/** /**
......
...@@ -542,12 +542,12 @@ void scic_sds_controller_copy_sata_response( ...@@ -542,12 +542,12 @@ void scic_sds_controller_copy_sata_response(
enum sci_status scic_sds_controller_allocate_remote_node_context( enum sci_status scic_sds_controller_allocate_remote_node_context(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
u16 *node_id); u16 *node_id);
void scic_sds_controller_free_remote_node_context( void scic_sds_controller_free_remote_node_context(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
u16 node_id); u16 node_id);
union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer( union scu_remote_node_context *scic_sds_controller_get_remote_node_context_buffer(
...@@ -565,25 +565,25 @@ struct scu_task_context *scic_sds_controller_get_task_context_buffer( ...@@ -565,25 +565,25 @@ struct scu_task_context *scic_sds_controller_get_task_context_buffer(
void scic_sds_controller_power_control_queue_insert( void scic_sds_controller_power_control_queue_insert(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
struct scic_sds_phy *the_phy); struct scic_sds_phy *sci_phy);
void scic_sds_controller_power_control_queue_remove( void scic_sds_controller_power_control_queue_remove(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
struct scic_sds_phy *the_phy); struct scic_sds_phy *sci_phy);
void scic_sds_controller_link_up( void scic_sds_controller_link_up(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
struct scic_sds_port *the_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy); struct scic_sds_phy *sci_phy);
void scic_sds_controller_link_down( void scic_sds_controller_link_down(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
struct scic_sds_port *the_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy); struct scic_sds_phy *sci_phy);
void scic_sds_controller_remote_device_stopped( void scic_sds_controller_remote_device_stopped(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device); struct scic_sds_remote_device *sci_dev);
void scic_sds_controller_copy_task_context( void scic_sds_controller_copy_task_context(
struct scic_sds_controller *this_controller, struct scic_sds_controller *this_controller,
......
...@@ -84,26 +84,29 @@ enum sas_linkrate sci_phy_linkrate(struct scic_sds_phy *sci_phy) ...@@ -84,26 +84,29 @@ enum sas_linkrate sci_phy_linkrate(struct scic_sds_phy *sci_phy)
/** /**
* This method will initialize the phy transport layer registers * This method will initialize the phy transport layer registers
* @this_phy: * @sci_phy:
* @transport_layer_registers * @transport_layer_registers
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_phy_transport_layer_initialization( static enum sci_status scic_sds_phy_transport_layer_initialization(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
struct scu_transport_layer_registers __iomem *transport_layer_registers) struct scu_transport_layer_registers __iomem *transport_layer_registers)
{ {
u32 tl_control; u32 tl_control;
this_phy->transport_layer_registers = transport_layer_registers; sci_phy->transport_layer_registers = transport_layer_registers;
writel(SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX, writel(SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX,
&this_phy->transport_layer_registers->stp_rni); &sci_phy->transport_layer_registers->stp_rni);
/* Hardware team recommends that we enable the STP prefetch for all transports */ /*
tl_control = readl(&this_phy->transport_layer_registers->control); * Hardware team recommends that we enable the STP prefetch for all
* transports
*/
tl_control = readl(&sci_phy->transport_layer_registers->control);
tl_control |= SCU_TLCR_GEN_BIT(STP_WRITE_DATA_PREFETCH); tl_control |= SCU_TLCR_GEN_BIT(STP_WRITE_DATA_PREFETCH);
writel(tl_control, &this_phy->transport_layer_registers->control); writel(tl_control, &sci_phy->transport_layer_registers->control);
return SCI_SUCCESS; return SCI_SUCCESS;
} }
...@@ -284,7 +287,7 @@ static void scic_sds_phy_sata_timeout(void *phy) ...@@ -284,7 +287,7 @@ static void scic_sds_phy_sata_timeout(void *phy)
* This method returns the port currently containing this phy. If the phy is * This method returns the port currently containing this phy. If the phy is
* currently contained by the dummy port, then the phy is considered to not * currently contained by the dummy port, then the phy is considered to not
* be part of a port. * be part of a port.
* @this_phy: This parameter specifies the phy for which to retrieve the * @sci_phy: This parameter specifies the phy for which to retrieve the
* containing port. * containing port.
* *
* This method returns a handle to a port that contains the supplied phy. * This method returns a handle to a port that contains the supplied phy.
...@@ -293,30 +296,30 @@ static void scic_sds_phy_sata_timeout(void *phy) ...@@ -293,30 +296,30 @@ static void scic_sds_phy_sata_timeout(void *phy)
* values indicate a handle/pointer to the port containing the phy. * values indicate a handle/pointer to the port containing the phy.
*/ */
struct scic_sds_port *scic_sds_phy_get_port( struct scic_sds_port *scic_sds_phy_get_port(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
if (scic_sds_port_get_index(this_phy->owning_port) == SCIC_SDS_DUMMY_PORT) if (scic_sds_port_get_index(sci_phy->owning_port) == SCIC_SDS_DUMMY_PORT)
return NULL; return NULL;
return this_phy->owning_port; return sci_phy->owning_port;
} }
/** /**
* This method will assign a port to the phy object. * This method will assign a port to the phy object.
* @out]: this_phy This parameter specifies the phy for which to assign a port * @out]: sci_phy This parameter specifies the phy for which to assign a port
* object. * object.
* *
* *
*/ */
void scic_sds_phy_set_port( void scic_sds_phy_set_port(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
struct scic_sds_port *the_port) struct scic_sds_port *sci_port)
{ {
this_phy->owning_port = the_port; sci_phy->owning_port = sci_port;
if (this_phy->bcn_received_while_port_unassigned) { if (sci_phy->bcn_received_while_port_unassigned) {
this_phy->bcn_received_while_port_unassigned = false; sci_phy->bcn_received_while_port_unassigned = false;
scic_sds_port_broadcast_change_received(this_phy->owning_port, this_phy); scic_sds_port_broadcast_change_received(sci_phy->owning_port, sci_phy);
} }
} }
...@@ -362,123 +365,125 @@ enum sci_status scic_sds_phy_initialize( ...@@ -362,123 +365,125 @@ enum sci_status scic_sds_phy_initialize(
/** /**
* This method assigns the direct attached device ID for this phy. * This method assigns the direct attached device ID for this phy.
* *
* @this_phy The phy for which the direct attached device id is to * @sci_phy The phy for which the direct attached device id is to
* be assigned. * be assigned.
* @device_id The direct attached device ID to assign to the phy. * @device_id The direct attached device ID to assign to the phy.
* This will either be the RNi for the device or an invalid RNi if there * This will either be the RNi for the device or an invalid RNi if there
* is no current device assigned to the phy. * is no current device assigned to the phy.
*/ */
void scic_sds_phy_setup_transport( void scic_sds_phy_setup_transport(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 device_id) u32 device_id)
{ {
u32 tl_control; u32 tl_control;
writel(device_id, &this_phy->transport_layer_registers->stp_rni); writel(device_id, &sci_phy->transport_layer_registers->stp_rni);
/* /*
* The read should guarantee that the first write gets posted * The read should guarantee that the first write gets posted
* before the next write * before the next write
*/ */
tl_control = readl(&this_phy->transport_layer_registers->control); tl_control = readl(&sci_phy->transport_layer_registers->control);
tl_control |= SCU_TLCR_GEN_BIT(CLEAR_TCI_NCQ_MAPPING_TABLE); tl_control |= SCU_TLCR_GEN_BIT(CLEAR_TCI_NCQ_MAPPING_TABLE);
writel(tl_control, &this_phy->transport_layer_registers->control); writel(tl_control, &sci_phy->transport_layer_registers->control);
} }
/** /**
* *
* @this_phy: The phy object to be suspended. * @sci_phy: The phy object to be suspended.
* *
* This function will perform the register reads/writes to suspend the SCU * This function will perform the register reads/writes to suspend the SCU
* hardware protocol engine. none * hardware protocol engine. none
*/ */
static void scic_sds_phy_suspend( static void scic_sds_phy_suspend(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
u32 scu_sas_pcfg_value; u32 scu_sas_pcfg_value;
scu_sas_pcfg_value = scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration); readl(&sci_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE); scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
writel(scu_sas_pcfg_value, writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
scic_sds_phy_setup_transport(this_phy, SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX); scic_sds_phy_setup_transport(
sci_phy,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX);
} }
/** /**
* *
* @this_phy: The phy object to resume. * @sci_phy: The phy object to resume.
* *
* This function will perform the register reads/writes required to resume the * This function will perform the register reads/writes required to resume the
* SCU hardware protocol engine. none * SCU hardware protocol engine. none
*/ */
void scic_sds_phy_resume( void scic_sds_phy_resume(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
u32 scu_sas_pcfg_value; u32 scu_sas_pcfg_value;
scu_sas_pcfg_value = scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration); readl(&sci_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE); scu_sas_pcfg_value &= ~SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE);
writel(scu_sas_pcfg_value, writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
} }
/** /**
* This method returns the local sas address assigned to this phy. * This method returns the local sas address assigned to this phy.
* @this_phy: This parameter specifies the phy for which to retrieve the local * @sci_phy: This parameter specifies the phy for which to retrieve the local
* SAS address. * SAS address.
* @sas_address: This parameter specifies the location into which to copy the * @sas_address: This parameter specifies the location into which to copy the
* local SAS address. * local SAS address.
* *
*/ */
void scic_sds_phy_get_sas_address( void scic_sds_phy_get_sas_address(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
struct sci_sas_address *sas_address) struct sci_sas_address *sas_address)
{ {
sas_address->high = readl(&this_phy->link_layer_registers->source_sas_address_high); sas_address->high = readl(&sci_phy->link_layer_registers->source_sas_address_high);
sas_address->low = readl(&this_phy->link_layer_registers->source_sas_address_low); sas_address->low = readl(&sci_phy->link_layer_registers->source_sas_address_low);
} }
/** /**
* This method returns the remote end-point (i.e. attached) sas address * This method returns the remote end-point (i.e. attached) sas address
* assigned to this phy. * assigned to this phy.
* @this_phy: This parameter specifies the phy for which to retrieve the remote * @sci_phy: This parameter specifies the phy for which to retrieve the remote
* end-point SAS address. * end-point SAS address.
* @sas_address: This parameter specifies the location into which to copy the * @sas_address: This parameter specifies the location into which to copy the
* remote end-point SAS address. * remote end-point SAS address.
* *
*/ */
void scic_sds_phy_get_attached_sas_address( void scic_sds_phy_get_attached_sas_address(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
struct sci_sas_address *sas_address) struct sci_sas_address *sas_address)
{ {
sas_address->high sas_address->high
= this_phy->phy_type.sas.identify_address_frame_buffer.sas_address.high; = sci_phy->phy_type.sas.identify_address_frame_buffer.sas_address.high;
sas_address->low sas_address->low
= this_phy->phy_type.sas.identify_address_frame_buffer.sas_address.low; = sci_phy->phy_type.sas.identify_address_frame_buffer.sas_address.low;
} }
/** /**
* This method returns the supported protocols assigned to this phy * This method returns the supported protocols assigned to this phy
* @this_phy: * @sci_phy:
* *
* *
*/ */
void scic_sds_phy_get_protocols( void scic_sds_phy_get_protocols(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
struct sci_sas_identify_address_frame_protocols *protocols) struct sci_sas_identify_address_frame_protocols *protocols)
{ {
protocols->u.all = protocols->u.all =
(u16)(readl(&this_phy-> (u16)(readl(&sci_phy->
link_layer_registers->transmit_identification) & link_layer_registers->transmit_identification) &
0x0000FFFF); 0x0000FFFF);
} }
/** /**
* *
* @this_phy: The parameter is the phy object for which the attached phy * @sci_phy: The parameter is the phy object for which the attached phy
* protcols are to be returned. * protcols are to be returned.
* *
* This method returns the supported protocols for the attached phy. If this * This method returns the supported protocols for the attached phy. If this
...@@ -488,15 +493,15 @@ void scic_sds_phy_get_protocols( ...@@ -488,15 +493,15 @@ void scic_sds_phy_get_protocols(
* value. * value.
*/ */
void scic_sds_phy_get_attached_phy_protocols( void scic_sds_phy_get_attached_phy_protocols(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
struct sci_sas_identify_address_frame_protocols *protocols) struct sci_sas_identify_address_frame_protocols *protocols)
{ {
protocols->u.all = 0; protocols->u.all = 0;
if (this_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
protocols->u.all = protocols->u.all =
this_phy->phy_type.sas.identify_address_frame_buffer.protocols.u.all; sci_phy->phy_type.sas.identify_address_frame_buffer.protocols.u.all;
} else if (this_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) { } else if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SATA) {
protocols->u.bits.stp_target = 1; protocols->u.bits.stp_target = 1;
} }
} }
...@@ -533,54 +538,54 @@ enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy) ...@@ -533,54 +538,54 @@ enum sci_status scic_sds_phy_stop(struct scic_sds_phy *sci_phy)
/** /**
* This method will attempt to reset the phy. This request is only valid when * This method will attempt to reset the phy. This request is only valid when
* the phy is in an ready state * the phy is in an ready state
* @this_phy: * @sci_phy:
* *
* enum sci_status * enum sci_status
*/ */
enum sci_status scic_sds_phy_reset( enum sci_status scic_sds_phy_reset(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
return this_phy->state_handlers->reset_handler(this_phy); return sci_phy->state_handlers->reset_handler(sci_phy);
} }
/** /**
* This method will process the event code received. * This method will process the event code received.
* @this_phy: * @sci_phy:
* @event_code: * @event_code:
* *
* enum sci_status * enum sci_status
*/ */
enum sci_status scic_sds_phy_event_handler( enum sci_status scic_sds_phy_event_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 event_code) u32 event_code)
{ {
return this_phy->state_handlers->event_handler(this_phy, event_code); return sci_phy->state_handlers->event_handler(sci_phy, event_code);
} }
/** /**
* This method will process the frame index received. * This method will process the frame index received.
* @this_phy: * @sci_phy:
* @frame_index: * @frame_index:
* *
* enum sci_status * enum sci_status
*/ */
enum sci_status scic_sds_phy_frame_handler( enum sci_status scic_sds_phy_frame_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 frame_index) u32 frame_index)
{ {
return this_phy->state_handlers->frame_handler(this_phy, frame_index); return sci_phy->state_handlers->frame_handler(sci_phy, frame_index);
} }
/** /**
* This method will give the phy permission to consume power * This method will give the phy permission to consume power
* @this_phy: * @sci_phy:
* *
* enum sci_status * enum sci_status
*/ */
enum sci_status scic_sds_phy_consume_power_handler( enum sci_status scic_sds_phy_consume_power_handler(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
return this_phy->state_handlers->consume_power_handler(this_phy); return sci_phy->state_handlers->consume_power_handler(sci_phy);
} }
/* /*
...@@ -638,7 +643,7 @@ enum sci_status scic_sata_phy_get_properties( ...@@ -638,7 +643,7 @@ enum sci_status scic_sata_phy_get_properties(
/** /**
* *
* @this_phy: The phy object that received SAS PHY DETECTED. * @sci_phy: The phy object that received SAS PHY DETECTED.
* *
* This method continues the link training for the phy as if it were a SAS PHY * This method continues the link training for the phy as if it were a SAS PHY
* instead of a SATA PHY. This is done because the completion queue had a SAS * instead of a SATA PHY. This is done because the completion queue had a SAS
...@@ -646,41 +651,41 @@ enum sci_status scic_sata_phy_get_properties( ...@@ -646,41 +651,41 @@ enum sci_status scic_sata_phy_get_properties(
* none * none
*/ */
static void scic_sds_phy_start_sas_link_training( static void scic_sds_phy_start_sas_link_training(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
u32 phy_control; u32 phy_control;
phy_control = phy_control =
readl(&this_phy->link_layer_registers->phy_configuration); readl(&sci_phy->link_layer_registers->phy_configuration);
phy_control |= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD); phy_control |= SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD);
writel(phy_control, writel(phy_control,
&this_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_phy->starting_substate_machine, &sci_phy->starting_substate_machine,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
); );
this_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SAS; sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SAS;
} }
/** /**
* *
* @this_phy: The phy object that received a SATA SPINUP HOLD event * @sci_phy: The phy object that received a SATA SPINUP HOLD event
* *
* This method continues the link training for the phy as if it were a SATA PHY * This method continues the link training for the phy as if it were a SATA PHY
* instead of a SAS PHY. This is done because the completion queue had a SATA * instead of a SAS PHY. This is done because the completion queue had a SATA
* SPINUP HOLD event when the state machine was expecting a SAS PHY event. none * SPINUP HOLD event when the state machine was expecting a SAS PHY event. none
*/ */
static void scic_sds_phy_start_sata_link_training( static void scic_sds_phy_start_sata_link_training(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_phy->starting_substate_machine, &sci_phy->starting_substate_machine,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
); );
this_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA; sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_SATA;
} }
/** /**
...@@ -748,24 +753,24 @@ static enum sci_status scic_sds_phy_starting_substate_general_stop_handler( ...@@ -748,24 +753,24 @@ static enum sci_status scic_sds_phy_starting_substate_general_stop_handler(
* SCI_FAILURE on any unexpected event notifation * SCI_FAILURE on any unexpected event notifation
*/ */
static enum sci_status scic_sds_phy_starting_substate_await_ossp_event_handler( static enum sci_status scic_sds_phy_starting_substate_await_ossp_event_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 event_code) u32 event_code)
{ {
u32 result = SCI_SUCCESS; u32 result = SCI_SUCCESS;
switch (scu_get_event_code(event_code)) { switch (scu_get_event_code(event_code)) {
case SCU_EVENT_SAS_PHY_DETECTED: case SCU_EVENT_SAS_PHY_DETECTED:
scic_sds_phy_start_sas_link_training(this_phy); scic_sds_phy_start_sas_link_training(sci_phy);
this_phy->is_in_link_training = true; sci_phy->is_in_link_training = true;
break; break;
case SCU_EVENT_SATA_SPINUP_HOLD: case SCU_EVENT_SATA_SPINUP_HOLD:
scic_sds_phy_start_sata_link_training(this_phy); scic_sds_phy_start_sata_link_training(sci_phy);
this_phy->is_in_link_training = true; sci_phy->is_in_link_training = true;
break; break;
default: default:
dev_dbg(sciphy_to_dev(this_phy), dev_dbg(sciphy_to_dev(sci_phy),
"%s: PHY starting substate machine received " "%s: PHY starting substate machine received "
"unexpected event_code %x\n", "unexpected event_code %x\n",
__func__, __func__,
...@@ -793,7 +798,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_ossp_event_handler( ...@@ -793,7 +798,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_ossp_event_handler(
* event notification SCI_FAILURE on any unexpected event notifation * event notification SCI_FAILURE on any unexpected event notifation
*/ */
static enum sci_status scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler( static enum sci_status scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 event_code) u32 event_code)
{ {
u32 result = SCI_SUCCESS; u32 result = SCI_SUCCESS;
...@@ -808,38 +813,41 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_phy_speed_event_ ...@@ -808,38 +813,41 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_phy_speed_event_
case SCU_EVENT_SAS_15: case SCU_EVENT_SAS_15:
case SCU_EVENT_SAS_15_SSC: case SCU_EVENT_SAS_15_SSC:
scic_sds_phy_complete_link_training( scic_sds_phy_complete_link_training(
this_phy, SAS_LINK_RATE_1_5_GBPS, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF sci_phy,
); SAS_LINK_RATE_1_5_GBPS,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF);
break; break;
case SCU_EVENT_SAS_30: case SCU_EVENT_SAS_30:
case SCU_EVENT_SAS_30_SSC: case SCU_EVENT_SAS_30_SSC:
scic_sds_phy_complete_link_training( scic_sds_phy_complete_link_training(
this_phy, SAS_LINK_RATE_3_0_GBPS, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF sci_phy,
); SAS_LINK_RATE_3_0_GBPS,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF);
break; break;
case SCU_EVENT_SAS_60: case SCU_EVENT_SAS_60:
case SCU_EVENT_SAS_60_SSC: case SCU_EVENT_SAS_60_SSC:
scic_sds_phy_complete_link_training( scic_sds_phy_complete_link_training(
this_phy, SAS_LINK_RATE_6_0_GBPS, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF sci_phy,
); SAS_LINK_RATE_6_0_GBPS,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF);
break; break;
case SCU_EVENT_SATA_SPINUP_HOLD: case SCU_EVENT_SATA_SPINUP_HOLD:
/* /*
* We were doing SAS PHY link training and received a SATA PHY event * We were doing SAS PHY link training and received a SATA PHY event
* continue OOB/SN as if this were a SATA PHY */ * continue OOB/SN as if this were a SATA PHY */
scic_sds_phy_start_sata_link_training(this_phy); scic_sds_phy_start_sata_link_training(sci_phy);
break; break;
case SCU_EVENT_LINK_FAILURE: case SCU_EVENT_LINK_FAILURE:
/* Link failure change state back to the starting state */ /* Link failure change state back to the starting state */
scic_sds_phy_restart_starting_state(this_phy); scic_sds_phy_restart_starting_state(sci_phy);
break; break;
default: default:
dev_warn(sciphy_to_dev(this_phy), dev_warn(sciphy_to_dev(sci_phy),
"%s: PHY starting substate machine received " "%s: PHY starting substate machine received "
"unexpected event_code %x\n", "unexpected event_code %x\n",
__func__, __func__,
...@@ -867,7 +875,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_phy_speed_event_ ...@@ -867,7 +875,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_phy_speed_event_
* unexpected event notifation * unexpected event notifation
*/ */
static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_event_handler( static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_event_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 event_code) u32 event_code)
{ {
u32 result = SCI_SUCCESS; u32 result = SCI_SUCCESS;
...@@ -875,25 +883,25 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_event_handler ...@@ -875,25 +883,25 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_event_handler
switch (scu_get_event_code(event_code)) { switch (scu_get_event_code(event_code)) {
case SCU_EVENT_SAS_PHY_DETECTED: case SCU_EVENT_SAS_PHY_DETECTED:
/* Backup the state machine */ /* Backup the state machine */
scic_sds_phy_start_sas_link_training(this_phy); scic_sds_phy_start_sas_link_training(sci_phy);
break; break;
case SCU_EVENT_SATA_SPINUP_HOLD: case SCU_EVENT_SATA_SPINUP_HOLD:
/* /*
* We were doing SAS PHY link training and received a SATA PHY event * We were doing SAS PHY link training and received a SATA PHY event
* continue OOB/SN as if this were a SATA PHY */ * continue OOB/SN as if this were a SATA PHY */
scic_sds_phy_start_sata_link_training(this_phy); scic_sds_phy_start_sata_link_training(sci_phy);
break; break;
case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT: case SCU_EVENT_RECEIVED_IDENTIFY_TIMEOUT:
case SCU_EVENT_LINK_FAILURE: case SCU_EVENT_LINK_FAILURE:
case SCU_EVENT_HARD_RESET_RECEIVED: case SCU_EVENT_HARD_RESET_RECEIVED:
/* Start the oob/sn state machine over again */ /* Start the oob/sn state machine over again */
scic_sds_phy_restart_starting_state(this_phy); scic_sds_phy_restart_starting_state(sci_phy);
break; break;
default: default:
dev_warn(sciphy_to_dev(this_phy), dev_warn(sciphy_to_dev(sci_phy),
"%s: PHY starting substate machine received " "%s: PHY starting substate machine received "
"unexpected event_code %x\n", "unexpected event_code %x\n",
__func__, __func__,
...@@ -919,7 +927,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_event_handler ...@@ -919,7 +927,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_iaf_uf_event_handler
* notifation * notifation
*/ */
static enum sci_status scic_sds_phy_starting_substate_await_sas_power_event_handler( static enum sci_status scic_sds_phy_starting_substate_await_sas_power_event_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 event_code) u32 event_code)
{ {
u32 result = SCI_SUCCESS; u32 result = SCI_SUCCESS;
...@@ -927,11 +935,11 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_power_event_hand ...@@ -927,11 +935,11 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_power_event_hand
switch (scu_get_event_code(event_code)) { switch (scu_get_event_code(event_code)) {
case SCU_EVENT_LINK_FAILURE: case SCU_EVENT_LINK_FAILURE:
/* Link failure change state back to the starting state */ /* Link failure change state back to the starting state */
scic_sds_phy_restart_starting_state(this_phy); scic_sds_phy_restart_starting_state(sci_phy);
break; break;
default: default:
dev_warn(sciphy_to_dev(this_phy), dev_warn(sciphy_to_dev(sci_phy),
"%s: PHY starting substate machine received unexpected " "%s: PHY starting substate machine received unexpected "
"event_code %x\n", "event_code %x\n",
__func__, __func__,
...@@ -957,7 +965,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_power_event_hand ...@@ -957,7 +965,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sas_power_event_hand
* on a link failure event SCI_FAILURE on any unexpected event notifation * on a link failure event SCI_FAILURE on any unexpected event notifation
*/ */
static enum sci_status scic_sds_phy_starting_substate_await_sata_power_event_handler( static enum sci_status scic_sds_phy_starting_substate_await_sata_power_event_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 event_code) u32 event_code)
{ {
u32 result = SCI_SUCCESS; u32 result = SCI_SUCCESS;
...@@ -965,7 +973,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_power_event_han ...@@ -965,7 +973,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_power_event_han
switch (scu_get_event_code(event_code)) { switch (scu_get_event_code(event_code)) {
case SCU_EVENT_LINK_FAILURE: case SCU_EVENT_LINK_FAILURE:
/* Link failure change state back to the starting state */ /* Link failure change state back to the starting state */
scic_sds_phy_restart_starting_state(this_phy); scic_sds_phy_restart_starting_state(sci_phy);
break; break;
case SCU_EVENT_SATA_SPINUP_HOLD: case SCU_EVENT_SATA_SPINUP_HOLD:
...@@ -976,11 +984,11 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_power_event_han ...@@ -976,11 +984,11 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_power_event_han
/* /*
* There has been a change in the phy type before OOB/SN for the * There has been a change in the phy type before OOB/SN for the
* SATA finished start down the SAS link traning path. */ * SATA finished start down the SAS link traning path. */
scic_sds_phy_start_sas_link_training(this_phy); scic_sds_phy_start_sas_link_training(sci_phy);
break; break;
default: default:
dev_warn(sciphy_to_dev(this_phy), dev_warn(sciphy_to_dev(sci_phy),
"%s: PHY starting substate machine received " "%s: PHY starting substate machine received "
"unexpected event_code %x\n", "unexpected event_code %x\n",
__func__, __func__,
...@@ -1066,7 +1074,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_phy_event_handl ...@@ -1066,7 +1074,7 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_phy_event_handl
* valid event notification SCI_FAILURE on any unexpected event notifation * valid event notification SCI_FAILURE on any unexpected event notifation
*/ */
static enum sci_status scic_sds_phy_starting_substate_await_sata_speed_event_handler( static enum sci_status scic_sds_phy_starting_substate_await_sata_speed_event_handler(
struct scic_sds_phy *this_phy, struct scic_sds_phy *sci_phy,
u32 event_code) u32 event_code)
{ {
u32 result = SCI_SUCCESS; u32 result = SCI_SUCCESS;
...@@ -1081,44 +1089,41 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_speed_event_han ...@@ -1081,44 +1089,41 @@ static enum sci_status scic_sds_phy_starting_substate_await_sata_speed_event_han
case SCU_EVENT_SATA_15: case SCU_EVENT_SATA_15:
case SCU_EVENT_SATA_15_SSC: case SCU_EVENT_SATA_15_SSC:
scic_sds_phy_complete_link_training( scic_sds_phy_complete_link_training(
this_phy, sci_phy,
SAS_LINK_RATE_1_5_GBPS, SAS_LINK_RATE_1_5_GBPS,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF);
);
break; break;
case SCU_EVENT_SATA_30: case SCU_EVENT_SATA_30:
case SCU_EVENT_SATA_30_SSC: case SCU_EVENT_SATA_30_SSC:
scic_sds_phy_complete_link_training( scic_sds_phy_complete_link_training(
this_phy, sci_phy,
SAS_LINK_RATE_3_0_GBPS, SAS_LINK_RATE_3_0_GBPS,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF);
);
break; break;
case SCU_EVENT_SATA_60: case SCU_EVENT_SATA_60:
case SCU_EVENT_SATA_60_SSC: case SCU_EVENT_SATA_60_SSC:
scic_sds_phy_complete_link_training( scic_sds_phy_complete_link_training(
this_phy, sci_phy,
SAS_LINK_RATE_6_0_GBPS, SAS_LINK_RATE_6_0_GBPS,
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SIG_FIS_UF);
);
break; break;
case SCU_EVENT_LINK_FAILURE: case SCU_EVENT_LINK_FAILURE:
/* Link failure change state back to the starting state */ /* Link failure change state back to the starting state */
scic_sds_phy_restart_starting_state(this_phy); scic_sds_phy_restart_starting_state(sci_phy);
break; break;
case SCU_EVENT_SAS_PHY_DETECTED: case SCU_EVENT_SAS_PHY_DETECTED:
/* /*
* There has been a change in the phy type before OOB/SN for the * There has been a change in the phy type before OOB/SN for the
* SATA finished start down the SAS link traning path. */ * SATA finished start down the SAS link traning path. */
scic_sds_phy_start_sas_link_training(this_phy); scic_sds_phy_start_sas_link_training(sci_phy);
break; break;
default: default:
dev_warn(sciphy_to_dev(this_phy), dev_warn(sciphy_to_dev(sci_phy),
"%s: PHY starting substate machine received " "%s: PHY starting substate machine received "
"unexpected event_code %x\n", "unexpected event_code %x\n",
__func__, __func__,
...@@ -1583,12 +1588,12 @@ static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_object ...@@ -1583,12 +1588,12 @@ static void scic_sds_phy_starting_initial_substate_enter(struct sci_base_object
static void scic_sds_phy_starting_await_ossp_en_substate_enter( static void scic_sds_phy_starting_await_ossp_en_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_starting_substate_handlers( scic_sds_phy_set_starting_substate_handlers(
this_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_OSSP_EN
); );
} }
...@@ -1603,12 +1608,12 @@ static void scic_sds_phy_starting_await_ossp_en_substate_enter( ...@@ -1603,12 +1608,12 @@ static void scic_sds_phy_starting_await_ossp_en_substate_enter(
static void scic_sds_phy_starting_await_sas_speed_en_substate_enter( static void scic_sds_phy_starting_await_sas_speed_en_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_starting_substate_handlers( scic_sds_phy_set_starting_substate_handlers(
this_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_SPEED_EN
); );
} }
...@@ -1623,12 +1628,12 @@ static void scic_sds_phy_starting_await_sas_speed_en_substate_enter( ...@@ -1623,12 +1628,12 @@ static void scic_sds_phy_starting_await_sas_speed_en_substate_enter(
static void scic_sds_phy_starting_await_iaf_uf_substate_enter( static void scic_sds_phy_starting_await_iaf_uf_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_starting_substate_handlers( scic_sds_phy_set_starting_substate_handlers(
this_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
); );
} }
...@@ -1644,17 +1649,17 @@ static void scic_sds_phy_starting_await_iaf_uf_substate_enter( ...@@ -1644,17 +1649,17 @@ static void scic_sds_phy_starting_await_iaf_uf_substate_enter(
static void scic_sds_phy_starting_await_sas_power_substate_enter( static void scic_sds_phy_starting_await_sas_power_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_starting_substate_handlers( scic_sds_phy_set_starting_substate_handlers(
this_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER
); );
scic_sds_controller_power_control_queue_insert( scic_sds_controller_power_control_queue_insert(
scic_sds_phy_get_controller(this_phy), scic_sds_phy_get_controller(sci_phy),
this_phy sci_phy
); );
} }
...@@ -1669,12 +1674,12 @@ static void scic_sds_phy_starting_await_sas_power_substate_enter( ...@@ -1669,12 +1674,12 @@ static void scic_sds_phy_starting_await_sas_power_substate_enter(
static void scic_sds_phy_starting_await_sas_power_substate_exit( static void scic_sds_phy_starting_await_sas_power_substate_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_controller_power_control_queue_remove( scic_sds_controller_power_control_queue_remove(
scic_sds_phy_get_controller(this_phy), this_phy scic_sds_phy_get_controller(sci_phy), sci_phy
); );
} }
...@@ -1690,17 +1695,17 @@ static void scic_sds_phy_starting_await_sas_power_substate_exit( ...@@ -1690,17 +1695,17 @@ static void scic_sds_phy_starting_await_sas_power_substate_exit(
static void scic_sds_phy_starting_await_sata_power_substate_enter( static void scic_sds_phy_starting_await_sata_power_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_starting_substate_handlers( scic_sds_phy_set_starting_substate_handlers(
this_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER sci_phy, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SATA_POWER
); );
scic_sds_controller_power_control_queue_insert( scic_sds_controller_power_control_queue_insert(
scic_sds_phy_get_controller(this_phy), scic_sds_phy_get_controller(sci_phy),
this_phy sci_phy
); );
} }
...@@ -1715,13 +1720,13 @@ static void scic_sds_phy_starting_await_sata_power_substate_enter( ...@@ -1715,13 +1720,13 @@ static void scic_sds_phy_starting_await_sata_power_substate_enter(
static void scic_sds_phy_starting_await_sata_power_substate_exit( static void scic_sds_phy_starting_await_sata_power_substate_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_controller_power_control_queue_remove( scic_sds_controller_power_control_queue_remove(
scic_sds_phy_get_controller(this_phy), scic_sds_phy_get_controller(sci_phy),
this_phy sci_phy
); );
} }
...@@ -2115,33 +2120,32 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[ ...@@ -2115,33 +2120,32 @@ static const struct scic_sds_phy_state_handler scic_sds_phy_state_handler_table[
/** /**
* *
* @this_phy: This is the struct scic_sds_phy object to stop. * @sci_phy: This is the struct scic_sds_phy object to stop.
* *
* This method will stop the struct scic_sds_phy object. This does not reset the * This method will stop the struct scic_sds_phy object. This does not reset the
* protocol engine it just suspends it and places it in a state where it will * protocol engine it just suspends it and places it in a state where it will
* not cause the end device to power up. none * not cause the end device to power up. none
*/ */
static void scu_link_layer_stop_protocol_engine( static void scu_link_layer_stop_protocol_engine(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
u32 scu_sas_pcfg_value; u32 scu_sas_pcfg_value;
u32 enable_spinup_value; u32 enable_spinup_value;
/* Suspend the protocol engine and place it in a sata spinup hold state */ /* Suspend the protocol engine and place it in a sata spinup hold state */
scu_sas_pcfg_value = scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration); readl(&sci_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value |= ( scu_sas_pcfg_value |=
SCU_SAS_PCFG_GEN_BIT(OOB_RESET) (SCU_SAS_PCFG_GEN_BIT(OOB_RESET) |
| SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE) SCU_SAS_PCFG_GEN_BIT(SUSPEND_PROTOCOL_ENGINE) |
| SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD) SCU_SAS_PCFG_GEN_BIT(SATA_SPINUP_HOLD));
);
writel(scu_sas_pcfg_value, writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
/* Disable the notify enable spinup primitives */ /* Disable the notify enable spinup primitives */
enable_spinup_value = readl(&this_phy->link_layer_registers->notify_enable_spinup_control); enable_spinup_value = readl(&sci_phy->link_layer_registers->notify_enable_spinup_control);
enable_spinup_value &= ~SCU_ENSPINUP_GEN_BIT(ENABLE); enable_spinup_value &= ~SCU_ENSPINUP_GEN_BIT(ENABLE);
writel(enable_spinup_value, &this_phy->link_layer_registers->notify_enable_spinup_control); writel(enable_spinup_value, &sci_phy->link_layer_registers->notify_enable_spinup_control);
} }
/** /**
...@@ -2150,17 +2154,18 @@ static void scu_link_layer_stop_protocol_engine( ...@@ -2150,17 +2154,18 @@ static void scu_link_layer_stop_protocol_engine(
* This method will start the OOB/SN state machine for this struct scic_sds_phy object. * This method will start the OOB/SN state machine for this struct scic_sds_phy object.
*/ */
static void scu_link_layer_start_oob( static void scu_link_layer_start_oob(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
u32 scu_sas_pcfg_value; u32 scu_sas_pcfg_value;
scu_sas_pcfg_value = scu_sas_pcfg_value =
readl(&this_phy->link_layer_registers->phy_configuration); readl(&sci_phy->link_layer_registers->phy_configuration);
scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE); scu_sas_pcfg_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
scu_sas_pcfg_value &= scu_sas_pcfg_value &=
~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) | SCU_SAS_PCFG_GEN_BIT(HARD_RESET)); ~(SCU_SAS_PCFG_GEN_BIT(OOB_RESET) |
SCU_SAS_PCFG_GEN_BIT(HARD_RESET));
writel(scu_sas_pcfg_value, writel(scu_sas_pcfg_value,
&this_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
} }
/** /**
...@@ -2172,7 +2177,7 @@ static void scu_link_layer_start_oob( ...@@ -2172,7 +2177,7 @@ static void scu_link_layer_start_oob(
* hard reset bit set. * hard reset bit set.
*/ */
static void scu_link_layer_tx_hard_reset( static void scu_link_layer_tx_hard_reset(
struct scic_sds_phy *this_phy) struct scic_sds_phy *sci_phy)
{ {
u32 phy_configuration_value; u32 phy_configuration_value;
...@@ -2180,17 +2185,18 @@ static void scu_link_layer_tx_hard_reset( ...@@ -2180,17 +2185,18 @@ static void scu_link_layer_tx_hard_reset(
* SAS Phys must wait for the HARD_RESET_TX event notification to transition * SAS Phys must wait for the HARD_RESET_TX event notification to transition
* to the starting state. */ * to the starting state. */
phy_configuration_value = phy_configuration_value =
readl(&this_phy->link_layer_registers->phy_configuration); readl(&sci_phy->link_layer_registers->phy_configuration);
phy_configuration_value |= phy_configuration_value |=
(SCU_SAS_PCFG_GEN_BIT(HARD_RESET) | SCU_SAS_PCFG_GEN_BIT(OOB_RESET)); (SCU_SAS_PCFG_GEN_BIT(HARD_RESET) |
SCU_SAS_PCFG_GEN_BIT(OOB_RESET));
writel(phy_configuration_value, writel(phy_configuration_value,
&this_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
/* Now take the OOB state machine out of reset */ /* Now take the OOB state machine out of reset */
phy_configuration_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE); phy_configuration_value |= SCU_SAS_PCFG_GEN_BIT(OOB_ENABLE);
phy_configuration_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET); phy_configuration_value &= ~SCU_SAS_PCFG_GEN_BIT(OOB_RESET);
writel(phy_configuration_value, writel(phy_configuration_value,
&this_phy->link_layer_registers->phy_configuration); &sci_phy->link_layer_registers->phy_configuration);
} }
/* /*
...@@ -2209,11 +2215,11 @@ static void scu_link_layer_tx_hard_reset( ...@@ -2209,11 +2215,11 @@ static void scu_link_layer_tx_hard_reset(
static void scic_sds_phy_initial_state_enter( static void scic_sds_phy_initial_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_base_state_handlers(this_phy, SCI_BASE_PHY_STATE_INITIAL); scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_INITIAL);
} }
/** /**
...@@ -2273,28 +2279,28 @@ static void scic_sds_phy_stopped_state_enter(struct sci_base_object *object) ...@@ -2273,28 +2279,28 @@ static void scic_sds_phy_stopped_state_enter(struct sci_base_object *object)
static void scic_sds_phy_starting_state_enter( static void scic_sds_phy_starting_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_base_state_handlers(this_phy, SCI_BASE_PHY_STATE_STARTING); scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_STARTING);
scu_link_layer_stop_protocol_engine(this_phy); scu_link_layer_stop_protocol_engine(sci_phy);
scu_link_layer_start_oob(this_phy); scu_link_layer_start_oob(sci_phy);
/* We don't know what kind of phy we are going to be just yet */ /* We don't know what kind of phy we are going to be just yet */
this_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN; sci_phy->protocol = SCIC_SDS_PHY_PROTOCOL_UNKNOWN;
this_phy->bcn_received_while_port_unassigned = false; sci_phy->bcn_received_while_port_unassigned = false;
/* Change over to the starting substate machine to continue */ /* Change over to the starting substate machine to continue */
sci_base_state_machine_start(&this_phy->starting_substate_machine); sci_base_state_machine_start(&sci_phy->starting_substate_machine);
if (this_phy->state_machine.previous_state_id if (sci_phy->state_machine.previous_state_id
== SCI_BASE_PHY_STATE_READY) { == SCI_BASE_PHY_STATE_READY) {
scic_sds_controller_link_down( scic_sds_controller_link_down(
scic_sds_phy_get_controller(this_phy), scic_sds_phy_get_controller(sci_phy),
scic_sds_phy_get_port(this_phy), scic_sds_phy_get_port(sci_phy),
this_phy sci_phy
); );
} }
} }
...@@ -2312,16 +2318,16 @@ static void scic_sds_phy_starting_state_enter( ...@@ -2312,16 +2318,16 @@ static void scic_sds_phy_starting_state_enter(
static void scic_sds_phy_ready_state_enter( static void scic_sds_phy_ready_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_base_state_handlers(this_phy, SCI_BASE_PHY_STATE_READY); scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_READY);
scic_sds_controller_link_up( scic_sds_controller_link_up(
scic_sds_phy_get_controller(this_phy), scic_sds_phy_get_controller(sci_phy),
scic_sds_phy_get_port(this_phy), scic_sds_phy_get_port(sci_phy),
this_phy sci_phy
); );
} }
...@@ -2336,11 +2342,11 @@ static void scic_sds_phy_ready_state_enter( ...@@ -2336,11 +2342,11 @@ static void scic_sds_phy_ready_state_enter(
static void scic_sds_phy_ready_state_exit( static void scic_sds_phy_ready_state_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_suspend(this_phy); scic_sds_phy_suspend(sci_phy);
} }
/** /**
...@@ -2354,26 +2360,28 @@ static void scic_sds_phy_ready_state_exit( ...@@ -2354,26 +2360,28 @@ static void scic_sds_phy_ready_state_exit(
static void scic_sds_phy_resetting_state_enter( static void scic_sds_phy_resetting_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_base_state_handlers(this_phy, SCI_BASE_PHY_STATE_RESETTING); scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_RESETTING);
/* /*
* The phy is being reset, therefore deactivate it from the port. * The phy is being reset, therefore deactivate it from the port.
* In the resetting state we don't notify the user regarding * In the resetting state we don't notify the user regarding
* link up and link down notifications. */ * link up and link down notifications. */
scic_sds_port_deactivate_phy(this_phy->owning_port, this_phy, false); scic_sds_port_deactivate_phy(sci_phy->owning_port, sci_phy, false);
if (this_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) { if (sci_phy->protocol == SCIC_SDS_PHY_PROTOCOL_SAS) {
scu_link_layer_tx_hard_reset(this_phy); scu_link_layer_tx_hard_reset(sci_phy);
} else { } else {
/* /*
* The SCU does not need to have a discrete reset state so just go back to * The SCU does not need to have a discrete reset state so
* the starting state. */ * just go back to the starting state.
sci_base_state_machine_change_state(&this_phy->state_machine, */
SCI_BASE_PHY_STATE_STARTING); sci_base_state_machine_change_state(
&sci_phy->state_machine,
SCI_BASE_PHY_STATE_STARTING);
} }
} }
...@@ -2388,11 +2396,11 @@ static void scic_sds_phy_resetting_state_enter( ...@@ -2388,11 +2396,11 @@ static void scic_sds_phy_resetting_state_enter(
static void scic_sds_phy_final_state_enter( static void scic_sds_phy_final_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_phy *this_phy; struct scic_sds_phy *sci_phy;
this_phy = (struct scic_sds_phy *)object; sci_phy = (struct scic_sds_phy *)object;
scic_sds_phy_set_base_state_handlers(this_phy, SCI_BASE_PHY_STATE_FINAL); scic_sds_phy_set_base_state_handlers(sci_phy, SCI_BASE_PHY_STATE_FINAL);
/* Nothing to do here */ /* Nothing to do here */
} }
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
/** /**
* *
* @this_port: This is the port object to which the phy is being assigned. * @sci_port: This is the port object to which the phy is being assigned.
* @phy_index: This is the phy index that is being assigned to the port. * @phy_index: This is the phy index that is being assigned to the port.
* *
* This method will return a true value if the specified phy can be assigned to * This method will return a true value if the specified phy can be assigned to
...@@ -90,30 +90,30 @@ ...@@ -90,30 +90,30 @@
* port * port
*/ */
bool scic_sds_port_is_valid_phy_assignment( bool scic_sds_port_is_valid_phy_assignment(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
u32 phy_index) u32 phy_index)
{ {
/* Initialize to invalid value. */ /* Initialize to invalid value. */
u32 existing_phy_index = SCI_MAX_PHYS; u32 existing_phy_index = SCI_MAX_PHYS;
u32 index; u32 index;
if ((this_port->physical_port_index == 1) && (phy_index != 1)) { if ((sci_port->physical_port_index == 1) && (phy_index != 1)) {
return false; return false;
} }
if (this_port->physical_port_index == 3 && phy_index != 3) { if (sci_port->physical_port_index == 3 && phy_index != 3) {
return false; return false;
} }
if ( if (
(this_port->physical_port_index == 2) (sci_port->physical_port_index == 2)
&& ((phy_index == 0) || (phy_index == 1)) && ((phy_index == 0) || (phy_index == 1))
) { ) {
return false; return false;
} }
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if ((this_port->phy_table[index] != NULL) if ((sci_port->phy_table[index] != NULL)
&& (index != phy_index)) { && (index != phy_index)) {
existing_phy_index = index; existing_phy_index = index;
} }
...@@ -124,9 +124,9 @@ bool scic_sds_port_is_valid_phy_assignment( ...@@ -124,9 +124,9 @@ bool scic_sds_port_is_valid_phy_assignment(
* operating at the same maximum link rate. */ * operating at the same maximum link rate. */
if ( if (
(existing_phy_index < SCI_MAX_PHYS) (existing_phy_index < SCI_MAX_PHYS)
&& (this_port->owning_controller->user_parameters.sds1.phys[ && (sci_port->owning_controller->user_parameters.sds1.phys[
phy_index].max_speed_generation != phy_index].max_speed_generation !=
this_port->owning_controller->user_parameters.sds1.phys[ sci_port->owning_controller->user_parameters.sds1.phys[
existing_phy_index].max_speed_generation) existing_phy_index].max_speed_generation)
) )
return false; return false;
...@@ -137,13 +137,13 @@ bool scic_sds_port_is_valid_phy_assignment( ...@@ -137,13 +137,13 @@ bool scic_sds_port_is_valid_phy_assignment(
/** /**
* This method requests a list (mask) of the phys contained in the supplied SAS * This method requests a list (mask) of the phys contained in the supplied SAS
* port. * port.
* @this_port: a handle corresponding to the SAS port for which to return the * @sci_port: a handle corresponding to the SAS port for which to return the
* phy mask. * phy mask.
* *
* Return a bit mask indicating which phys are a part of this port. Each bit * Return a bit mask indicating which phys are a part of this port. Each bit
* corresponds to a phy identifier (e.g. bit 0 = phy id 0). * corresponds to a phy identifier (e.g. bit 0 = phy id 0).
*/ */
static u32 scic_sds_port_get_phys(struct scic_sds_port *this_port) static u32 scic_sds_port_get_phys(struct scic_sds_port *sci_port)
{ {
u32 index; u32 index;
u32 mask; u32 mask;
...@@ -151,7 +151,7 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *this_port) ...@@ -151,7 +151,7 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *this_port)
mask = 0; mask = 0;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (this_port->phy_table[index] != NULL) { if (sci_port->phy_table[index] != NULL) {
mask |= (1 << index); mask |= (1 << index);
} }
} }
...@@ -161,7 +161,7 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *this_port) ...@@ -161,7 +161,7 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *this_port)
/** /**
* *
* @this_port: This is the port object for which to determine if the phy mask * @sci_port: This is the port object for which to determine if the phy mask
* can be supported. * can be supported.
* *
* This method will return a true value if the port's phy mask can be supported * This method will return a true value if the port's phy mask can be supported
...@@ -172,25 +172,25 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *this_port) ...@@ -172,25 +172,25 @@ static u32 scic_sds_port_get_phys(struct scic_sds_port *this_port)
* port false if this is not a valid phy assignment for the port * port false if this is not a valid phy assignment for the port
*/ */
static bool scic_sds_port_is_phy_mask_valid( static bool scic_sds_port_is_phy_mask_valid(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
u32 phy_mask) u32 phy_mask)
{ {
if (this_port->physical_port_index == 0) { if (sci_port->physical_port_index == 0) {
if (((phy_mask & 0x0F) == 0x0F) if (((phy_mask & 0x0F) == 0x0F)
|| ((phy_mask & 0x03) == 0x03) || ((phy_mask & 0x03) == 0x03)
|| ((phy_mask & 0x01) == 0x01) || ((phy_mask & 0x01) == 0x01)
|| (phy_mask == 0)) || (phy_mask == 0))
return true; return true;
} else if (this_port->physical_port_index == 1) { } else if (sci_port->physical_port_index == 1) {
if (((phy_mask & 0x02) == 0x02) if (((phy_mask & 0x02) == 0x02)
|| (phy_mask == 0)) || (phy_mask == 0))
return true; return true;
} else if (this_port->physical_port_index == 2) { } else if (sci_port->physical_port_index == 2) {
if (((phy_mask & 0x0C) == 0x0C) if (((phy_mask & 0x0C) == 0x0C)
|| ((phy_mask & 0x04) == 0x04) || ((phy_mask & 0x04) == 0x04)
|| (phy_mask == 0)) || (phy_mask == 0))
return true; return true;
} else if (this_port->physical_port_index == 3) { } else if (sci_port->physical_port_index == 3) {
if (((phy_mask & 0x08) == 0x08) if (((phy_mask & 0x08) == 0x08)
|| (phy_mask == 0)) || (phy_mask == 0))
return true; return true;
...@@ -201,7 +201,7 @@ static bool scic_sds_port_is_phy_mask_valid( ...@@ -201,7 +201,7 @@ static bool scic_sds_port_is_phy_mask_valid(
/** /**
* *
* @this_port: This parameter specifies the port from which to return a * @sci_port: This parameter specifies the port from which to return a
* connected phy. * connected phy.
* *
* This method retrieves a currently active (i.e. connected) phy contained in * This method retrieves a currently active (i.e. connected) phy contained in
...@@ -212,7 +212,7 @@ static bool scic_sds_port_is_phy_mask_valid( ...@@ -212,7 +212,7 @@ static bool scic_sds_port_is_phy_mask_valid(
* object that is active in the port. * object that is active in the port.
*/ */
static struct scic_sds_phy *scic_sds_port_get_a_connected_phy( static struct scic_sds_phy *scic_sds_port_get_a_connected_phy(
struct scic_sds_port *this_port struct scic_sds_port *sci_port
) { ) {
u32 index; u32 index;
struct scic_sds_phy *phy; struct scic_sds_phy *phy;
...@@ -221,10 +221,10 @@ static struct scic_sds_phy *scic_sds_port_get_a_connected_phy( ...@@ -221,10 +221,10 @@ static struct scic_sds_phy *scic_sds_port_get_a_connected_phy(
/* /*
* Ensure that the phy is both part of the port and currently * Ensure that the phy is both part of the port and currently
* connected to the remote end-point. */ * connected to the remote end-point. */
phy = this_port->phy_table[index]; phy = sci_port->phy_table[index];
if ( if (
(phy != NULL) (phy != NULL)
&& scic_sds_port_active_phy(this_port, phy) && scic_sds_port_active_phy(sci_port, phy)
) { ) {
return phy; return phy;
} }
...@@ -304,50 +304,50 @@ static enum sci_status scic_sds_port_clear_phy( ...@@ -304,50 +304,50 @@ static enum sci_status scic_sds_port_clear_phy(
/** /**
* scic_sds_port_add_phy() - * scic_sds_port_add_phy() -
* @this_port: This parameter specifies the port in which the phy will be added. * @sci_port: This parameter specifies the port in which the phy will be added.
* @the_phy: This parameter is the phy which is to be added to the port. * @sci_phy: This parameter is the phy which is to be added to the port.
* *
* This method will add a PHY to the selected port. This method returns an * This method will add a PHY to the selected port. This method returns an
* enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other status * enum sci_status. SCI_SUCCESS the phy has been added to the port. Any other status
* is failre to add the phy to the port. * is failre to add the phy to the port.
*/ */
enum sci_status scic_sds_port_add_phy( enum sci_status scic_sds_port_add_phy(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
return this_port->state_handlers->add_phy_handler( return sci_port->state_handlers->add_phy_handler(
this_port, the_phy); sci_port, sci_phy);
} }
/** /**
* scic_sds_port_remove_phy() - * scic_sds_port_remove_phy() -
* @this_port: This parameter specifies the port in which the phy will be added. * @sci_port: This parameter specifies the port in which the phy will be added.
* @the_phy: This parameter is the phy which is to be added to the port. * @sci_phy: This parameter is the phy which is to be added to the port.
* *
* This method will remove the PHY from the selected PORT. This method returns * This method will remove the PHY from the selected PORT. This method returns
* an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any other * an enum sci_status. SCI_SUCCESS the phy has been removed from the port. Any other
* status is failre to add the phy to the port. * status is failre to add the phy to the port.
*/ */
enum sci_status scic_sds_port_remove_phy( enum sci_status scic_sds_port_remove_phy(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
return this_port->state_handlers->remove_phy_handler( return sci_port->state_handlers->remove_phy_handler(
this_port, the_phy); sci_port, sci_phy);
} }
/** /**
* This method requests the SAS address for the supplied SAS port from the SCI * This method requests the SAS address for the supplied SAS port from the SCI
* implementation. * implementation.
* @this_port: a handle corresponding to the SAS port for which to return the * @sci_port: a handle corresponding to the SAS port for which to return the
* SAS address. * SAS address.
* @sas_address: This parameter specifies a pointer to a SAS address structure * @sas_address: This parameter specifies a pointer to a SAS address structure
* into which the core will copy the SAS address for the port. * into which the core will copy the SAS address for the port.
* *
*/ */
void scic_sds_port_get_sas_address( void scic_sds_port_get_sas_address(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct sci_sas_address *sas_address) struct sci_sas_address *sas_address)
{ {
u32 index; u32 index;
...@@ -356,15 +356,15 @@ void scic_sds_port_get_sas_address( ...@@ -356,15 +356,15 @@ void scic_sds_port_get_sas_address(
sas_address->low = 0; sas_address->low = 0;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (this_port->phy_table[index] != NULL) { if (sci_port->phy_table[index] != NULL) {
scic_sds_phy_get_sas_address(this_port->phy_table[index], sas_address); scic_sds_phy_get_sas_address(sci_port->phy_table[index], sas_address);
} }
} }
} }
/** /**
* This method will indicate which protocols are supported by this port. * This method will indicate which protocols are supported by this port.
* @this_port: a handle corresponding to the SAS port for which to return the * @sci_port: a handle corresponding to the SAS port for which to return the
* supported protocols. * supported protocols.
* @protocols: This parameter specifies a pointer to an IAF protocol field * @protocols: This parameter specifies a pointer to an IAF protocol field
* structure into which the core will copy the protocol values for the port. * structure into which the core will copy the protocol values for the port.
...@@ -373,7 +373,7 @@ void scic_sds_port_get_sas_address( ...@@ -373,7 +373,7 @@ void scic_sds_port_get_sas_address(
* *
*/ */
static void scic_sds_port_get_protocols( static void scic_sds_port_get_protocols(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct sci_sas_identify_address_frame_protocols *protocols) struct sci_sas_identify_address_frame_protocols *protocols)
{ {
u8 index; u8 index;
...@@ -381,8 +381,8 @@ static void scic_sds_port_get_protocols( ...@@ -381,8 +381,8 @@ static void scic_sds_port_get_protocols(
protocols->u.all = 0; protocols->u.all = 0;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (this_port->phy_table[index] != NULL) { if (sci_port->phy_table[index] != NULL) {
scic_sds_phy_get_protocols(this_port->phy_table[index], protocols); scic_sds_phy_get_protocols(sci_port->phy_table[index], protocols);
} }
} }
} }
...@@ -390,7 +390,7 @@ static void scic_sds_port_get_protocols( ...@@ -390,7 +390,7 @@ static void scic_sds_port_get_protocols(
/** /**
* This method requests the SAS address for the device directly attached to * This method requests the SAS address for the device directly attached to
* this SAS port. * this SAS port.
* @this_port: a handle corresponding to the SAS port for which to return the * @sci_port: a handle corresponding to the SAS port for which to return the
* SAS address. * SAS address.
* @sas_address: This parameter specifies a pointer to a SAS address structure * @sas_address: This parameter specifies a pointer to a SAS address structure
* into which the core will copy the SAS address for the device directly * into which the core will copy the SAS address for the device directly
...@@ -398,7 +398,7 @@ static void scic_sds_port_get_protocols( ...@@ -398,7 +398,7 @@ static void scic_sds_port_get_protocols(
* *
*/ */
void scic_sds_port_get_attached_sas_address( void scic_sds_port_get_attached_sas_address(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct sci_sas_address *sas_address) struct sci_sas_address *sas_address)
{ {
struct sci_sas_identify_address_frame_protocols protocols; struct sci_sas_identify_address_frame_protocols protocols;
...@@ -407,7 +407,7 @@ void scic_sds_port_get_attached_sas_address( ...@@ -407,7 +407,7 @@ void scic_sds_port_get_attached_sas_address(
/* /*
* Ensure that the phy is both part of the port and currently * Ensure that the phy is both part of the port and currently
* connected to the remote end-point. */ * connected to the remote end-point. */
phy = scic_sds_port_get_a_connected_phy(this_port); phy = scic_sds_port_get_a_connected_phy(sci_port);
if (phy != NULL) { if (phy != NULL) {
scic_sds_phy_get_attached_phy_protocols(phy, &protocols); scic_sds_phy_get_attached_phy_protocols(phy, &protocols);
...@@ -426,7 +426,7 @@ void scic_sds_port_get_attached_sas_address( ...@@ -426,7 +426,7 @@ void scic_sds_port_get_attached_sas_address(
/** /**
* This method will indicate which protocols are supported by this remote * This method will indicate which protocols are supported by this remote
* device. * device.
* @this_port: a handle corresponding to the SAS port for which to return the * @sci_port: a handle corresponding to the SAS port for which to return the
* supported protocols. * supported protocols.
* @protocols: This parameter specifies a pointer to an IAF protocol field * @protocols: This parameter specifies a pointer to an IAF protocol field
* structure into which the core will copy the protocol values for the port. * structure into which the core will copy the protocol values for the port.
...@@ -435,7 +435,7 @@ void scic_sds_port_get_attached_sas_address( ...@@ -435,7 +435,7 @@ void scic_sds_port_get_attached_sas_address(
* *
*/ */
void scic_sds_port_get_attached_protocols( void scic_sds_port_get_attached_protocols(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct sci_sas_identify_address_frame_protocols *protocols) struct sci_sas_identify_address_frame_protocols *protocols)
{ {
struct scic_sds_phy *phy; struct scic_sds_phy *phy;
...@@ -443,7 +443,7 @@ void scic_sds_port_get_attached_protocols( ...@@ -443,7 +443,7 @@ void scic_sds_port_get_attached_protocols(
/* /*
* Ensure that the phy is both part of the port and currently * Ensure that the phy is both part of the port and currently
* connected to the remote end-point. */ * connected to the remote end-point. */
phy = scic_sds_port_get_a_connected_phy(this_port); phy = scic_sds_port_get_a_connected_phy(sci_port);
if (phy != NULL) if (phy != NULL)
scic_sds_phy_get_attached_phy_protocols(phy, protocols); scic_sds_phy_get_attached_phy_protocols(phy, protocols);
else else
...@@ -548,7 +548,7 @@ static void scic_sds_port_destroy_dummy_resources(struct scic_sds_port *sci_port ...@@ -548,7 +548,7 @@ static void scic_sds_port_destroy_dummy_resources(struct scic_sds_port *sci_port
* This method performs initialization of the supplied port. Initialization * This method performs initialization of the supplied port. Initialization
* includes: - state machine initialization - member variable initialization * includes: - state machine initialization - member variable initialization
* - configuring the phy_mask * - configuring the phy_mask
* @this_port: * @sci_port:
* @transport_layer_registers: * @transport_layer_registers:
* @port_task_scheduler_registers: * @port_task_scheduler_registers:
* @port_configuration_regsiter: * @port_configuration_regsiter:
...@@ -557,14 +557,14 @@ static void scic_sds_port_destroy_dummy_resources(struct scic_sds_port *sci_port ...@@ -557,14 +557,14 @@ static void scic_sds_port_destroy_dummy_resources(struct scic_sds_port *sci_port
* if the phy being added to the port * if the phy being added to the port
*/ */
enum sci_status scic_sds_port_initialize( enum sci_status scic_sds_port_initialize(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
void __iomem *port_task_scheduler_registers, void __iomem *port_task_scheduler_registers,
void __iomem *port_configuration_regsiter, void __iomem *port_configuration_regsiter,
void __iomem *viit_registers) void __iomem *viit_registers)
{ {
this_port->port_task_scheduler_registers = port_task_scheduler_registers; sci_port->port_task_scheduler_registers = port_task_scheduler_registers;
this_port->port_pe_configuration_register = port_configuration_regsiter; sci_port->port_pe_configuration_register = port_configuration_regsiter;
this_port->viit_registers = viit_registers; sci_port->viit_registers = viit_registers;
return SCI_SUCCESS; return SCI_SUCCESS;
} }
...@@ -622,27 +622,27 @@ enum sci_status scic_port_hard_reset( ...@@ -622,27 +622,27 @@ enum sci_status scic_port_hard_reset(
/** /**
* This method assigns the direct attached device ID for this port. * This method assigns the direct attached device ID for this port.
* *
* @param[in] this_port The port for which the direct attached device id is to * @param[in] sci_port The port for which the direct attached device id is to
* be assigned. * be assigned.
* @param[in] device_id The direct attached device ID to assign to the port. * @param[in] device_id The direct attached device ID to assign to the port.
* This will be the RNi for the device * This will be the RNi for the device
*/ */
void scic_sds_port_setup_transports( void scic_sds_port_setup_transports(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
u32 device_id) u32 device_id)
{ {
u8 index; u8 index;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (this_port->active_phy_mask & (1 << index)) if (sci_port->active_phy_mask & (1 << index))
scic_sds_phy_setup_transport(this_port->phy_table[index], device_id); scic_sds_phy_setup_transport(sci_port->phy_table[index], device_id);
} }
} }
/** /**
* *
* @this_port: This is the port on which the phy should be enabled. * @sci_port: This is the port on which the phy should be enabled.
* @the_phy: This is the specific phy which to enable. * @sci_phy: This is the specific phy which to enable.
* @do_notify_user: This parameter specifies whether to inform the user (via * @do_notify_user: This parameter specifies whether to inform the user (via
* scic_cb_port_link_up()) as to the fact that a new phy as become ready. * scic_cb_port_link_up()) as to the fact that a new phy as become ready.
* *
...@@ -696,8 +696,8 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port, ...@@ -696,8 +696,8 @@ void scic_sds_port_deactivate_phy(struct scic_sds_port *sci_port,
/** /**
* *
* @this_port: This is the port on which the phy should be disabled. * @sci_port: This is the port on which the phy should be disabled.
* @the_phy: This is the specific phy which to disabled. * @sci_phy: This is the specific phy which to disabled.
* *
* This function will disable the phy and report that the phy is not valid for * This function will disable the phy and report that the phy is not valid for
* this port object. None * this port object. None
...@@ -766,18 +766,18 @@ static void scic_sds_port_general_link_up_handler(struct scic_sds_port *sci_port ...@@ -766,18 +766,18 @@ static void scic_sds_port_general_link_up_handler(struct scic_sds_port *sci_port
* This method returns false if the port only has a single phy object assigned. * This method returns false if the port only has a single phy object assigned.
* If there are no phys or more than one phy then the method will return * If there are no phys or more than one phy then the method will return
* true. * true.
* @this_port: The port for which the wide port condition is to be checked. * @sci_port: The port for which the wide port condition is to be checked.
* *
* bool true Is returned if this is a wide ported port. false Is returned if * bool true Is returned if this is a wide ported port. false Is returned if
* this is a narrow port. * this is a narrow port.
*/ */
static bool scic_sds_port_is_wide(struct scic_sds_port *this_port) static bool scic_sds_port_is_wide(struct scic_sds_port *sci_port)
{ {
u32 index; u32 index;
u32 phy_count = 0; u32 phy_count = 0;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
if (this_port->phy_table[index] != NULL) { if (sci_port->phy_table[index] != NULL) {
phy_count++; phy_count++;
} }
} }
...@@ -790,8 +790,8 @@ static bool scic_sds_port_is_wide(struct scic_sds_port *this_port) ...@@ -790,8 +790,8 @@ static bool scic_sds_port_is_wide(struct scic_sds_port *this_port)
* port wants the PHY to continue on to the link up state then the port * port wants the PHY to continue on to the link up state then the port
* layer must return true. If the port object returns false the phy object * layer must return true. If the port object returns false the phy object
* must halt its attempt to go link up. * must halt its attempt to go link up.
* @this_port: The port associated with the phy object. * @sci_port: The port associated with the phy object.
* @the_phy: The phy object that is trying to go link up. * @sci_phy: The phy object that is trying to go link up.
* *
* true if the phy object can continue to the link up condition. true Is * true if the phy object can continue to the link up condition. true Is
* returned if this phy can continue to the ready state. false Is returned if * returned if this phy can continue to the ready state. false Is returned if
...@@ -800,19 +800,19 @@ static bool scic_sds_port_is_wide(struct scic_sds_port *this_port) ...@@ -800,19 +800,19 @@ static bool scic_sds_port_is_wide(struct scic_sds_port *this_port)
* devices this could become an invalid port configuration. * devices this could become an invalid port configuration.
*/ */
bool scic_sds_port_link_detected( bool scic_sds_port_link_detected(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
struct sci_sas_identify_address_frame_protocols protocols; struct sci_sas_identify_address_frame_protocols protocols;
scic_sds_phy_get_attached_phy_protocols(the_phy, &protocols); scic_sds_phy_get_attached_phy_protocols(sci_phy, &protocols);
if ( if (
(this_port->logical_port_index != SCIC_SDS_DUMMY_PORT) (sci_port->logical_port_index != SCIC_SDS_DUMMY_PORT)
&& (protocols.u.bits.stp_target) && (protocols.u.bits.stp_target)
&& scic_sds_port_is_wide(this_port) && scic_sds_port_is_wide(sci_port)
) { ) {
scic_sds_port_invalid_link_up(this_port, the_phy); scic_sds_port_invalid_link_up(sci_port, sci_phy);
return false; return false;
} }
...@@ -823,65 +823,65 @@ bool scic_sds_port_link_detected( ...@@ -823,65 +823,65 @@ bool scic_sds_port_link_detected(
/** /**
* This method is the entry point for the phy to inform the port that it is now * This method is the entry point for the phy to inform the port that it is now
* in a ready state * in a ready state
* @this_port: * @sci_port:
* *
* *
*/ */
void scic_sds_port_link_up( void scic_sds_port_link_up(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
the_phy->is_in_link_training = false; sci_phy->is_in_link_training = false;
this_port->state_handlers->link_up_handler(this_port, the_phy); sci_port->state_handlers->link_up_handler(sci_port, sci_phy);
} }
/** /**
* This method is the entry point for the phy to inform the port that it is no * This method is the entry point for the phy to inform the port that it is no
* longer in a ready state * longer in a ready state
* @this_port: * @sci_port:
* *
* *
*/ */
void scic_sds_port_link_down( void scic_sds_port_link_down(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
this_port->state_handlers->link_down_handler(this_port, the_phy); sci_port->state_handlers->link_down_handler(sci_port, sci_phy);
} }
/** /**
* This method is called to start an IO request on this port. * This method is called to start an IO request on this port.
* @this_port: * @sci_port:
* @the_device: * @sci_dev:
* @the_io_request: * @sci_req:
* *
* enum sci_status * enum sci_status
*/ */
enum sci_status scic_sds_port_start_io( enum sci_status scic_sds_port_start_io(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *the_io_request) struct scic_sds_request *sci_req)
{ {
return this_port->state_handlers->start_io_handler( return sci_port->state_handlers->start_io_handler(
this_port, the_device, the_io_request); sci_port, sci_dev, sci_req);
} }
/** /**
* This method is called to complete an IO request to the port. * This method is called to complete an IO request to the port.
* @this_port: * @sci_port:
* @the_device: * @sci_dev:
* @the_io_request: * @sci_req:
* *
* enum sci_status * enum sci_status
*/ */
enum sci_status scic_sds_port_complete_io( enum sci_status scic_sds_port_complete_io(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *the_io_request) struct scic_sds_request *sci_req)
{ {
return this_port->state_handlers->complete_io_handler( return sci_port->state_handlers->complete_io_handler(
this_port, the_device, the_io_request); sci_port, sci_dev, sci_req);
} }
/** /**
...@@ -945,40 +945,40 @@ static void scic_sds_port_timeout_handler(void *port) ...@@ -945,40 +945,40 @@ static void scic_sds_port_timeout_handler(void *port)
* *
* *
*/ */
static void scic_sds_port_update_viit_entry(struct scic_sds_port *this_port) static void scic_sds_port_update_viit_entry(struct scic_sds_port *sci_port)
{ {
struct sci_sas_address sas_address; struct sci_sas_address sas_address;
scic_sds_port_get_sas_address(this_port, &sas_address); scic_sds_port_get_sas_address(sci_port, &sas_address);
writel(sas_address.high, writel(sas_address.high,
&this_port->viit_registers->initiator_sas_address_hi); &sci_port->viit_registers->initiator_sas_address_hi);
writel(sas_address.low, writel(sas_address.low,
&this_port->viit_registers->initiator_sas_address_lo); &sci_port->viit_registers->initiator_sas_address_lo);
/* This value get cleared just in case its not already cleared */ /* This value get cleared just in case its not already cleared */
writel(0, &this_port->viit_registers->reserved); writel(0, &sci_port->viit_registers->reserved);
/* We are required to update the status register last */ /* We are required to update the status register last */
writel(SCU_VIIT_ENTRY_ID_VIIT | writel(SCU_VIIT_ENTRY_ID_VIIT |
SCU_VIIT_IPPT_INITIATOR | SCU_VIIT_IPPT_INITIATOR |
((1 << this_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) | ((1 << sci_port->physical_port_index) << SCU_VIIT_ENTRY_LPVIE_SHIFT) |
SCU_VIIT_STATUS_ALL_VALID, SCU_VIIT_STATUS_ALL_VALID,
&this_port->viit_registers->status); &sci_port->viit_registers->status);
} }
/** /**
* This method returns the maximum allowed speed for data transfers on this * This method returns the maximum allowed speed for data transfers on this
* port. This maximum allowed speed evaluates to the maximum speed of the * port. This maximum allowed speed evaluates to the maximum speed of the
* slowest phy in the port. * slowest phy in the port.
* @this_port: This parameter specifies the port for which to retrieve the * @sci_port: This parameter specifies the port for which to retrieve the
* maximum allowed speed. * maximum allowed speed.
* *
* This method returns the maximum negotiated speed of the slowest phy in the * This method returns the maximum negotiated speed of the slowest phy in the
* port. * port.
*/ */
enum sas_linkrate scic_sds_port_get_max_allowed_speed( enum sas_linkrate scic_sds_port_get_max_allowed_speed(
struct scic_sds_port *this_port) struct scic_sds_port *sci_port)
{ {
u16 index; u16 index;
enum sas_linkrate max_allowed_speed = SAS_LINK_RATE_6_0_GBPS; enum sas_linkrate max_allowed_speed = SAS_LINK_RATE_6_0_GBPS;
...@@ -988,10 +988,10 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed( ...@@ -988,10 +988,10 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed(
* Loop through all of the phys in this port and find the phy with the * Loop through all of the phys in this port and find the phy with the
* lowest maximum link rate. */ * lowest maximum link rate. */
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
phy = this_port->phy_table[index]; phy = sci_port->phy_table[index];
if ( if (
(phy != NULL) (phy != NULL)
&& (scic_sds_port_active_phy(this_port, phy) == true) && (scic_sds_port_active_phy(sci_port, phy) == true)
&& (phy->max_negotiated_speed < max_allowed_speed) && (phy->max_negotiated_speed < max_allowed_speed)
) )
max_allowed_speed = phy->max_negotiated_speed; max_allowed_speed = phy->max_negotiated_speed;
...@@ -1003,8 +1003,8 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed( ...@@ -1003,8 +1003,8 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed(
/** /**
* This method passes the event to core user. * This method passes the event to core user.
* @this_port: The port that a BCN happens. * @sci_port: The port that a BCN happens.
* @this_phy: The phy that receives BCN. * @sci_phy: The phy that receives BCN.
* *
*/ */
void scic_sds_port_broadcast_change_received( void scic_sds_port_broadcast_change_received(
...@@ -1022,7 +1022,7 @@ void scic_sds_port_broadcast_change_received( ...@@ -1022,7 +1022,7 @@ void scic_sds_port_broadcast_change_received(
/** /**
* This API methhod enables the broadcast change notification from underneath * This API methhod enables the broadcast change notification from underneath
* hardware. * hardware.
* @this_port: The port that a BCN had been disabled from. * @sci_port: The port that a BCN had been disabled from.
* *
*/ */
void scic_port_enable_broadcast_change_notification( void scic_port_enable_broadcast_change_notification(
...@@ -1134,25 +1134,25 @@ static enum sci_status scic_sds_port_ready_substate_remove_phy_handler( ...@@ -1134,25 +1134,25 @@ static enum sci_status scic_sds_port_ready_substate_remove_phy_handler(
/** /**
* *
* @this_port: This is the struct scic_sds_port object that which has a phy that has * @sci_port: This is the struct scic_sds_port object that which has a phy that has
* gone link up. * gone link up.
* @the_phy: This is the struct scic_sds_phy object that has gone link up. * @sci_phy: This is the struct scic_sds_phy object that has gone link up.
* *
* This method is the ready waiting substate link up handler for the * This method is the ready waiting substate link up handler for the
* struct scic_sds_port object. This methos will report the link up condition for * struct scic_sds_port object. This methos will report the link up condition for
* this port and will transition to the ready operational substate. none * this port and will transition to the ready operational substate. none
*/ */
static void scic_sds_port_ready_waiting_substate_link_up_handler( static void scic_sds_port_ready_waiting_substate_link_up_handler(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
/* /*
* Since this is the first phy going link up for the port we can just enable * Since this is the first phy going link up for the port we can just enable
* it and continue. */ * it and continue. */
scic_sds_port_activate_phy(this_port, the_phy, true); scic_sds_port_activate_phy(sci_port, sci_phy, true);
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_port->ready_substate_machine, &sci_port->ready_substate_machine,
SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL
); );
} }
...@@ -1224,19 +1224,19 @@ sci_status scic_sds_port_ready_operational_substate_reset_handler( ...@@ -1224,19 +1224,19 @@ sci_status scic_sds_port_ready_operational_substate_reset_handler(
/** /**
* scic_sds_port_ready_operational_substate_link_up_handler() - * scic_sds_port_ready_operational_substate_link_up_handler() -
* @this_port: This is the struct scic_sds_port object that which has a phy that has * @sci_port: This is the struct scic_sds_port object that which has a phy that has
* gone link up. * gone link up.
* @the_phy: This is the struct scic_sds_phy object that has gone link up. * @sci_phy: This is the struct scic_sds_phy object that has gone link up.
* *
* This method is the ready operational substate link up handler for the * This method is the ready operational substate link up handler for the
* struct scic_sds_port object. This function notifies the SCI User that the phy has * struct scic_sds_port object. This function notifies the SCI User that the phy has
* gone link up. none * gone link up. none
*/ */
static void scic_sds_port_ready_operational_substate_link_up_handler( static void scic_sds_port_ready_operational_substate_link_up_handler(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy) struct scic_sds_phy *sci_phy)
{ {
scic_sds_port_general_link_up_handler(this_port, the_phy, true); scic_sds_port_general_link_up_handler(sci_port, sci_phy, true);
} }
/** /**
...@@ -1534,7 +1534,7 @@ scic_sds_port_ready_substate_handler_table[SCIC_SDS_PORT_READY_MAX_SUBSTATES] = ...@@ -1534,7 +1534,7 @@ scic_sds_port_ready_substate_handler_table[SCIC_SDS_PORT_READY_MAX_SUBSTATES] =
/** /**
* *
* @this_port: This is the struct scic_sds_port object to suspend. * @sci_port: This is the struct scic_sds_port object to suspend.
* *
* This method will susped the port task scheduler for this port object. none * This method will susped the port task scheduler for this port object. none
*/ */
...@@ -1602,7 +1602,7 @@ static void scic_sds_port_abort_dummy_request(struct scic_sds_port *sci_port) ...@@ -1602,7 +1602,7 @@ static void scic_sds_port_abort_dummy_request(struct scic_sds_port *sci_port)
/** /**
* *
* @this_port: This is the struct scic_sds_port object to resume. * @sci_port: This is the struct scic_sds_port object to resume.
* *
* This method will resume the port task scheduler for this port object. none * This method will resume the port task scheduler for this port object. none
*/ */
...@@ -1633,20 +1633,20 @@ scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port) ...@@ -1633,20 +1633,20 @@ scic_sds_port_resume_port_task_scheduler(struct scic_sds_port *port)
static void scic_sds_port_ready_substate_waiting_enter( static void scic_sds_port_ready_substate_waiting_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_port *this_port = (struct scic_sds_port *)object; struct scic_sds_port *sci_port = (struct scic_sds_port *)object;
scic_sds_port_set_ready_state_handlers( scic_sds_port_set_ready_state_handlers(
this_port, SCIC_SDS_PORT_READY_SUBSTATE_WAITING sci_port, SCIC_SDS_PORT_READY_SUBSTATE_WAITING
); );
scic_sds_port_suspend_port_task_scheduler(this_port); scic_sds_port_suspend_port_task_scheduler(sci_port);
this_port->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS; sci_port->not_ready_reason = SCIC_PORT_NOT_READY_NO_ACTIVE_PHYS;
if (this_port->active_phy_mask != 0) { if (sci_port->active_phy_mask != 0) {
/* At least one of the phys on the port is ready */ /* At least one of the phys on the port is ready */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_port->ready_substate_machine, &sci_port->ready_substate_machine,
SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL SCIC_SDS_PORT_READY_SUBSTATE_OPERATIONAL
); );
} }
...@@ -1766,9 +1766,9 @@ static void scic_sds_port_ready_substate_configuring_enter( ...@@ -1766,9 +1766,9 @@ static void scic_sds_port_ready_substate_configuring_enter(
static void scic_sds_port_ready_substate_configuring_exit( static void scic_sds_port_ready_substate_configuring_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_port *this_port = (struct scic_sds_port *)object; struct scic_sds_port *sci_port = (struct scic_sds_port *)object;
scic_sds_port_suspend_port_task_scheduler(this_port); scic_sds_port_suspend_port_task_scheduler(sci_port);
} }
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
...@@ -2160,7 +2160,7 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] = ...@@ -2160,7 +2160,7 @@ scic_sds_port_state_handler_table[SCI_BASE_PORT_MAX_STATES] =
/** /**
* *
* @this_port: This is the port object which to suspend. * @sci_port: This is the port object which to suspend.
* *
* This method will enable the SCU Port Task Scheduler for this port object but * This method will enable the SCU Port Task Scheduler for this port object but
* will leave the port task scheduler in a suspended state. none * will leave the port task scheduler in a suspended state. none
...@@ -2177,7 +2177,7 @@ scic_sds_port_enable_port_task_scheduler(struct scic_sds_port *port) ...@@ -2177,7 +2177,7 @@ scic_sds_port_enable_port_task_scheduler(struct scic_sds_port *port)
/** /**
* *
* @this_port: This is the port object which to resume. * @sci_port: This is the port object which to resume.
* *
* This method will disable the SCU port task scheduler for this port object. * This method will disable the SCU port task scheduler for this port object.
* none * none
...@@ -2263,23 +2263,23 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct scic_sds_port *sci ...@@ -2263,23 +2263,23 @@ static void scic_sds_port_invalidate_dummy_remote_node(struct scic_sds_port *sci
static void scic_sds_port_stopped_state_enter( static void scic_sds_port_stopped_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_port *this_port; struct scic_sds_port *sci_port;
this_port = (struct scic_sds_port *)object; sci_port = (struct scic_sds_port *)object;
scic_sds_port_set_base_state_handlers( scic_sds_port_set_base_state_handlers(
this_port, SCI_BASE_PORT_STATE_STOPPED sci_port, SCI_BASE_PORT_STATE_STOPPED
); );
if ( if (
SCI_BASE_PORT_STATE_STOPPING SCI_BASE_PORT_STATE_STOPPING
== this_port->state_machine.previous_state_id == sci_port->state_machine.previous_state_id
) { ) {
/* /*
* If we enter this state becasuse of a request to stop * If we enter this state becasuse of a request to stop
* the port then we want to disable the hardwares port * the port then we want to disable the hardwares port
* task scheduler. */ * task scheduler. */
scic_sds_port_disable_port_task_scheduler(this_port); scic_sds_port_disable_port_task_scheduler(sci_port);
} }
} }
...@@ -2294,12 +2294,12 @@ static void scic_sds_port_stopped_state_enter( ...@@ -2294,12 +2294,12 @@ static void scic_sds_port_stopped_state_enter(
static void scic_sds_port_stopped_state_exit( static void scic_sds_port_stopped_state_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_port *this_port; struct scic_sds_port *sci_port;
this_port = (struct scic_sds_port *)object; sci_port = (struct scic_sds_port *)object;
/* Enable and suspend the port task scheduler */ /* Enable and suspend the port task scheduler */
scic_sds_port_enable_port_task_scheduler(this_port); scic_sds_port_enable_port_task_scheduler(sci_port);
} }
/** /**
...@@ -2360,12 +2360,12 @@ static void scic_sds_port_ready_state_exit(struct sci_base_object *object) ...@@ -2360,12 +2360,12 @@ static void scic_sds_port_ready_state_exit(struct sci_base_object *object)
static void scic_sds_port_resetting_state_enter( static void scic_sds_port_resetting_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_port *this_port; struct scic_sds_port *sci_port;
this_port = (struct scic_sds_port *)object; sci_port = (struct scic_sds_port *)object;
scic_sds_port_set_base_state_handlers( scic_sds_port_set_base_state_handlers(
this_port, SCI_BASE_PORT_STATE_RESETTING sci_port, SCI_BASE_PORT_STATE_RESETTING
); );
} }
...@@ -2397,12 +2397,12 @@ static inline void scic_sds_port_resetting_state_exit( ...@@ -2397,12 +2397,12 @@ static inline void scic_sds_port_resetting_state_exit(
static void scic_sds_port_stopping_state_enter( static void scic_sds_port_stopping_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_port *this_port; struct scic_sds_port *sci_port;
this_port = (struct scic_sds_port *)object; sci_port = (struct scic_sds_port *)object;
scic_sds_port_set_base_state_handlers( scic_sds_port_set_base_state_handlers(
this_port, SCI_BASE_PORT_STATE_STOPPING sci_port, SCI_BASE_PORT_STATE_STOPPING
); );
} }
......
...@@ -378,77 +378,77 @@ static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *s ...@@ -378,77 +378,77 @@ static inline void scic_sds_port_decrement_request_count(struct scic_sds_port *s
(((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0) (((port)->active_phy_mask & (1 << (phy)->phy_index)) != 0)
void scic_sds_port_construct( void scic_sds_port_construct(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
u8 port_index, u8 port_index,
struct scic_sds_controller *owning_controller); struct scic_sds_controller *scic);
enum sci_status scic_sds_port_initialize( enum sci_status scic_sds_port_initialize(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
void __iomem *port_task_scheduler_registers, void __iomem *port_task_scheduler_registers,
void __iomem *port_configuration_regsiter, void __iomem *port_configuration_regsiter,
void __iomem *viit_registers); void __iomem *viit_registers);
enum sci_status scic_sds_port_add_phy( enum sci_status scic_sds_port_add_phy(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy); struct scic_sds_phy *sci_phy);
enum sci_status scic_sds_port_remove_phy( enum sci_status scic_sds_port_remove_phy(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *the_phy); struct scic_sds_phy *sci_phy);
void scic_sds_port_setup_transports( void scic_sds_port_setup_transports(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
u32 device_id); u32 device_id);
void scic_sds_port_deactivate_phy( void scic_sds_port_deactivate_phy(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *phy, struct scic_sds_phy *sci_phy,
bool do_notify_user); bool do_notify_user);
bool scic_sds_port_link_detected( bool scic_sds_port_link_detected(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *phy); struct scic_sds_phy *sci_phy);
void scic_sds_port_link_up( void scic_sds_port_link_up(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *phy); struct scic_sds_phy *sci_phy);
void scic_sds_port_link_down( void scic_sds_port_link_down(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *phy); struct scic_sds_phy *sci_phy);
enum sci_status scic_sds_port_start_io( enum sci_status scic_sds_port_start_io(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *the_io_request); struct scic_sds_request *sci_req);
enum sci_status scic_sds_port_complete_io( enum sci_status scic_sds_port_complete_io(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_remote_device *the_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *the_io_request); struct scic_sds_request *sci_req);
enum sas_linkrate scic_sds_port_get_max_allowed_speed( enum sas_linkrate scic_sds_port_get_max_allowed_speed(
struct scic_sds_port *this_port); struct scic_sds_port *sci_port);
void scic_sds_port_broadcast_change_received( void scic_sds_port_broadcast_change_received(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *this_phy); struct scic_sds_phy *sci_phy);
bool scic_sds_port_is_valid_phy_assignment( bool scic_sds_port_is_valid_phy_assignment(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
u32 phy_index); u32 phy_index);
void scic_sds_port_get_sas_address( void scic_sds_port_get_sas_address(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct sci_sas_address *sas_address); struct sci_sas_address *sas_address);
void scic_sds_port_get_attached_sas_address( void scic_sds_port_get_attached_sas_address(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct sci_sas_address *sas_address); struct sci_sas_address *sas_address);
void scic_sds_port_get_attached_protocols( void scic_sds_port_get_attached_protocols(
struct scic_sds_port *this_port, struct scic_sds_port *sci_port,
struct sci_sas_identify_address_frame_protocols *protocols); struct sci_sas_identify_address_frame_protocols *protocols);
#endif /* _SCIC_SDS_PORT_H_ */ #endif /* _SCIC_SDS_PORT_H_ */
...@@ -149,17 +149,17 @@ enum sci_status scic_remote_device_da_construct( ...@@ -149,17 +149,17 @@ enum sci_status scic_remote_device_da_construct(
static void scic_sds_remote_device_get_info_from_smp_discover_response( static void scic_sds_remote_device_get_info_from_smp_discover_response(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct smp_response_discover *discover_response) struct smp_response_discover *discover_response)
{ {
/* decode discover_response to set sas_address to this_device. */ /* decode discover_response to set sas_address to sci_dev. */
this_device->device_address.high = sci_dev->device_address.high =
discover_response->attached_sas_address.high; discover_response->attached_sas_address.high;
this_device->device_address.low = sci_dev->device_address.low =
discover_response->attached_sas_address.low; discover_response->attached_sas_address.low;
this_device->target_protocols.u.all = discover_response->protocols.u.all; sci_dev->target_protocols.u.all = discover_response->protocols.u.all;
} }
...@@ -168,15 +168,15 @@ enum sci_status scic_remote_device_ea_construct( ...@@ -168,15 +168,15 @@ enum sci_status scic_remote_device_ea_construct(
struct smp_response_discover *discover_response) struct smp_response_discover *discover_response)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_controller *the_controller; struct scic_sds_controller *scic;
the_controller = scic_sds_port_get_controller(sci_dev->owning_port); scic = scic_sds_port_get_controller(sci_dev->owning_port);
scic_sds_remote_device_get_info_from_smp_discover_response( scic_sds_remote_device_get_info_from_smp_discover_response(
sci_dev, discover_response); sci_dev, discover_response);
status = scic_sds_controller_allocate_remote_node_context( status = scic_sds_controller_allocate_remote_node_context(
the_controller, sci_dev, &sci_dev->rnc->remote_node_index); scic, sci_dev, &sci_dev->rnc->remote_node_index);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
if (sci_dev->target_protocols.u.bits.attached_ssp_target) { if (sci_dev->target_protocols.u.bits.attached_ssp_target) {
...@@ -294,32 +294,32 @@ bool scic_remote_device_is_atapi(struct scic_sds_remote_device *sci_dev) ...@@ -294,32 +294,32 @@ bool scic_remote_device_is_atapi(struct scic_sds_remote_device *sci_dev)
/** /**
* *
* @this_device: The remote device for which the suspend is being requested. * @sci_dev: The remote device for which the suspend is being requested.
* *
* This method invokes the remote device suspend state handler. enum sci_status * This method invokes the remote device suspend state handler. enum sci_status
*/ */
enum sci_status scic_sds_remote_device_suspend( enum sci_status scic_sds_remote_device_suspend(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 suspend_type) u32 suspend_type)
{ {
return this_device->state_handlers->suspend_handler(this_device, suspend_type); return sci_dev->state_handlers->suspend_handler(sci_dev, suspend_type);
} }
/** /**
* *
* @this_device: The remote device for which the resume is being requested. * @sci_dev: The remote device for which the resume is being requested.
* *
* This method invokes the remote device resume state handler. enum sci_status * This method invokes the remote device resume state handler. enum sci_status
*/ */
enum sci_status scic_sds_remote_device_resume( enum sci_status scic_sds_remote_device_resume(
struct scic_sds_remote_device *this_device) struct scic_sds_remote_device *sci_dev)
{ {
return this_device->state_handlers->resume_handler(this_device); return sci_dev->state_handlers->resume_handler(sci_dev);
} }
/** /**
* *
* @this_device: The remote device for which the event handling is being * @sci_dev: The remote device for which the event handling is being
* requested. * requested.
* @frame_index: This is the frame index that is being processed. * @frame_index: This is the frame index that is being processed.
* *
...@@ -327,31 +327,31 @@ enum sci_status scic_sds_remote_device_resume( ...@@ -327,31 +327,31 @@ enum sci_status scic_sds_remote_device_resume(
* enum sci_status * enum sci_status
*/ */
enum sci_status scic_sds_remote_device_frame_handler( enum sci_status scic_sds_remote_device_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index) u32 frame_index)
{ {
return this_device->state_handlers->frame_handler(this_device, frame_index); return sci_dev->state_handlers->frame_handler(sci_dev, frame_index);
} }
/** /**
* *
* @this_device: The remote device for which the event handling is being * @sci_dev: The remote device for which the event handling is being
* requested. * requested.
* @event_code: This is the event code that is to be processed. * @event_code: This is the event code that is to be processed.
* *
* This method invokes the remote device event handler. enum sci_status * This method invokes the remote device event handler. enum sci_status
*/ */
enum sci_status scic_sds_remote_device_event_handler( enum sci_status scic_sds_remote_device_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code) u32 event_code)
{ {
return this_device->state_handlers->event_handler(this_device, event_code); return sci_dev->state_handlers->event_handler(sci_dev, event_code);
} }
/** /**
* *
* @controller: The controller that is starting the io request. * @controller: The controller that is starting the io request.
* @this_device: The remote device for which the start io handling is being * @sci_dev: The remote device for which the start io handling is being
* requested. * requested.
* @io_request: The io request that is being started. * @io_request: The io request that is being started.
* *
...@@ -359,17 +359,17 @@ enum sci_status scic_sds_remote_device_event_handler( ...@@ -359,17 +359,17 @@ enum sci_status scic_sds_remote_device_event_handler(
*/ */
enum sci_status scic_sds_remote_device_start_io( enum sci_status scic_sds_remote_device_start_io(
struct scic_sds_controller *controller, struct scic_sds_controller *controller,
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *io_request) struct scic_sds_request *io_request)
{ {
return this_device->state_handlers->start_io_handler( return sci_dev->state_handlers->start_io_handler(
this_device, io_request); sci_dev, io_request);
} }
/** /**
* *
* @controller: The controller that is completing the io request. * @controller: The controller that is completing the io request.
* @this_device: The remote device for which the complete io handling is being * @sci_dev: The remote device for which the complete io handling is being
* requested. * requested.
* @io_request: The io request that is being completed. * @io_request: The io request that is being completed.
* *
...@@ -377,17 +377,17 @@ enum sci_status scic_sds_remote_device_start_io( ...@@ -377,17 +377,17 @@ enum sci_status scic_sds_remote_device_start_io(
*/ */
enum sci_status scic_sds_remote_device_complete_io( enum sci_status scic_sds_remote_device_complete_io(
struct scic_sds_controller *controller, struct scic_sds_controller *controller,
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *io_request) struct scic_sds_request *io_request)
{ {
return this_device->state_handlers->complete_io_handler( return sci_dev->state_handlers->complete_io_handler(
this_device, io_request); sci_dev, io_request);
} }
/** /**
* *
* @controller: The controller that is starting the task request. * @controller: The controller that is starting the task request.
* @this_device: The remote device for which the start task handling is being * @sci_dev: The remote device for which the start task handling is being
* requested. * requested.
* @io_request: The task request that is being started. * @io_request: The task request that is being started.
* *
...@@ -395,17 +395,17 @@ enum sci_status scic_sds_remote_device_complete_io( ...@@ -395,17 +395,17 @@ enum sci_status scic_sds_remote_device_complete_io(
*/ */
enum sci_status scic_sds_remote_device_start_task( enum sci_status scic_sds_remote_device_start_task(
struct scic_sds_controller *controller, struct scic_sds_controller *controller,
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *io_request) struct scic_sds_request *io_request)
{ {
return this_device->state_handlers->start_task_handler( return sci_dev->state_handlers->start_task_handler(
this_device, io_request); sci_dev, io_request);
} }
/** /**
* *
* @controller: The controller that is completing the task request. * @controller: The controller that is completing the task request.
* @this_device: The remote device for which the complete task handling is * @sci_dev: The remote device for which the complete task handling is
* being requested. * being requested.
* @io_request: The task request that is being completed. * @io_request: The task request that is being completed.
* *
...@@ -414,22 +414,22 @@ enum sci_status scic_sds_remote_device_start_task( ...@@ -414,22 +414,22 @@ enum sci_status scic_sds_remote_device_start_task(
/** /**
* *
* @this_device: * @sci_dev:
* @request: * @request:
* *
* This method takes the request and bulids an appropriate SCU context for the * This method takes the request and bulids an appropriate SCU context for the
* request and then requests the controller to post the request. none * request and then requests the controller to post the request. none
*/ */
void scic_sds_remote_device_post_request( void scic_sds_remote_device_post_request(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 request) u32 request)
{ {
u32 context; u32 context;
context = scic_sds_remote_device_build_command_context(this_device, request); context = scic_sds_remote_device_build_command_context(sci_dev, request);
scic_sds_controller_post_request( scic_sds_controller_post_request(
scic_sds_remote_device_get_controller(this_device), scic_sds_remote_device_get_controller(sci_dev),
context context
); );
} }
...@@ -437,22 +437,22 @@ void scic_sds_remote_device_post_request( ...@@ -437,22 +437,22 @@ void scic_sds_remote_device_post_request(
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
/** /**
* *
* @this_device: The device to be checked. * @sci_dev: The device to be checked.
* *
* This method check the signature fis of a stp device to decide whether a * This method check the signature fis of a stp device to decide whether a
* device is atapi or not. true if a device is atapi device. False if a device * device is atapi or not. true if a device is atapi device. False if a device
* is not atapi. * is not atapi.
*/ */
bool scic_sds_remote_device_is_atapi( bool scic_sds_remote_device_is_atapi(
struct scic_sds_remote_device *this_device) struct scic_sds_remote_device *sci_dev)
{ {
if (!this_device->target_protocols.u.bits.attached_stp_target) if (!sci_dev->target_protocols.u.bits.attached_stp_target)
return false; return false;
else if (this_device->is_direct_attached) { else if (sci_dev->is_direct_attached) {
struct scic_sds_phy *phy; struct scic_sds_phy *phy;
struct scic_sata_phy_properties properties; struct scic_sata_phy_properties properties;
struct sata_fis_reg_d2h *signature_fis; struct sata_fis_reg_d2h *signature_fis;
phy = scic_sds_port_get_a_connected_phy(this_device->owning_port); phy = scic_sds_port_get_a_connected_phy(sci_dev->owning_port);
scic_sata_phy_get_properties(phy, &properties); scic_sata_phy_get_properties(phy, &properties);
/* decode the signature fis. */ /* decode the signature fis. */
...@@ -506,16 +506,16 @@ static void scic_sds_cb_remote_device_rnc_destruct_complete( ...@@ -506,16 +506,16 @@ static void scic_sds_cb_remote_device_rnc_destruct_complete(
static void scic_sds_remote_device_resume_complete_handler( static void scic_sds_remote_device_resume_complete_handler(
void *user_parameter) void *user_parameter)
{ {
struct scic_sds_remote_device *this_device; struct scic_sds_remote_device *sci_dev;
this_device = (struct scic_sds_remote_device *)user_parameter; sci_dev = (struct scic_sds_remote_device *)user_parameter;
if ( if (
sci_base_state_machine_get_state(&this_device->state_machine) sci_base_state_machine_get_state(&sci_dev->state_machine)
!= SCI_BASE_REMOTE_DEVICE_STATE_READY != SCI_BASE_REMOTE_DEVICE_STATE_READY
) { ) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->state_machine, &sci_dev->state_machine,
SCI_BASE_REMOTE_DEVICE_STATE_READY SCI_BASE_REMOTE_DEVICE_STATE_READY
); );
} }
...@@ -532,16 +532,16 @@ static void scic_sds_remote_device_resume_complete_handler( ...@@ -532,16 +532,16 @@ static void scic_sds_remote_device_resume_complete_handler(
* requests and task requests of all types. none * requests and task requests of all types. none
*/ */
void scic_sds_remote_device_start_request( void scic_sds_remote_device_start_request(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *the_request, struct scic_sds_request *sci_req,
enum sci_status status) enum sci_status status)
{ {
/* We still have a fault in starting the io complete it on the port */ /* We still have a fault in starting the io complete it on the port */
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
scic_sds_remote_device_increment_request_count(this_device); scic_sds_remote_device_increment_request_count(sci_dev);
else{ else{
this_device->owning_port->state_handlers->complete_io_handler( sci_dev->owning_port->state_handlers->complete_io_handler(
this_device->owning_port, this_device, the_request sci_dev->owning_port, sci_dev, sci_req
); );
} }
} }
...@@ -576,7 +576,7 @@ void scic_sds_remote_device_continue_request(void *dev) ...@@ -576,7 +576,7 @@ void scic_sds_remote_device_continue_request(void *dev)
/** /**
* This method will terminate all of the IO requests in the controllers IO * This method will terminate all of the IO requests in the controllers IO
* request table that were targeted for this device. * request table that were targeted for this device.
* @this_device: This parameter specifies the remote device for which to * @sci_dev: This parameter specifies the remote device for which to
* attempt to terminate all requests. * attempt to terminate all requests.
* *
* This method returns an indication as to whether all requests were * This method returns an indication as to whether all requests were
...@@ -584,24 +584,24 @@ void scic_sds_remote_device_continue_request(void *dev) ...@@ -584,24 +584,24 @@ void scic_sds_remote_device_continue_request(void *dev)
* this method will return the failure. * this method will return the failure.
*/ */
static enum sci_status scic_sds_remote_device_terminate_requests( static enum sci_status scic_sds_remote_device_terminate_requests(
struct scic_sds_remote_device *this_device) struct scic_sds_remote_device *sci_dev)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
enum sci_status terminate_status = SCI_SUCCESS; enum sci_status terminate_status = SCI_SUCCESS;
struct scic_sds_request *the_request; struct scic_sds_request *sci_req;
u32 index; u32 index;
u32 request_count = this_device->started_request_count; u32 request_count = sci_dev->started_request_count;
for (index = 0; for (index = 0;
(index < SCI_MAX_IO_REQUESTS) && (request_count > 0); (index < SCI_MAX_IO_REQUESTS) && (request_count > 0);
index++) { index++) {
the_request = this_device->owning_port->owning_controller->io_request_table[index]; sci_req = sci_dev->owning_port->owning_controller->io_request_table[index];
if ((the_request != NULL) && (the_request->target_device == this_device)) { if ((sci_req != NULL) && (sci_req->target_device == sci_dev)) {
terminate_status = scic_controller_terminate_request( terminate_status = scic_controller_terminate_request(
this_device->owning_port->owning_controller, sci_dev->owning_port->owning_controller,
this_device, sci_dev,
the_request sci_req
); );
if (terminate_status != SCI_SUCCESS) if (terminate_status != SCI_SUCCESS)
...@@ -684,7 +684,7 @@ enum sci_status scic_sds_remote_device_default_resume_handler( ...@@ -684,7 +684,7 @@ enum sci_status scic_sds_remote_device_default_resume_handler(
* returns a failure. enum sci_status SCI_FAILURE_INVALID_STATE * returns a failure. enum sci_status SCI_FAILURE_INVALID_STATE
*/ */
static enum sci_status scic_sds_remote_device_core_event_handler( static enum sci_status scic_sds_remote_device_core_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code, u32 event_code,
bool is_ready_state) bool is_ready_state)
{ {
...@@ -694,7 +694,7 @@ static enum sci_status scic_sds_remote_device_core_event_handler( ...@@ -694,7 +694,7 @@ static enum sci_status scic_sds_remote_device_core_event_handler(
case SCU_EVENT_TYPE_RNC_OPS_MISC: case SCU_EVENT_TYPE_RNC_OPS_MISC:
case SCU_EVENT_TYPE_RNC_SUSPEND_TX: case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX: case SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX:
status = scic_sds_remote_node_context_event_handler(this_device->rnc, event_code); status = scic_sds_remote_node_context_event_handler(sci_dev->rnc, event_code);
break; break;
case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT: case SCU_EVENT_TYPE_PTX_SCHEDULE_EVENT:
...@@ -702,13 +702,13 @@ static enum sci_status scic_sds_remote_device_core_event_handler( ...@@ -702,13 +702,13 @@ static enum sci_status scic_sds_remote_device_core_event_handler(
status = SCI_SUCCESS; status = SCI_SUCCESS;
/* Suspend the associated RNC */ /* Suspend the associated RNC */
scic_sds_remote_node_context_suspend(this_device->rnc, scic_sds_remote_node_context_suspend(sci_dev->rnc,
SCI_SOFTWARE_SUSPENSION, SCI_SOFTWARE_SUSPENSION,
NULL, NULL); NULL, NULL);
dev_dbg(scirdev_to_dev(this_device), dev_dbg(scirdev_to_dev(sci_dev),
"%s: device: %p event code: %x: %s\n", "%s: device: %p event code: %x: %s\n",
__func__, this_device, event_code, __func__, sci_dev, event_code,
(is_ready_state) (is_ready_state)
? "I_T_Nexus_Timeout event" ? "I_T_Nexus_Timeout event"
: "I_T_Nexus_Timeout event in wrong state"); : "I_T_Nexus_Timeout event in wrong state");
...@@ -718,9 +718,9 @@ static enum sci_status scic_sds_remote_device_core_event_handler( ...@@ -718,9 +718,9 @@ static enum sci_status scic_sds_remote_device_core_event_handler(
/* Else, fall through and treat as unhandled... */ /* Else, fall through and treat as unhandled... */
default: default:
dev_dbg(scirdev_to_dev(this_device), dev_dbg(scirdev_to_dev(sci_dev),
"%s: device: %p event code: %x: %s\n", "%s: device: %p event code: %x: %s\n",
__func__, this_device, event_code, __func__, sci_dev, event_code,
(is_ready_state) (is_ready_state)
? "unexpected event" ? "unexpected event"
: "unexpected event in wrong state"); : "unexpected event in wrong state");
...@@ -742,10 +742,10 @@ static enum sci_status scic_sds_remote_device_core_event_handler( ...@@ -742,10 +742,10 @@ static enum sci_status scic_sds_remote_device_core_event_handler(
* returns a failure. enum sci_status SCI_FAILURE_INVALID_STATE * returns a failure. enum sci_status SCI_FAILURE_INVALID_STATE
*/ */
static enum sci_status scic_sds_remote_device_default_event_handler( static enum sci_status scic_sds_remote_device_default_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code) u32 event_code)
{ {
return scic_sds_remote_device_core_event_handler(this_device, return scic_sds_remote_device_core_event_handler(sci_dev,
event_code, event_code,
false); false);
} }
...@@ -762,20 +762,20 @@ static enum sci_status scic_sds_remote_device_default_event_handler( ...@@ -762,20 +762,20 @@ static enum sci_status scic_sds_remote_device_default_event_handler(
* SCI_FAILURE_INVALID_STATE * SCI_FAILURE_INVALID_STATE
*/ */
enum sci_status scic_sds_remote_device_default_frame_handler( enum sci_status scic_sds_remote_device_default_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index) u32 frame_index)
{ {
dev_warn(scirdev_to_dev(this_device), dev_warn(scirdev_to_dev(sci_dev),
"%s: SCIC Remote Device requested to handle frame %x " "%s: SCIC Remote Device requested to handle frame %x "
"while in wrong state %d\n", "while in wrong state %d\n",
__func__, __func__,
frame_index, frame_index,
sci_base_state_machine_get_state( sci_base_state_machine_get_state(
&this_device->state_machine)); &sci_dev->state_machine));
/* Return the frame back to the controller */ /* Return the frame back to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
scic_sds_remote_device_get_controller(this_device), frame_index scic_sds_remote_device_get_controller(sci_dev), frame_index
); );
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
...@@ -815,7 +815,7 @@ enum sci_status scic_sds_remote_device_default_continue_request_handler( ...@@ -815,7 +815,7 @@ enum sci_status scic_sds_remote_device_default_continue_request_handler(
* unsolicited frame to that object. enum sci_status SCI_FAILURE_INVALID_STATE * unsolicited frame to that object. enum sci_status SCI_FAILURE_INVALID_STATE
*/ */
enum sci_status scic_sds_remote_device_general_frame_handler( enum sci_status scic_sds_remote_device_general_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index) u32 frame_index)
{ {
enum sci_status result; enum sci_status result;
...@@ -823,22 +823,22 @@ enum sci_status scic_sds_remote_device_general_frame_handler( ...@@ -823,22 +823,22 @@ enum sci_status scic_sds_remote_device_general_frame_handler(
struct scic_sds_request *io_request; struct scic_sds_request *io_request;
result = scic_sds_unsolicited_frame_control_get_header( result = scic_sds_unsolicited_frame_control_get_header(
&(scic_sds_remote_device_get_controller(this_device)->uf_control), &(scic_sds_remote_device_get_controller(sci_dev)->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
if (SCI_SUCCESS == result) { if (SCI_SUCCESS == result) {
io_request = scic_sds_controller_get_io_request_from_tag( io_request = scic_sds_controller_get_io_request_from_tag(
scic_sds_remote_device_get_controller(this_device), frame_header->tag); scic_sds_remote_device_get_controller(sci_dev), frame_header->tag);
if ((io_request == NULL) if ((io_request == NULL)
|| (io_request->target_device != this_device)) { || (io_request->target_device != sci_dev)) {
/* /*
* We could not map this tag to a valid IO request * We could not map this tag to a valid IO request
* Just toss the frame and continue */ * Just toss the frame and continue */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
scic_sds_remote_device_get_controller(this_device), frame_index scic_sds_remote_device_get_controller(sci_dev), frame_index
); );
} else { } else {
/* The IO request is now in charge of releasing the frame */ /* The IO request is now in charge of releasing the frame */
...@@ -852,17 +852,17 @@ enum sci_status scic_sds_remote_device_general_frame_handler( ...@@ -852,17 +852,17 @@ enum sci_status scic_sds_remote_device_general_frame_handler(
/** /**
* *
* @[in]: this_device This is the device object that is receiving the event. * @[in]: sci_dev This is the device object that is receiving the event.
* @[in]: event_code The event code to process. * @[in]: event_code The event code to process.
* *
* This is a common method for handling events reported to the remote device * This is a common method for handling events reported to the remote device
* from the controller object. enum sci_status * from the controller object. enum sci_status
*/ */
enum sci_status scic_sds_remote_device_general_event_handler( enum sci_status scic_sds_remote_device_general_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code) u32 event_code)
{ {
return scic_sds_remote_device_core_event_handler(this_device, return scic_sds_remote_device_core_event_handler(sci_dev,
event_code, event_code,
true); true);
} }
...@@ -1093,7 +1093,7 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl ...@@ -1093,7 +1093,7 @@ static enum sci_status scic_sds_remote_device_ready_state_complete_request_handl
/** /**
* *
* @this_device: The struct scic_sds_remote_device which is cast into a * @sci_dev: The struct scic_sds_remote_device which is cast into a
* struct scic_sds_remote_device. * struct scic_sds_remote_device.
* *
* This method will stop a struct scic_sds_remote_device that is already in the * This method will stop a struct scic_sds_remote_device that is already in the
...@@ -1536,10 +1536,10 @@ static void scic_sds_remote_device_ready_state_exit( ...@@ -1536,10 +1536,10 @@ static void scic_sds_remote_device_ready_state_exit(
static void scic_sds_remote_device_stopping_state_enter( static void scic_sds_remote_device_stopping_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)object; struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_device, sci_dev,
scic_sds_remote_device_state_handler_table, scic_sds_remote_device_state_handler_table,
SCI_BASE_REMOTE_DEVICE_STATE_STOPPING SCI_BASE_REMOTE_DEVICE_STATE_STOPPING
); );
...@@ -1556,10 +1556,10 @@ static void scic_sds_remote_device_stopping_state_enter( ...@@ -1556,10 +1556,10 @@ static void scic_sds_remote_device_stopping_state_enter(
static void scic_sds_remote_device_failed_state_enter( static void scic_sds_remote_device_failed_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)object; struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_device, sci_dev,
scic_sds_remote_device_state_handler_table, scic_sds_remote_device_state_handler_table,
SCI_BASE_REMOTE_DEVICE_STATE_FAILED SCI_BASE_REMOTE_DEVICE_STATE_FAILED
); );
...@@ -1576,16 +1576,16 @@ static void scic_sds_remote_device_failed_state_enter( ...@@ -1576,16 +1576,16 @@ static void scic_sds_remote_device_failed_state_enter(
static void scic_sds_remote_device_resetting_state_enter( static void scic_sds_remote_device_resetting_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)object; struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_device, sci_dev,
scic_sds_remote_device_state_handler_table, scic_sds_remote_device_state_handler_table,
SCI_BASE_REMOTE_DEVICE_STATE_RESETTING SCI_BASE_REMOTE_DEVICE_STATE_RESETTING
); );
scic_sds_remote_node_context_suspend( scic_sds_remote_node_context_suspend(
this_device->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL); sci_dev->rnc, SCI_SOFTWARE_SUSPENSION, NULL, NULL);
} }
/** /**
...@@ -1599,9 +1599,9 @@ static void scic_sds_remote_device_resetting_state_enter( ...@@ -1599,9 +1599,9 @@ static void scic_sds_remote_device_resetting_state_enter(
static void scic_sds_remote_device_resetting_state_exit( static void scic_sds_remote_device_resetting_state_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)object; struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
scic_sds_remote_node_context_resume(this_device->rnc, NULL, NULL); scic_sds_remote_node_context_resume(sci_dev->rnc, NULL, NULL);
} }
/** /**
...@@ -1615,10 +1615,10 @@ static void scic_sds_remote_device_resetting_state_exit( ...@@ -1615,10 +1615,10 @@ static void scic_sds_remote_device_resetting_state_exit(
static void scic_sds_remote_device_final_state_enter( static void scic_sds_remote_device_final_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_device *this_device = (struct scic_sds_remote_device *)object; struct scic_sds_remote_device *sci_dev = (struct scic_sds_remote_device *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_device, sci_dev,
scic_sds_remote_device_state_handler_table, scic_sds_remote_device_state_handler_table,
SCI_BASE_REMOTE_DEVICE_STATE_FINAL SCI_BASE_REMOTE_DEVICE_STATE_FINAL
); );
......
...@@ -350,25 +350,25 @@ typedef enum sci_status (*scic_sds_remote_device_high_priority_request_complete_ ...@@ -350,25 +350,25 @@ typedef enum sci_status (*scic_sds_remote_device_high_priority_request_complete_
enum sci_io_status); enum sci_io_status);
typedef enum sci_status (*scic_sds_remote_device_handler_t)( typedef enum sci_status (*scic_sds_remote_device_handler_t)(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
typedef enum sci_status (*scic_sds_remote_device_suspend_handler_t)( typedef enum sci_status (*scic_sds_remote_device_suspend_handler_t)(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 suspend_type); u32 suspend_type);
typedef enum sci_status (*scic_sds_remote_device_resume_handler_t)( typedef enum sci_status (*scic_sds_remote_device_resume_handler_t)(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
typedef enum sci_status (*scic_sds_remote_device_frame_handler_t)( typedef enum sci_status (*scic_sds_remote_device_frame_handler_t)(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index); u32 frame_index);
typedef enum sci_status (*scic_sds_remote_device_event_handler_t)( typedef enum sci_status (*scic_sds_remote_device_event_handler_t)(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code); u32 event_code);
typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)( typedef void (*scic_sds_remote_device_ready_not_ready_handler_t)(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
/** /**
* struct scic_sds_remote_device_state_handler - This structure conains the * struct scic_sds_remote_device_state_handler - This structure conains the
...@@ -461,8 +461,8 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab ...@@ -461,8 +461,8 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab
* *
* This macro incrments the request count for this device * This macro incrments the request count for this device
*/ */
#define scic_sds_remote_device_increment_request_count(this_device) \ #define scic_sds_remote_device_increment_request_count(sci_dev) \
((this_device)->started_request_count++) ((sci_dev)->started_request_count++)
/** /**
* scic_sds_remote_device_decrement_request_count() - * scic_sds_remote_device_decrement_request_count() -
...@@ -470,33 +470,33 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab ...@@ -470,33 +470,33 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab
* This macro decrements the request count for this device. This count will * This macro decrements the request count for this device. This count will
* never decrment past 0. * never decrment past 0.
*/ */
#define scic_sds_remote_device_decrement_request_count(this_device) \ #define scic_sds_remote_device_decrement_request_count(sci_dev) \
((this_device)->started_request_count > 0 ? \ ((sci_dev)->started_request_count > 0 ? \
(this_device)->started_request_count-- : 0) (sci_dev)->started_request_count-- : 0)
/** /**
* scic_sds_remote_device_get_request_count() - * scic_sds_remote_device_get_request_count() -
* *
* This is a helper macro to return the current device request count. * This is a helper macro to return the current device request count.
*/ */
#define scic_sds_remote_device_get_request_count(this_device) \ #define scic_sds_remote_device_get_request_count(sci_dev) \
((this_device)->started_request_count) ((sci_dev)->started_request_count)
/** /**
* scic_sds_remote_device_get_port() - * scic_sds_remote_device_get_port() -
* *
* This macro returns the owning port of this remote device obejct. * This macro returns the owning port of this remote device obejct.
*/ */
#define scic_sds_remote_device_get_port(this_device) \ #define scic_sds_remote_device_get_port(sci_dev) \
((this_device)->owning_port) ((sci_dev)->owning_port)
/** /**
* scic_sds_remote_device_get_controller() - * scic_sds_remote_device_get_controller() -
* *
* This macro returns the controller object that contains this device object * This macro returns the controller object that contains this device object
*/ */
#define scic_sds_remote_device_get_controller(this_device) \ #define scic_sds_remote_device_get_controller(sci_dev) \
scic_sds_port_get_controller(scic_sds_remote_device_get_port(this_device)) scic_sds_port_get_controller(scic_sds_remote_device_get_port(sci_dev))
/** /**
* scic_sds_remote_device_set_state_handlers() - * scic_sds_remote_device_set_state_handlers() -
...@@ -504,26 +504,26 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab ...@@ -504,26 +504,26 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab
* This macro sets the remote device state handlers pointer and is set on entry * This macro sets the remote device state handlers pointer and is set on entry
* to each device state. * to each device state.
*/ */
#define scic_sds_remote_device_set_state_handlers(this_device, handlers) \ #define scic_sds_remote_device_set_state_handlers(sci_dev, handlers) \
((this_device)->state_handlers = (handlers)) ((sci_dev)->state_handlers = (handlers))
/** /**
* scic_sds_remote_device_get_port() - * scic_sds_remote_device_get_port() -
* *
* This macro returns the owning port of this device * This macro returns the owning port of this device
*/ */
#define scic_sds_remote_device_get_port(this_device) \ #define scic_sds_remote_device_get_port(sci_dev) \
((this_device)->owning_port) ((sci_dev)->owning_port)
/** /**
* scic_sds_remote_device_get_sequence() - * scic_sds_remote_device_get_sequence() -
* *
* This macro returns the remote device sequence value * This macro returns the remote device sequence value
*/ */
#define scic_sds_remote_device_get_sequence(this_device) \ #define scic_sds_remote_device_get_sequence(sci_dev) \
(\ (\
scic_sds_remote_device_get_controller(this_device)-> \ scic_sds_remote_device_get_controller(sci_dev)-> \
remote_device_sequence[(this_device)->rnc->remote_node_index] \ remote_device_sequence[(sci_dev)->rnc->remote_node_index] \
) )
/** /**
...@@ -531,11 +531,11 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab ...@@ -531,11 +531,11 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab
* *
* This macro returns the controllers protocol engine group * This macro returns the controllers protocol engine group
*/ */
#define scic_sds_remote_device_get_controller_peg(this_device) \ #define scic_sds_remote_device_get_controller_peg(sci_dev) \
(\ (\
scic_sds_controller_get_protocol_engine_group(\ scic_sds_controller_get_protocol_engine_group(\
scic_sds_port_get_controller(\ scic_sds_port_get_controller(\
scic_sds_remote_device_get_port(this_device) \ scic_sds_remote_device_get_port(sci_dev) \
) \ ) \
) \ ) \
) )
...@@ -545,16 +545,16 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab ...@@ -545,16 +545,16 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab
* *
* This macro returns the port index for the devices owning port * This macro returns the port index for the devices owning port
*/ */
#define scic_sds_remote_device_get_port_index(this_device) \ #define scic_sds_remote_device_get_port_index(sci_dev) \
(scic_sds_port_get_index(scic_sds_remote_device_get_port(this_device))) (scic_sds_port_get_index(scic_sds_remote_device_get_port(sci_dev)))
/** /**
* scic_sds_remote_device_get_index() - * scic_sds_remote_device_get_index() -
* *
* This macro returns the remote node index for this device object * This macro returns the remote node index for this device object
*/ */
#define scic_sds_remote_device_get_index(this_device) \ #define scic_sds_remote_device_get_index(sci_dev) \
((this_device)->rnc->remote_node_index) ((sci_dev)->rnc->remote_node_index)
/** /**
* scic_sds_remote_device_build_command_context() - * scic_sds_remote_device_build_command_context() -
...@@ -579,61 +579,61 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab ...@@ -579,61 +579,61 @@ extern const struct sci_base_state scic_sds_smp_remote_device_ready_substate_tab
((device)->working_request = (request)) ((device)->working_request = (request))
enum sci_status scic_sds_remote_device_frame_handler( enum sci_status scic_sds_remote_device_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index); u32 frame_index);
enum sci_status scic_sds_remote_device_event_handler( enum sci_status scic_sds_remote_device_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code); u32 event_code);
enum sci_status scic_sds_remote_device_start_io( enum sci_status scic_sds_remote_device_start_io(
struct scic_sds_controller *controller, struct scic_sds_controller *controller,
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *io_request); struct scic_sds_request *io_request);
enum sci_status scic_sds_remote_device_complete_io( enum sci_status scic_sds_remote_device_complete_io(
struct scic_sds_controller *controller, struct scic_sds_controller *controller,
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *io_request); struct scic_sds_request *io_request);
enum sci_status scic_sds_remote_device_resume( enum sci_status scic_sds_remote_device_resume(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
enum sci_status scic_sds_remote_device_suspend( enum sci_status scic_sds_remote_device_suspend(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 suspend_type); u32 suspend_type);
enum sci_status scic_sds_remote_device_start_task( enum sci_status scic_sds_remote_device_start_task(
struct scic_sds_controller *controller, struct scic_sds_controller *controller,
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *io_request); struct scic_sds_request *io_request);
void scic_sds_remote_device_post_request( void scic_sds_remote_device_post_request(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 request); u32 request);
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
bool scic_sds_remote_device_is_atapi( bool scic_sds_remote_device_is_atapi(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
#else /* !defined(DISABLE_ATAPI) */ #else /* !defined(DISABLE_ATAPI) */
#define scic_sds_remote_device_is_atapi(this_device) false #define scic_sds_remote_device_is_atapi(sci_dev) false
#endif /* !defined(DISABLE_ATAPI) */ #endif /* !defined(DISABLE_ATAPI) */
void scic_sds_remote_device_start_request( void scic_sds_remote_device_start_request(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
struct scic_sds_request *the_request, struct scic_sds_request *sci_req,
enum sci_status status); enum sci_status status);
void scic_sds_remote_device_continue_request(void *sci_dev); void scic_sds_remote_device_continue_request(void *sci_dev);
enum sci_status scic_sds_remote_device_default_start_handler( enum sci_status scic_sds_remote_device_default_start_handler(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
enum sci_status scic_sds_remote_device_default_fail_handler( enum sci_status scic_sds_remote_device_default_fail_handler(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
enum sci_status scic_sds_remote_device_default_destruct_handler( enum sci_status scic_sds_remote_device_default_destruct_handler(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
enum sci_status scic_sds_remote_device_default_reset_handler( enum sci_status scic_sds_remote_device_default_reset_handler(
struct scic_sds_remote_device *device); struct scic_sds_remote_device *device);
...@@ -654,15 +654,15 @@ enum sci_status scic_sds_remote_device_default_continue_request_handler( ...@@ -654,15 +654,15 @@ enum sci_status scic_sds_remote_device_default_continue_request_handler(
struct scic_sds_request *request); struct scic_sds_request *request);
enum sci_status scic_sds_remote_device_default_suspend_handler( enum sci_status scic_sds_remote_device_default_suspend_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 suspend_type); u32 suspend_type);
enum sci_status scic_sds_remote_device_default_resume_handler( enum sci_status scic_sds_remote_device_default_resume_handler(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
enum sci_status scic_sds_remote_device_default_frame_handler( enum sci_status scic_sds_remote_device_default_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index); u32 frame_index);
enum sci_status scic_sds_remote_device_ready_state_stop_handler( enum sci_status scic_sds_remote_device_ready_state_stop_handler(
...@@ -672,14 +672,14 @@ enum sci_status scic_sds_remote_device_ready_state_reset_handler( ...@@ -672,14 +672,14 @@ enum sci_status scic_sds_remote_device_ready_state_reset_handler(
struct scic_sds_remote_device *device); struct scic_sds_remote_device *device);
enum sci_status scic_sds_remote_device_general_frame_handler( enum sci_status scic_sds_remote_device_general_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index); u32 frame_index);
enum sci_status scic_sds_remote_device_general_event_handler( enum sci_status scic_sds_remote_device_general_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code); u32 event_code);
enum sci_status scic_sds_ssp_remote_device_ready_suspended_substate_resume_handler( enum sci_status scic_sds_ssp_remote_device_ready_suspended_substate_resume_handler(
struct scic_sds_remote_device *this_device); struct scic_sds_remote_device *sci_dev);
#endif /* _SCIC_SDS_REMOTE_DEVICE_H_ */ #endif /* _SCIC_SDS_REMOTE_DEVICE_H_ */
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
/** /**
* *
* @this_rnc: The RNC for which the is posted request is being made. * @sci_rnc: The RNC for which the is posted request is being made.
* *
* This method will return true if the RNC is not in the initial state. In all * This method will return true if the RNC is not in the initial state. In all
* other states the RNC is considered active and this will return true. The * other states the RNC is considered active and this will return true. The
...@@ -79,16 +79,16 @@ ...@@ -79,16 +79,16 @@
/** /**
* *
* @this_rnc: The state of the remote node context object to check. * @sci_rnc: The state of the remote node context object to check.
* *
* This method will return true if the remote node context is in a READY state * This method will return true if the remote node context is in a READY state
* otherwise it will return false bool true if the remote node context is in * otherwise it will return false bool true if the remote node context is in
* the ready state. false if the remote node context is not in the ready state. * the ready state. false if the remote node context is not in the ready state.
*/ */
bool scic_sds_remote_node_context_is_ready( bool scic_sds_remote_node_context_is_ready(
struct scic_sds_remote_node_context *this_rnc) struct scic_sds_remote_node_context *sci_rnc)
{ {
u32 current_state = sci_base_state_machine_get_state(&this_rnc->state_machine); u32 current_state = sci_base_state_machine_get_state(&sci_rnc->state_machine);
if (current_state == SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) { if (current_state == SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE) {
return true; return true;
...@@ -99,36 +99,36 @@ bool scic_sds_remote_node_context_is_ready( ...@@ -99,36 +99,36 @@ bool scic_sds_remote_node_context_is_ready(
/** /**
* *
* @this_device: The remote device to use to construct the RNC buffer. * @sci_dev: The remote device to use to construct the RNC buffer.
* @rnc: The buffer into which the remote device data will be copied. * @rnc: The buffer into which the remote device data will be copied.
* *
* This method will construct the RNC buffer for this remote device object. none * This method will construct the RNC buffer for this remote device object. none
*/ */
static void scic_sds_remote_node_context_construct_buffer( static void scic_sds_remote_node_context_construct_buffer(
struct scic_sds_remote_node_context *this_rnc) struct scic_sds_remote_node_context *sci_rnc)
{ {
union scu_remote_node_context *rnc; union scu_remote_node_context *rnc;
struct scic_sds_controller *the_controller; struct scic_sds_controller *scic;
the_controller = scic_sds_remote_device_get_controller(this_rnc->device); scic = scic_sds_remote_device_get_controller(sci_rnc->device);
rnc = scic_sds_controller_get_remote_node_context_buffer( rnc = scic_sds_controller_get_remote_node_context_buffer(
the_controller, this_rnc->remote_node_index); scic, sci_rnc->remote_node_index);
memset( memset(
rnc, rnc,
0x00, 0x00,
sizeof(union scu_remote_node_context) sizeof(union scu_remote_node_context)
* scic_sds_remote_device_node_count(this_rnc->device) * scic_sds_remote_device_node_count(sci_rnc->device)
); );
rnc->ssp.remote_node_index = this_rnc->remote_node_index; rnc->ssp.remote_node_index = sci_rnc->remote_node_index;
rnc->ssp.remote_node_port_width = this_rnc->device->device_port_width; rnc->ssp.remote_node_port_width = sci_rnc->device->device_port_width;
rnc->ssp.logical_port_index = rnc->ssp.logical_port_index =
scic_sds_remote_device_get_port_index(this_rnc->device); scic_sds_remote_device_get_port_index(sci_rnc->device);
rnc->ssp.remote_sas_address_hi = SCIC_SWAP_DWORD(this_rnc->device->device_address.high); rnc->ssp.remote_sas_address_hi = SCIC_SWAP_DWORD(sci_rnc->device->device_address.high);
rnc->ssp.remote_sas_address_lo = SCIC_SWAP_DWORD(this_rnc->device->device_address.low); rnc->ssp.remote_sas_address_lo = SCIC_SWAP_DWORD(sci_rnc->device->device_address.low);
rnc->ssp.nexus_loss_timer_enable = true; rnc->ssp.nexus_loss_timer_enable = true;
rnc->ssp.check_bit = false; rnc->ssp.check_bit = false;
...@@ -140,24 +140,24 @@ static void scic_sds_remote_node_context_construct_buffer( ...@@ -140,24 +140,24 @@ static void scic_sds_remote_node_context_construct_buffer(
if ( if (
this_rnc->device->target_protocols.u.bits.attached_sata_device sci_rnc->device->target_protocols.u.bits.attached_sata_device
|| this_rnc->device->target_protocols.u.bits.attached_stp_target || sci_rnc->device->target_protocols.u.bits.attached_stp_target
) { ) {
rnc->ssp.connection_occupancy_timeout = rnc->ssp.connection_occupancy_timeout =
the_controller->user_parameters.sds1.stp_max_occupancy_timeout; scic->user_parameters.sds1.stp_max_occupancy_timeout;
rnc->ssp.connection_inactivity_timeout = rnc->ssp.connection_inactivity_timeout =
the_controller->user_parameters.sds1.stp_inactivity_timeout; scic->user_parameters.sds1.stp_inactivity_timeout;
} else { } else {
rnc->ssp.connection_occupancy_timeout = rnc->ssp.connection_occupancy_timeout =
the_controller->user_parameters.sds1.ssp_max_occupancy_timeout; scic->user_parameters.sds1.ssp_max_occupancy_timeout;
rnc->ssp.connection_inactivity_timeout = rnc->ssp.connection_inactivity_timeout =
the_controller->user_parameters.sds1.ssp_inactivity_timeout; scic->user_parameters.sds1.ssp_inactivity_timeout;
} }
rnc->ssp.initial_arbitration_wait_time = 0; rnc->ssp.initial_arbitration_wait_time = 0;
/* Open Address Frame Parameters */ /* Open Address Frame Parameters */
rnc->ssp.oaf_connection_rate = this_rnc->device->connection_rate; rnc->ssp.oaf_connection_rate = sci_rnc->device->connection_rate;
rnc->ssp.oaf_features = 0; rnc->ssp.oaf_features = 0;
rnc->ssp.oaf_source_zone_group = 0; rnc->ssp.oaf_source_zone_group = 0;
rnc->ssp.oaf_more_compatibility_features = 0; rnc->ssp.oaf_more_compatibility_features = 0;
...@@ -165,8 +165,8 @@ static void scic_sds_remote_node_context_construct_buffer( ...@@ -165,8 +165,8 @@ static void scic_sds_remote_node_context_construct_buffer(
/** /**
* *
* @this_rnc: * @sci_rnc:
* @the_callback: * @callback:
* @callback_parameter: * @callback_parameter:
* *
* This method will setup the remote node context object so it will transition * This method will setup the remote node context object so it will transition
...@@ -174,52 +174,52 @@ static void scic_sds_remote_node_context_construct_buffer( ...@@ -174,52 +174,52 @@ static void scic_sds_remote_node_context_construct_buffer(
* transition to its final state then this function does nothing. none * transition to its final state then this function does nothing. none
*/ */
static void scic_sds_remote_node_context_setup_to_resume( static void scic_sds_remote_node_context_setup_to_resume(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
if (this_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) { if (sci_rnc->destination_state != SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) {
this_rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY; sci_rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY;
this_rnc->user_callback = the_callback; sci_rnc->user_callback = callback;
this_rnc->user_cookie = callback_parameter; sci_rnc->user_cookie = callback_parameter;
} }
} }
/** /**
* *
* @this_rnc: * @sci_rnc:
* @the_callback: * @callback:
* @callback_parameter: * @callback_parameter:
* *
* This method will setup the remote node context object so it will transistion * This method will setup the remote node context object so it will transistion
* to its final state. none * to its final state. none
*/ */
static void scic_sds_remote_node_context_setup_to_destory( static void scic_sds_remote_node_context_setup_to_destory(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
this_rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL; sci_rnc->destination_state = SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL;
this_rnc->user_callback = the_callback; sci_rnc->user_callback = callback;
this_rnc->user_cookie = callback_parameter; sci_rnc->user_cookie = callback_parameter;
} }
/** /**
* *
* @this_rnc: * @sci_rnc:
* @the_callback: * @callback:
* *
* This method will continue to resume a remote node context. This is used in * This method will continue to resume a remote node context. This is used in
* the states where a resume is requested while a resume is in progress. * the states where a resume is requested while a resume is in progress.
*/ */
static enum sci_status scic_sds_remote_node_context_continue_to_resume_handler( static enum sci_status scic_sds_remote_node_context_continue_to_resume_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
if (this_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) { if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_READY) {
this_rnc->user_callback = the_callback; sci_rnc->user_callback = callback;
this_rnc->user_cookie = callback_parameter; sci_rnc->user_cookie = callback_parameter;
return SCI_SUCCESS; return SCI_SUCCESS;
} }
...@@ -230,16 +230,16 @@ static enum sci_status scic_sds_remote_node_context_continue_to_resume_handler( ...@@ -230,16 +230,16 @@ static enum sci_status scic_sds_remote_node_context_continue_to_resume_handler(
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
static enum sci_status scic_sds_remote_node_context_default_destruct_handler( static enum sci_status scic_sds_remote_node_context_default_destruct_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to stop while " "%s: SCIC Remote Node Context 0x%p requested to stop while "
"in unexpected state %d\n", "in unexpected state %d\n",
__func__, __func__,
this_rnc, sci_rnc,
sci_base_state_machine_get_state(&this_rnc->state_machine)); sci_base_state_machine_get_state(&sci_rnc->state_machine));
/* /*
* We have decided that the destruct request on the remote node context can not fail * We have decided that the destruct request on the remote node context can not fail
...@@ -248,101 +248,101 @@ static enum sci_status scic_sds_remote_node_context_default_destruct_handler( ...@@ -248,101 +248,101 @@ static enum sci_status scic_sds_remote_node_context_default_destruct_handler(
} }
static enum sci_status scic_sds_remote_node_context_default_suspend_handler( static enum sci_status scic_sds_remote_node_context_default_suspend_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 suspend_type, u32 suspend_type,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to suspend " "%s: SCIC Remote Node Context 0x%p requested to suspend "
"while in wrong state %d\n", "while in wrong state %d\n",
__func__, __func__,
this_rnc, sci_rnc,
sci_base_state_machine_get_state(&this_rnc->state_machine)); sci_base_state_machine_get_state(&sci_rnc->state_machine));
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
} }
static enum sci_status scic_sds_remote_node_context_default_resume_handler( static enum sci_status scic_sds_remote_node_context_default_resume_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to resume " "%s: SCIC Remote Node Context 0x%p requested to resume "
"while in wrong state %d\n", "while in wrong state %d\n",
__func__, __func__,
this_rnc, sci_rnc,
sci_base_state_machine_get_state(&this_rnc->state_machine)); sci_base_state_machine_get_state(&sci_rnc->state_machine));
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
} }
static enum sci_status scic_sds_remote_node_context_default_start_io_handler( static enum sci_status scic_sds_remote_node_context_default_start_io_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *the_request) struct scic_sds_request *sci_req)
{ {
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to start io " "%s: SCIC Remote Node Context 0x%p requested to start io "
"0x%p while in wrong state %d\n", "0x%p while in wrong state %d\n",
__func__, __func__,
this_rnc, sci_rnc,
the_request, sci_req,
sci_base_state_machine_get_state(&this_rnc->state_machine)); sci_base_state_machine_get_state(&sci_rnc->state_machine));
return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED; return SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED;
} }
static enum sci_status scic_sds_remote_node_context_default_start_task_handler( static enum sci_status scic_sds_remote_node_context_default_start_task_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *the_request) struct scic_sds_request *sci_req)
{ {
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to start " "%s: SCIC Remote Node Context 0x%p requested to start "
"task 0x%p while in wrong state %d\n", "task 0x%p while in wrong state %d\n",
__func__, __func__,
this_rnc, sci_rnc,
the_request, sci_req,
sci_base_state_machine_get_state(&this_rnc->state_machine)); sci_base_state_machine_get_state(&sci_rnc->state_machine));
return SCI_FAILURE; return SCI_FAILURE;
} }
static enum sci_status scic_sds_remote_node_context_default_event_handler( static enum sci_status scic_sds_remote_node_context_default_event_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 event_code) u32 event_code)
{ {
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to process " "%s: SCIC Remote Node Context 0x%p requested to process "
"event 0x%x while in wrong state %d\n", "event 0x%x while in wrong state %d\n",
__func__, __func__,
this_rnc, sci_rnc,
event_code, event_code,
sci_base_state_machine_get_state(&this_rnc->state_machine)); sci_base_state_machine_get_state(&sci_rnc->state_machine));
return SCI_FAILURE_INVALID_STATE; return SCI_FAILURE_INVALID_STATE;
} }
/** /**
* *
* @this_rnc: The rnc for which the task request is targeted. * @sci_rnc: The rnc for which the task request is targeted.
* @the_request: The request which is going to be started. * @sci_req: The request which is going to be started.
* *
* This method determines if the task request can be started by the SCU * This method determines if the task request can be started by the SCU
* hardware. When the RNC is in the ready state any task can be started. * hardware. When the RNC is in the ready state any task can be started.
* enum sci_status SCI_SUCCESS * enum sci_status SCI_SUCCESS
*/ */
static enum sci_status scic_sds_remote_node_context_success_start_task_handler( static enum sci_status scic_sds_remote_node_context_success_start_task_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *the_request) struct scic_sds_request *sci_req)
{ {
return SCI_SUCCESS; return SCI_SUCCESS;
} }
/** /**
* *
* @this_rnc: * @sci_rnc:
* @the_callback: * @callback:
* @callback_parameter: * @callback_parameter:
* *
* This method handles destruct calls from the various state handlers. The * This method handles destruct calls from the various state handlers. The
...@@ -351,16 +351,16 @@ static enum sci_status scic_sds_remote_node_context_success_start_task_handler( ...@@ -351,16 +351,16 @@ static enum sci_status scic_sds_remote_node_context_success_start_task_handler(
* callback. enum sci_status * callback. enum sci_status
*/ */
static enum sci_status scic_sds_remote_node_context_general_destruct_handler( static enum sci_status scic_sds_remote_node_context_general_destruct_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
scic_sds_remote_node_context_setup_to_destory( scic_sds_remote_node_context_setup_to_destory(
this_rnc, the_callback, callback_parameter sci_rnc, callback, callback_parameter
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE
); );
...@@ -370,19 +370,19 @@ static enum sci_status scic_sds_remote_node_context_general_destruct_handler( ...@@ -370,19 +370,19 @@ static enum sci_status scic_sds_remote_node_context_general_destruct_handler(
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
static enum sci_status scic_sds_remote_node_context_initial_state_resume_handler( static enum sci_status scic_sds_remote_node_context_initial_state_resume_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
if (this_rnc->remote_node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) { if (sci_rnc->remote_node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX) {
scic_sds_remote_node_context_setup_to_resume( scic_sds_remote_node_context_setup_to_resume(
this_rnc, the_callback, callback_parameter sci_rnc, callback, callback_parameter
); );
scic_sds_remote_node_context_construct_buffer(this_rnc); scic_sds_remote_node_context_construct_buffer(sci_rnc);
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE
); );
...@@ -395,7 +395,7 @@ static enum sci_status scic_sds_remote_node_context_initial_state_resume_handler ...@@ -395,7 +395,7 @@ static enum sci_status scic_sds_remote_node_context_initial_state_resume_handler
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
static enum sci_status scic_sds_remote_node_context_posting_state_event_handler( static enum sci_status scic_sds_remote_node_context_posting_state_event_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 event_code) u32 event_code)
{ {
enum sci_status status; enum sci_status status;
...@@ -405,19 +405,19 @@ static enum sci_status scic_sds_remote_node_context_posting_state_event_handler( ...@@ -405,19 +405,19 @@ static enum sci_status scic_sds_remote_node_context_posting_state_event_handler(
status = SCI_SUCCESS; status = SCI_SUCCESS;
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE
); );
break; break;
default: default:
status = SCI_FAILURE; status = SCI_FAILURE;
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to " "%s: SCIC Remote Node Context 0x%p requested to "
"process unexpected event 0x%x while in posting " "process unexpected event 0x%x while in posting "
"state\n", "state\n",
__func__, __func__,
this_rnc, sci_rnc,
event_code); event_code);
break; break;
} }
...@@ -428,19 +428,19 @@ static enum sci_status scic_sds_remote_node_context_posting_state_event_handler( ...@@ -428,19 +428,19 @@ static enum sci_status scic_sds_remote_node_context_posting_state_event_handler(
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
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 *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
scic_sds_remote_node_context_setup_to_destory( scic_sds_remote_node_context_setup_to_destory(
this_rnc, the_callback, callback_parameter sci_rnc, callback, callback_parameter
); );
return SCI_SUCCESS; return SCI_SUCCESS;
} }
static enum sci_status scic_sds_remote_node_context_invalidating_state_event_handler( static enum sci_status scic_sds_remote_node_context_invalidating_state_event_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 event_code) u32 event_code)
{ {
enum sci_status status; enum sci_status status;
...@@ -448,14 +448,14 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han ...@@ -448,14 +448,14 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han
if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) { if (scu_get_event_code(event_code) == SCU_EVENT_POST_RNC_INVALIDATE_COMPLETE) {
status = SCI_SUCCESS; status = SCI_SUCCESS;
if (this_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) { if (sci_rnc->destination_state == SCIC_SDS_REMOTE_NODE_DESTINATION_STATE_FINAL) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_INITIAL_STATE
); );
} else { } else {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE
); );
} }
...@@ -466,25 +466,25 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han ...@@ -466,25 +466,25 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han
/* /*
* We really dont care if the hardware is going to suspend * We really dont care if the hardware is going to suspend
* the device since it's being invalidated anyway */ * the device since it's being invalidated anyway */
dev_dbg(scirdev_to_dev(this_rnc->device), dev_dbg(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p was " "%s: SCIC Remote Node Context 0x%p was "
"suspeneded by hardware while being " "suspeneded by hardware while being "
"invalidated.\n", "invalidated.\n",
__func__, __func__,
this_rnc); sci_rnc);
status = SCI_SUCCESS; status = SCI_SUCCESS;
break; break;
default: default:
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p " "%s: SCIC Remote Node Context 0x%p "
"requested to process event 0x%x while " "requested to process event 0x%x while "
"in state %d.\n", "in state %d.\n",
__func__, __func__,
this_rnc, sci_rnc,
event_code, event_code,
sci_base_state_machine_get_state( sci_base_state_machine_get_state(
&this_rnc->state_machine)); &sci_rnc->state_machine));
status = SCI_FAILURE; status = SCI_FAILURE;
break; break;
} }
...@@ -497,7 +497,7 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han ...@@ -497,7 +497,7 @@ static enum sci_status scic_sds_remote_node_context_invalidating_state_event_han
static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler( static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 event_code) u32 event_code)
{ {
enum sci_status status; enum sci_status status;
...@@ -506,7 +506,7 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler ...@@ -506,7 +506,7 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler
status = SCI_SUCCESS; status = SCI_SUCCESS;
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_READY_STATE
); );
} else { } else {
...@@ -516,23 +516,23 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler ...@@ -516,23 +516,23 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler
/* /*
* We really dont care if the hardware is going to suspend * We really dont care if the hardware is going to suspend
* the device since it's being resumed anyway */ * the device since it's being resumed anyway */
dev_dbg(scirdev_to_dev(this_rnc->device), dev_dbg(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p was " "%s: SCIC Remote Node Context 0x%p was "
"suspeneded by hardware while being resumed.\n", "suspeneded by hardware while being resumed.\n",
__func__, __func__,
this_rnc); sci_rnc);
status = SCI_SUCCESS; status = SCI_SUCCESS;
break; break;
default: default:
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested " "%s: SCIC Remote Node Context 0x%p requested "
"to process event 0x%x while in state %d.\n", "to process event 0x%x while in state %d.\n",
__func__, __func__,
this_rnc, sci_rnc,
event_code, event_code,
sci_base_state_machine_get_state( sci_base_state_machine_get_state(
&this_rnc->state_machine)); &sci_rnc->state_machine));
status = SCI_FAILURE; status = SCI_FAILURE;
break; break;
} }
...@@ -545,32 +545,32 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler ...@@ -545,32 +545,32 @@ static enum sci_status scic_sds_remote_node_context_resuming_state_event_handler
/** /**
* *
* @this_rnc: The remote node context object being suspended. * @sci_rnc: The remote node context object being suspended.
* @the_callback: The callback when the suspension is complete. * @callback: The callback when the suspension is complete.
* @callback_parameter: The parameter that is to be passed into the callback. * @callback_parameter: The parameter that is to be passed into the callback.
* *
* This method will handle the suspend requests from the ready state. * This method will handle the suspend requests from the ready state.
* SCI_SUCCESS * SCI_SUCCESS
*/ */
static enum sci_status scic_sds_remote_node_context_ready_state_suspend_handler( static enum sci_status scic_sds_remote_node_context_ready_state_suspend_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 suspend_type, u32 suspend_type,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
this_rnc->user_callback = the_callback; sci_rnc->user_callback = callback;
this_rnc->user_cookie = callback_parameter; sci_rnc->user_cookie = callback_parameter;
this_rnc->suspension_code = suspend_type; sci_rnc->suspension_code = suspend_type;
if (suspend_type == SCI_SOFTWARE_SUSPENSION) { if (suspend_type == SCI_SOFTWARE_SUSPENSION) {
scic_sds_remote_device_post_request( scic_sds_remote_device_post_request(
this_rnc->device, sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX
); );
} }
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_AWAIT_SUSPENSION_STATE
); );
...@@ -579,23 +579,23 @@ static enum sci_status scic_sds_remote_node_context_ready_state_suspend_handler( ...@@ -579,23 +579,23 @@ static enum sci_status scic_sds_remote_node_context_ready_state_suspend_handler(
/** /**
* *
* @this_rnc: The rnc for which the io request is targeted. * @sci_rnc: The rnc for which the io request is targeted.
* @the_request: The request which is going to be started. * @sci_req: The request which is going to be started.
* *
* This method determines if the io request can be started by the SCU hardware. * This method determines if the io request can be started by the SCU hardware.
* When the RNC is in the ready state any io request can be started. enum sci_status * When the RNC is in the ready state any io request can be started. enum sci_status
* SCI_SUCCESS * SCI_SUCCESS
*/ */
static enum sci_status scic_sds_remote_node_context_ready_state_start_io_handler( static enum sci_status scic_sds_remote_node_context_ready_state_start_io_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *the_request) struct scic_sds_request *sci_req)
{ {
return SCI_SUCCESS; return SCI_SUCCESS;
} }
static enum sci_status scic_sds_remote_node_context_ready_state_event_handler( static enum sci_status scic_sds_remote_node_context_ready_state_event_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 event_code) u32 event_code)
{ {
enum sci_status status; enum sci_status status;
...@@ -603,33 +603,33 @@ static enum sci_status scic_sds_remote_node_context_ready_state_event_handler( ...@@ -603,33 +603,33 @@ static enum sci_status scic_sds_remote_node_context_ready_state_event_handler(
switch (scu_get_event_type(event_code)) { switch (scu_get_event_type(event_code)) {
case SCU_EVENT_TL_RNC_SUSPEND_TX: case SCU_EVENT_TL_RNC_SUSPEND_TX:
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE
); );
this_rnc->suspension_code = scu_get_event_specifier(event_code); sci_rnc->suspension_code = scu_get_event_specifier(event_code);
status = SCI_SUCCESS; status = SCI_SUCCESS;
break; break;
case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: case SCU_EVENT_TL_RNC_SUSPEND_TX_RX:
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE
); );
this_rnc->suspension_code = scu_get_event_specifier(event_code); sci_rnc->suspension_code = scu_get_event_specifier(event_code);
status = SCI_SUCCESS; status = SCI_SUCCESS;
break; break;
default: default:
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to " "%s: SCIC Remote Node Context 0x%p requested to "
"process event 0x%x while in state %d.\n", "process event 0x%x while in state %d.\n",
__func__, __func__,
this_rnc, sci_rnc,
event_code, event_code,
sci_base_state_machine_get_state( sci_base_state_machine_get_state(
&this_rnc->state_machine)); &sci_rnc->state_machine));
status = SCI_FAILURE; status = SCI_FAILURE;
break; break;
...@@ -641,41 +641,41 @@ static enum sci_status scic_sds_remote_node_context_ready_state_event_handler( ...@@ -641,41 +641,41 @@ static enum sci_status scic_sds_remote_node_context_ready_state_event_handler(
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
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 *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
enum sci_status status; enum sci_status status;
struct smp_discover_response_protocols protocols; struct smp_discover_response_protocols protocols;
scic_sds_remote_node_context_setup_to_resume( scic_sds_remote_node_context_setup_to_resume(
this_rnc, the_callback, callback_parameter sci_rnc, callback, callback_parameter
); );
/* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */ /* TODO: consider adding a resume action of NONE, INVALIDATE, WRITE_TLCR */
scic_remote_device_get_protocols(this_rnc->device, &protocols); scic_remote_device_get_protocols(sci_rnc->device, &protocols);
if ( if (
(protocols.u.bits.attached_ssp_target == 1) (protocols.u.bits.attached_ssp_target == 1)
|| (protocols.u.bits.attached_smp_target == 1) || (protocols.u.bits.attached_smp_target == 1)
) { ) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE
); );
status = SCI_SUCCESS; status = SCI_SUCCESS;
} else if (protocols.u.bits.attached_stp_target == 1) { } else if (protocols.u.bits.attached_stp_target == 1) {
if (this_rnc->device->is_direct_attached) { if (sci_rnc->device->is_direct_attached) {
/* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */ /* @todo Fix this since I am being silly in writing to the STPTLDARNI register. */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE
); );
} else { } else {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_INVALIDATING_STATE
); );
} }
...@@ -690,8 +690,8 @@ static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_ha ...@@ -690,8 +690,8 @@ static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_ha
/** /**
* *
* @this_rnc: The remote node context which is to receive the task request. * @sci_rnc: The remote node context which is to receive the task request.
* @the_request: The task request to be transmitted to to the remote target * @sci_req: The task request to be transmitted to to the remote target
* device. * device.
* *
* This method will report a success or failure attempt to start a new task * This method will report a success or failure attempt to start a new task
...@@ -700,10 +700,10 @@ static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_ha ...@@ -700,10 +700,10 @@ static enum sci_status scic_sds_remote_node_context_tx_suspended_state_resume_ha
* enum sci_status SCI_SUCCESS * enum sci_status SCI_SUCCESS
*/ */
static enum sci_status scic_sds_remote_node_context_suspended_start_task_handler( static enum sci_status scic_sds_remote_node_context_suspended_start_task_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *the_request) struct scic_sds_request *sci_req)
{ {
scic_sds_remote_node_context_resume(this_rnc, NULL, NULL); scic_sds_remote_node_context_resume(sci_rnc, NULL, NULL);
return SCI_SUCCESS; return SCI_SUCCESS;
} }
...@@ -711,16 +711,16 @@ static enum sci_status scic_sds_remote_node_context_suspended_start_task_handler ...@@ -711,16 +711,16 @@ static enum sci_status scic_sds_remote_node_context_suspended_start_task_handler
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
static enum sci_status scic_sds_remote_node_context_tx_rx_suspended_state_resume_handler( static enum sci_status scic_sds_remote_node_context_tx_rx_suspended_state_resume_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
scic_sds_remote_node_context_setup_to_resume( scic_sds_remote_node_context_setup_to_resume(
this_rnc, the_callback, callback_parameter sci_rnc, callback, callback_parameter
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_RESUMING_STATE
); );
...@@ -735,12 +735,12 @@ static enum sci_status scic_sds_remote_node_context_tx_rx_suspended_state_resume ...@@ -735,12 +735,12 @@ static enum sci_status scic_sds_remote_node_context_tx_rx_suspended_state_resume
* *
*/ */
static enum sci_status scic_sds_remote_node_context_await_suspension_state_resume_handler( static enum sci_status scic_sds_remote_node_context_await_suspension_state_resume_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter) void *callback_parameter)
{ {
scic_sds_remote_node_context_setup_to_resume( scic_sds_remote_node_context_setup_to_resume(
this_rnc, the_callback, callback_parameter sci_rnc, callback, callback_parameter
); );
return SCI_SUCCESS; return SCI_SUCCESS;
...@@ -748,8 +748,8 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_resum ...@@ -748,8 +748,8 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_resum
/** /**
* *
* @this_rnc: The remote node context which is to receive the task request. * @sci_rnc: The remote node context which is to receive the task request.
* @the_request: The task request to be transmitted to to the remote target * @sci_req: The task request to be transmitted to to the remote target
* device. * device.
* *
* This method will report a success or failure attempt to start a new task * This method will report a success or failure attempt to start a new task
...@@ -758,14 +758,14 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_resum ...@@ -758,14 +758,14 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_resum
* enum sci_status SCI_SUCCESS * enum sci_status SCI_SUCCESS
*/ */
static enum sci_status scic_sds_remote_node_context_await_suspension_state_start_task_handler( static enum sci_status scic_sds_remote_node_context_await_suspension_state_start_task_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *the_request) struct scic_sds_request *sci_req)
{ {
return SCI_SUCCESS; return SCI_SUCCESS;
} }
static enum sci_status scic_sds_remote_node_context_await_suspension_state_event_handler( static enum sci_status scic_sds_remote_node_context_await_suspension_state_event_handler(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 event_code) u32 event_code)
{ {
enum sci_status status; enum sci_status status;
...@@ -773,33 +773,33 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_event ...@@ -773,33 +773,33 @@ static enum sci_status scic_sds_remote_node_context_await_suspension_state_event
switch (scu_get_event_type(event_code)) { switch (scu_get_event_type(event_code)) {
case SCU_EVENT_TL_RNC_SUSPEND_TX: case SCU_EVENT_TL_RNC_SUSPEND_TX:
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_TX_SUSPENDED_STATE
); );
this_rnc->suspension_code = scu_get_event_specifier(event_code); sci_rnc->suspension_code = scu_get_event_specifier(event_code);
status = SCI_SUCCESS; status = SCI_SUCCESS;
break; break;
case SCU_EVENT_TL_RNC_SUSPEND_TX_RX: case SCU_EVENT_TL_RNC_SUSPEND_TX_RX:
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_rnc->state_machine, &sci_rnc->state_machine,
SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_TX_RX_SUSPENDED_STATE
); );
this_rnc->suspension_code = scu_get_event_specifier(event_code); sci_rnc->suspension_code = scu_get_event_specifier(event_code);
status = SCI_SUCCESS; status = SCI_SUCCESS;
break; break;
default: default:
dev_warn(scirdev_to_dev(this_rnc->device), dev_warn(scirdev_to_dev(sci_rnc->device),
"%s: SCIC Remote Node Context 0x%p requested to " "%s: SCIC Remote Node Context 0x%p requested to "
"process event 0x%x while in state %d.\n", "process event 0x%x while in state %d.\n",
__func__, __func__,
this_rnc, sci_rnc,
event_code, event_code,
sci_base_state_machine_get_state( sci_base_state_machine_get_state(
&this_rnc->state_machine)); &sci_rnc->state_machine));
status = SCI_FAILURE; status = SCI_FAILURE;
break; break;
...@@ -929,41 +929,41 @@ static void scic_sds_remote_node_context_continue_state_transitions( ...@@ -929,41 +929,41 @@ static void scic_sds_remote_node_context_continue_state_transitions(
/** /**
* *
* @this_rnc: The remote node context object that is to be validated. * @sci_rnc: The remote node context object that is to be validated.
* *
* This method will mark the rnc buffer as being valid and post the request to * This method will mark the rnc buffer as being valid and post the request to
* the hardware. none * the hardware. none
*/ */
static void scic_sds_remote_node_context_validate_context_buffer( static void scic_sds_remote_node_context_validate_context_buffer(
struct scic_sds_remote_node_context *this_rnc) struct scic_sds_remote_node_context *sci_rnc)
{ {
union scu_remote_node_context *rnc_buffer; union scu_remote_node_context *rnc_buffer;
rnc_buffer = scic_sds_controller_get_remote_node_context_buffer( rnc_buffer = scic_sds_controller_get_remote_node_context_buffer(
scic_sds_remote_device_get_controller(this_rnc->device), scic_sds_remote_device_get_controller(sci_rnc->device),
this_rnc->remote_node_index sci_rnc->remote_node_index
); );
rnc_buffer->ssp.is_valid = true; rnc_buffer->ssp.is_valid = true;
if ( if (
!this_rnc->device->is_direct_attached !sci_rnc->device->is_direct_attached
&& this_rnc->device->target_protocols.u.bits.attached_stp_target && sci_rnc->device->target_protocols.u.bits.attached_stp_target
) { ) {
scic_sds_remote_device_post_request( scic_sds_remote_device_post_request(
this_rnc->device, sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_96 SCU_CONTEXT_COMMAND_POST_RNC_96
); );
} else { } else {
scic_sds_remote_device_post_request( scic_sds_remote_device_post_request(
this_rnc->device, sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_32 SCU_CONTEXT_COMMAND_POST_RNC_32
); );
if (this_rnc->device->is_direct_attached) { if (sci_rnc->device->is_direct_attached) {
scic_sds_port_setup_transports( scic_sds_port_setup_transports(
this_rnc->device->owning_port, sci_rnc->device->owning_port,
this_rnc->remote_node_index sci_rnc->remote_node_index
); );
} }
} }
...@@ -971,24 +971,24 @@ static void scic_sds_remote_node_context_validate_context_buffer( ...@@ -971,24 +971,24 @@ static void scic_sds_remote_node_context_validate_context_buffer(
/** /**
* *
* @this_rnc: The remote node context object that is to be invalidated. * @sci_rnc: The remote node context object that is to be invalidated.
* *
* This method will update the RNC buffer and post the invalidate request. none * This method will update the RNC buffer and post the invalidate request. none
*/ */
static void scic_sds_remote_node_context_invalidate_context_buffer( static void scic_sds_remote_node_context_invalidate_context_buffer(
struct scic_sds_remote_node_context *this_rnc) struct scic_sds_remote_node_context *sci_rnc)
{ {
union scu_remote_node_context *rnc_buffer; union scu_remote_node_context *rnc_buffer;
rnc_buffer = scic_sds_controller_get_remote_node_context_buffer( rnc_buffer = scic_sds_controller_get_remote_node_context_buffer(
scic_sds_remote_device_get_controller(this_rnc->device), scic_sds_remote_device_get_controller(sci_rnc->device),
this_rnc->remote_node_index sci_rnc->remote_node_index
); );
rnc_buffer->ssp.is_valid = false; rnc_buffer->ssp.is_valid = false;
scic_sds_remote_device_post_request( scic_sds_remote_device_post_request(
this_rnc->device, sci_rnc->device,
SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE
); );
} }
...@@ -1037,17 +1037,17 @@ static void scic_sds_remote_node_context_initial_state_enter( ...@@ -1037,17 +1037,17 @@ static void scic_sds_remote_node_context_initial_state_enter(
static void scic_sds_remote_node_context_posting_state_enter( static void scic_sds_remote_node_context_posting_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_remote_node_context *this_rnc; struct scic_sds_remote_node_context *sci_rnc;
this_rnc = (struct scic_sds_remote_node_context *)object; sci_rnc = (struct scic_sds_remote_node_context *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_rnc, sci_rnc,
scic_sds_remote_node_context_state_handler_table, scic_sds_remote_node_context_state_handler_table,
SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE SCIC_SDS_REMOTE_NODE_CONTEXT_POSTING_STATE
); );
scic_sds_remote_node_context_validate_context_buffer(this_rnc); scic_sds_remote_node_context_validate_context_buffer(sci_rnc);
} }
/** /**
......
...@@ -86,25 +86,25 @@ struct scic_sds_remote_node_context; ...@@ -86,25 +86,25 @@ struct scic_sds_remote_node_context;
typedef void (*scics_sds_remote_node_context_callback)(void *); typedef void (*scics_sds_remote_node_context_callback)(void *);
typedef enum sci_status (*scic_sds_remote_node_context_operation)( typedef enum sci_status (*scic_sds_remote_node_context_operation)(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter void *callback_parameter
); );
typedef enum sci_status (*scic_sds_remote_node_context_suspend_operation)( typedef enum sci_status (*scic_sds_remote_node_context_suspend_operation)(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 suspension_type, u32 suspension_type,
scics_sds_remote_node_context_callback the_callback, scics_sds_remote_node_context_callback callback,
void *callback_parameter void *callback_parameter
); );
typedef enum sci_status (*scic_sds_remote_node_context_io_request)( typedef enum sci_status (*scic_sds_remote_node_context_io_request)(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
struct scic_sds_request *the_request struct scic_sds_request *sci_req
); );
typedef enum sci_status (*scic_sds_remote_node_context_event_handler)( typedef enum sci_status (*scic_sds_remote_node_context_event_handler)(
struct scic_sds_remote_node_context *this_rnc, struct scic_sds_remote_node_context *sci_rnc,
u32 event_code u32 event_code
); );
...@@ -286,7 +286,7 @@ void scic_sds_remote_node_context_construct( ...@@ -286,7 +286,7 @@ void scic_sds_remote_node_context_construct(
bool scic_sds_remote_node_context_is_ready( bool scic_sds_remote_node_context_is_ready(
struct scic_sds_remote_node_context *this_rnc); struct scic_sds_remote_node_context *sci_rnc);
#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)
......
...@@ -226,7 +226,7 @@ static u32 scic_sds_ssp_request_get_object_size(void) ...@@ -226,7 +226,7 @@ static u32 scic_sds_ssp_request_get_object_size(void)
/** /**
* This method returns the sgl element pair for the specificed sgl_pair index. * This method returns the sgl element pair for the specificed sgl_pair index.
* @this_request: This parameter specifies the IO request for which to retrieve * @sci_req: This parameter specifies the IO request for which to retrieve
* the Scatter-Gather List element pair. * the Scatter-Gather List element pair.
* @sgl_pair_index: This parameter specifies the index into the SGL element * @sgl_pair_index: This parameter specifies the index into the SGL element
* pair to be retrieved. * pair to be retrieved.
...@@ -234,12 +234,12 @@ static u32 scic_sds_ssp_request_get_object_size(void) ...@@ -234,12 +234,12 @@ static u32 scic_sds_ssp_request_get_object_size(void)
* This method returns a pointer to an struct scu_sgl_element_pair. * This method returns a pointer to an struct scu_sgl_element_pair.
*/ */
static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair( static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 sgl_pair_index u32 sgl_pair_index
) { ) {
struct scu_task_context *task_context; struct scu_task_context *task_context;
task_context = (struct scu_task_context *)this_request->task_context_buffer; task_context = (struct scu_task_context *)sci_req->task_context_buffer;
if (sgl_pair_index == 0) { if (sgl_pair_index == 0) {
return &task_context->sgl_pair_ab; return &task_context->sgl_pair_ab;
...@@ -247,12 +247,12 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair( ...@@ -247,12 +247,12 @@ static struct scu_sgl_element_pair *scic_sds_request_get_sgl_element_pair(
return &task_context->sgl_pair_cd; return &task_context->sgl_pair_cd;
} }
return &this_request->sgl_element_pair_buffer[sgl_pair_index - 2]; return &sci_req->sgl_element_pair_buffer[sgl_pair_index - 2];
} }
/** /**
* This function will build the SGL list for an IO request. * This function will build the SGL list for an IO request.
* @this_request: This parameter specifies the IO request for which to build * @sci_req: This parameter specifies the IO request for which to build
* the Scatter-Gather List. * the Scatter-Gather List.
* *
*/ */
...@@ -325,36 +325,36 @@ void scic_sds_request_build_sgl(struct scic_sds_request *sds_request) ...@@ -325,36 +325,36 @@ void scic_sds_request_build_sgl(struct scic_sds_request *sds_request)
/** /**
* This method build the remainder of the IO request object. * This method build the remainder of the IO request object.
* @this_request: This parameter specifies the request object being constructed. * @sci_req: This parameter specifies the request object being constructed.
* *
* The scic_sds_general_request_construct() must be called before this call is * The scic_sds_general_request_construct() must be called before this call is
* valid. none * valid. none
*/ */
static void scic_sds_ssp_io_request_assign_buffers( static void scic_sds_ssp_io_request_assign_buffers(
struct scic_sds_request *this_request) struct scic_sds_request *sci_req)
{ {
this_request->command_buffer = sci_req->command_buffer =
scic_sds_ssp_request_get_command_buffer(this_request); scic_sds_ssp_request_get_command_buffer(sci_req);
this_request->response_buffer = sci_req->response_buffer =
scic_sds_ssp_request_get_response_buffer(this_request); scic_sds_ssp_request_get_response_buffer(sci_req);
this_request->sgl_element_pair_buffer = sci_req->sgl_element_pair_buffer =
scic_sds_ssp_request_get_sgl_element_buffer(this_request); scic_sds_ssp_request_get_sgl_element_buffer(sci_req);
this_request->sgl_element_pair_buffer = sci_req->sgl_element_pair_buffer =
PTR_ALIGN(this_request->sgl_element_pair_buffer, PTR_ALIGN(sci_req->sgl_element_pair_buffer,
sizeof(struct scu_sgl_element_pair)); sizeof(struct scu_sgl_element_pair));
if (this_request->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false) {
this_request->task_context_buffer = sci_req->task_context_buffer =
scic_sds_ssp_request_get_task_context_buffer(this_request); scic_sds_ssp_request_get_task_context_buffer(sci_req);
this_request->task_context_buffer = sci_req->task_context_buffer =
PTR_ALIGN(this_request->task_context_buffer, PTR_ALIGN(sci_req->task_context_buffer,
SMP_CACHE_BYTES); SMP_CACHE_BYTES);
} }
} }
/** /**
* This method constructs the SSP Command IU data for this io request object. * This method constructs the SSP Command IU data for this io request object.
* @this_request: This parameter specifies the request object for which the SSP * @sci_req: This parameter specifies the request object for which the SSP
* command information unit is being built. * command information unit is being built.
* *
*/ */
...@@ -401,7 +401,7 @@ static void scic_sds_io_request_build_ssp_command_iu( ...@@ -401,7 +401,7 @@ static void scic_sds_io_request_build_ssp_command_iu(
/** /**
* This method constructs the SSP Task IU data for this io request object. * This method constructs the SSP Task IU data for this io request object.
* @this_request: * @sci_req:
* *
*/ */
static void scic_sds_task_request_build_ssp_task_iu( static void scic_sds_task_request_build_ssp_task_iu(
...@@ -430,7 +430,7 @@ static void scic_sds_task_request_build_ssp_task_iu( ...@@ -430,7 +430,7 @@ static void scic_sds_task_request_build_ssp_task_iu(
/** /**
* This method is will fill in the SCU Task Context for any type of SSP request. * This method is will fill in the SCU Task Context for any type of SSP request.
* @this_request: * @sci_req:
* @task_context: * @task_context:
* *
*/ */
...@@ -474,7 +474,7 @@ static void scu_ssp_reqeust_construct_task_context( ...@@ -474,7 +474,7 @@ static void scu_ssp_reqeust_construct_task_context(
task_context->address_modifier = 0; task_context->address_modifier = 0;
/* task_context->type.ssp.tag = this_request->io_tag; */ /* task_context->type.ssp.tag = sci_req->io_tag; */
task_context->task_phase = 0x01; task_context->task_phase = 0x01;
if (sds_request->was_tag_assigned_by_user) { if (sds_request->was_tag_assigned_by_user) {
...@@ -530,7 +530,7 @@ static void scu_ssp_reqeust_construct_task_context( ...@@ -530,7 +530,7 @@ static void scu_ssp_reqeust_construct_task_context(
/** /**
* This method is will fill in the SCU Task Context for a SSP IO request. * This method is will fill in the SCU Task Context for a SSP IO request.
* @this_request: * @sci_req:
* *
*/ */
static void scu_ssp_io_request_construct_task_context( static void scu_ssp_io_request_construct_task_context(
...@@ -568,24 +568,24 @@ static void scu_ssp_io_request_construct_task_context( ...@@ -568,24 +568,24 @@ static void scu_ssp_io_request_construct_task_context(
/** /**
* This method will fill in the remainder of the io request object for SSP Task * This method will fill in the remainder of the io request object for SSP Task
* requests. * requests.
* @this_request: * @sci_req:
* *
*/ */
static void scic_sds_ssp_task_request_assign_buffers( static void scic_sds_ssp_task_request_assign_buffers(
struct scic_sds_request *this_request) struct scic_sds_request *sci_req)
{ {
/* Assign all of the buffer pointers */ /* Assign all of the buffer pointers */
this_request->command_buffer = sci_req->command_buffer =
scic_sds_ssp_task_request_get_command_buffer(this_request); scic_sds_ssp_task_request_get_command_buffer(sci_req);
this_request->response_buffer = sci_req->response_buffer =
scic_sds_ssp_task_request_get_response_buffer(this_request); scic_sds_ssp_task_request_get_response_buffer(sci_req);
this_request->sgl_element_pair_buffer = NULL; sci_req->sgl_element_pair_buffer = NULL;
if (this_request->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false) {
this_request->task_context_buffer = sci_req->task_context_buffer =
scic_sds_ssp_task_request_get_task_context_buffer(this_request); scic_sds_ssp_task_request_get_task_context_buffer(sci_req);
this_request->task_context_buffer = sci_req->task_context_buffer =
PTR_ALIGN(this_request->task_context_buffer, SMP_CACHE_BYTES); PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES);
} }
} }
...@@ -598,18 +598,18 @@ static void scic_sds_ssp_task_request_assign_buffers( ...@@ -598,18 +598,18 @@ static void scic_sds_ssp_task_request_assign_buffers(
* (i.e. non-raw frame) is being utilized to perform task management. -# * (i.e. non-raw frame) is being utilized to perform task management. -#
* control_frame == 1. This ensures that the proper endianess is set so * control_frame == 1. This ensures that the proper endianess is set so
* that the bytes are transmitted in the right order for a task frame. * that the bytes are transmitted in the right order for a task frame.
* @this_request: This parameter specifies the task request object being * @sci_req: This parameter specifies the task request object being
* constructed. * constructed.
* *
*/ */
static void scu_ssp_task_request_construct_task_context( static void scu_ssp_task_request_construct_task_context(
struct scic_sds_request *this_request) struct scic_sds_request *sci_req)
{ {
struct scu_task_context *task_context; struct scu_task_context *task_context;
task_context = scic_sds_request_get_task_context(this_request); task_context = scic_sds_request_get_task_context(sci_req);
scu_ssp_reqeust_construct_task_context(this_request, task_context); scu_ssp_reqeust_construct_task_context(sci_req, task_context);
task_context->control_frame = 1; task_context->control_frame = 1;
task_context->priority = SCU_TASK_PRIORITY_HIGH; task_context->priority = SCU_TASK_PRIORITY_HIGH;
...@@ -623,7 +623,7 @@ static void scu_ssp_task_request_construct_task_context( ...@@ -623,7 +623,7 @@ static void scu_ssp_task_request_construct_task_context(
/** /**
* This method constructs the SSP Command IU data for this ssp passthrough * This method constructs the SSP Command IU data for this ssp passthrough
* comand request object. * comand request object.
* @this_request: This parameter specifies the request object for which the SSP * @sci_req: This parameter specifies the request object for which the SSP
* command information unit is being built. * command information unit is being built.
* *
* enum sci_status, returns invalid parameter is cdb > 16 * enum sci_status, returns invalid parameter is cdb > 16
...@@ -632,7 +632,7 @@ static void scu_ssp_task_request_construct_task_context( ...@@ -632,7 +632,7 @@ static void scu_ssp_task_request_construct_task_context(
/** /**
* This method constructs the SATA request object. * This method constructs the SATA request object.
* @this_request: * @sci_req:
* @sat_protocol: * @sat_protocol:
* @transfer_length: * @transfer_length:
* @data_direction: * @data_direction:
...@@ -964,7 +964,7 @@ scic_sds_io_request_tc_completion(struct scic_sds_request *request, u32 completi ...@@ -964,7 +964,7 @@ scic_sds_io_request_tc_completion(struct scic_sds_request *request, u32 completi
/** /**
* *
* @this_request: The SCIC_SDS_IO_REQUEST_T object for which the start * @sci_req: The SCIC_SDS_IO_REQUEST_T object for which the start
* operation is to be executed. * operation is to be executed.
* @frame_index: The frame index returned by the hardware for the reqeust * @frame_index: The frame index returned by the hardware for the reqeust
* object. * object.
...@@ -992,7 +992,7 @@ enum sci_status scic_sds_io_request_frame_handler( ...@@ -992,7 +992,7 @@ enum sci_status scic_sds_io_request_frame_handler(
/** /**
* *
* @this_request: The SCIC_SDS_IO_REQUEST_T object for which the task start * @sci_req: The SCIC_SDS_IO_REQUEST_T object for which the task start
* operation is to be executed. * operation is to be executed.
* *
* This method invokes the core state task complete handler for the * This method invokes the core state task complete handler for the
...@@ -1007,7 +1007,7 @@ enum sci_status scic_sds_io_request_frame_handler( ...@@ -1007,7 +1007,7 @@ enum sci_status scic_sds_io_request_frame_handler(
/** /**
* This method copies response data for requests returning response data * This method copies response data for requests returning response data
* instead of sense data. * instead of sense data.
* @this_request: This parameter specifies the request object for which to copy * @sci_req: This parameter specifies the request object for which to copy
* the response data. * the response data.
* *
*/ */
...@@ -1161,14 +1161,14 @@ enum sci_status scic_sds_request_started_state_abort_handler( ...@@ -1161,14 +1161,14 @@ enum sci_status scic_sds_request_started_state_abort_handler(
* TC (task context) completions for normal IO request (i.e. Task/Abort * TC (task context) completions for normal IO request (i.e. Task/Abort
* Completions of type 0). This method will update the * Completions of type 0). This method will update the
* SCIC_SDS_IO_REQUEST_T::status field. * SCIC_SDS_IO_REQUEST_T::status field.
* @this_request: This parameter specifies the request for which a completion * @sci_req: This parameter specifies the request for which a completion
* occurred. * occurred.
* @completion_code: This parameter specifies the completion code received from * @completion_code: This parameter specifies the completion code received from
* the SCU. * the SCU.
* *
*/ */
enum sci_status scic_sds_request_started_state_tc_completion_handler( enum sci_status scic_sds_request_started_state_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
u8 data_present; u8 data_present;
...@@ -1181,7 +1181,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1181,7 +1181,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
break; break;
...@@ -1194,20 +1194,20 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1194,20 +1194,20 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
* response stats to see if this is truly a failed request or a good * response stats to see if this is truly a failed request or a good
* request that just got completed early. */ * request that just got completed early. */
struct sci_ssp_response_iu *response = (struct sci_ssp_response_iu *) struct sci_ssp_response_iu *response = (struct sci_ssp_response_iu *)
this_request->response_buffer; sci_req->response_buffer;
scic_word_copy_with_swap( scic_word_copy_with_swap(
this_request->response_buffer, sci_req->response_buffer,
this_request->response_buffer, sci_req->response_buffer,
sizeof(struct sci_ssp_response_iu) / sizeof(u32) sizeof(struct sci_ssp_response_iu) / sizeof(u32)
); );
if (response->status == 0) { if (response->status == 0) {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS_IO_DONE_EARLY sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS_IO_DONE_EARLY
); );
} else { } else {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
...@@ -1217,13 +1217,13 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1217,13 +1217,13 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CHECK_RESPONSE): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CHECK_RESPONSE):
scic_word_copy_with_swap( scic_word_copy_with_swap(
this_request->response_buffer, sci_req->response_buffer,
this_request->response_buffer, sci_req->response_buffer,
sizeof(struct sci_ssp_response_iu) / sizeof(u32) sizeof(struct sci_ssp_response_iu) / sizeof(u32)
); );
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
...@@ -1234,19 +1234,19 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1234,19 +1234,19 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
* / @todo With TASK_DONE_RESP_LEN_ERR is the response frame guaranteed * / @todo With TASK_DONE_RESP_LEN_ERR is the response frame guaranteed
* / to be received before this completion status is posted? */ * / to be received before this completion status is posted? */
response_buffer = response_buffer =
(struct sci_ssp_response_iu *)this_request->response_buffer; (struct sci_ssp_response_iu *)sci_req->response_buffer;
data_present = data_present =
response_buffer->data_present & SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK; response_buffer->data_present & SCI_SSP_RESPONSE_IU_DATA_PRESENT_MASK;
if ((data_present == 0x01) || (data_present == 0x02)) { if ((data_present == 0x01) || (data_present == 0x02)) {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
} else { } else {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
} }
break; break;
...@@ -1263,15 +1263,15 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1263,15 +1263,15 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_SDBFIS): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_UNEXP_SDBFIS):
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_REG_ERR):
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_SDB_ERR):
if (this_request->protocol == SCIC_STP_PROTOCOL) { if (sci_req->protocol == SCIC_STP_PROTOCOL) {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT, SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED
); );
} else { } else {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT, SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
...@@ -1290,7 +1290,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1290,7 +1290,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_PROTOCOL_NOT_SUPPORTED):
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_OPEN_REJECT_CONNECTION_RATE_NOT_SUPPORTED):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT, SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED SCI_FAILURE_REMOTE_DEVICE_RESET_REQUIRED
); );
...@@ -1314,7 +1314,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1314,7 +1314,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RNCNV_OUTBOUND): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_RNCNV_OUTBOUND):
default: default:
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT, SCU_GET_COMPLETION_TL_STATUS(completion_code) >> SCU_COMPLETION_TL_STATUS_SHIFT,
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
...@@ -1326,7 +1326,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1326,7 +1326,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
*/ */
/* In all cases we will treat this as the completion of the IO request. */ /* In all cases we will treat this as the completion of the IO request. */
sci_base_state_machine_change_state(&this_request->state_machine, sci_base_state_machine_change_state(&sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
return SCI_SUCCESS; return SCI_SUCCESS;
} }
...@@ -1340,7 +1340,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler( ...@@ -1340,7 +1340,7 @@ enum sci_status scic_sds_request_started_state_tc_completion_handler(
* logged. enum sci_status SCI_SUCCESS SCI_FAILURE_INVALID_PARAMETER_VALUE * logged. enum sci_status SCI_SUCCESS SCI_FAILURE_INVALID_PARAMETER_VALUE
*/ */
static enum sci_status scic_sds_request_started_state_frame_handler( static enum sci_status scic_sds_request_started_state_frame_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 frame_index) u32 frame_index)
{ {
enum sci_status status; enum sci_status status;
...@@ -1348,7 +1348,7 @@ static enum sci_status scic_sds_request_started_state_frame_handler( ...@@ -1348,7 +1348,7 @@ static enum sci_status scic_sds_request_started_state_frame_handler(
/* / @todo If this is a response frame we must record that we received it */ /* / @todo If this is a response frame we must record that we received it */
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(scic_sds_request_get_controller(this_request)->uf_control), &(scic_sds_request_get_controller(sci_req)->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -1357,37 +1357,37 @@ static enum sci_status scic_sds_request_started_state_frame_handler( ...@@ -1357,37 +1357,37 @@ static enum sci_status scic_sds_request_started_state_frame_handler(
struct sci_ssp_response_iu *response_buffer; struct sci_ssp_response_iu *response_buffer;
status = scic_sds_unsolicited_frame_control_get_buffer( status = scic_sds_unsolicited_frame_control_get_buffer(
&(scic_sds_request_get_controller(this_request)->uf_control), &(scic_sds_request_get_controller(sci_req)->uf_control),
frame_index, frame_index,
(void **)&response_buffer (void **)&response_buffer
); );
scic_word_copy_with_swap( scic_word_copy_with_swap(
this_request->response_buffer, sci_req->response_buffer,
(u32 *)response_buffer, (u32 *)response_buffer,
sizeof(struct sci_ssp_response_iu) sizeof(struct sci_ssp_response_iu)
); );
response_buffer = (struct sci_ssp_response_iu *)this_request->response_buffer; response_buffer = (struct sci_ssp_response_iu *)sci_req->response_buffer;
if ((response_buffer->data_present == 0x01) || if ((response_buffer->data_present == 0x01) ||
(response_buffer->data_present == 0x02)) { (response_buffer->data_present == 0x02)) {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
} else } else
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
} else } else
/* This was not a response frame why did it get forwarded? */ /* This was not a response frame why did it get forwarded? */
dev_err(scic_to_dev(this_request->owning_controller), dev_err(scic_to_dev(sci_req->owning_controller),
"%s: SCIC IO Request 0x%p received unexpected " "%s: SCIC IO Request 0x%p received unexpected "
"frame %d type 0x%02x\n", "frame %d type 0x%02x\n",
__func__, __func__,
this_request, sci_req,
frame_index, frame_index,
frame_header->frame_type); frame_header->frame_type);
...@@ -1395,7 +1395,7 @@ static enum sci_status scic_sds_request_started_state_frame_handler( ...@@ -1395,7 +1395,7 @@ static enum sci_status scic_sds_request_started_state_frame_handler(
* In any case we are done with this frame buffer return it to the * In any case we are done with this frame buffer return it to the
* controller */ * controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->owning_controller, frame_index sci_req->owning_controller, frame_index
); );
return SCI_SUCCESS; return SCI_SUCCESS;
...@@ -1460,17 +1460,17 @@ static enum sci_status scic_sds_request_aborting_state_abort_handler( ...@@ -1460,17 +1460,17 @@ static enum sci_status scic_sds_request_aborting_state_abort_handler(
* transitions to the completed state. enum sci_status SCI_SUCCESS * transitions to the completed state. enum sci_status SCI_SUCCESS
*/ */
static enum sci_status scic_sds_request_aborting_state_tc_completion_handler( static enum sci_status scic_sds_request_aborting_state_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT):
case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT): case (SCU_TASK_DONE_TASK_ABORT << SCU_COMPLETION_TL_STATUS_SHIFT):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_TASK_ABORT, SCI_FAILURE_IO_TERMINATED sci_req, SCU_TASK_DONE_TASK_ABORT, SCI_FAILURE_IO_TERMINATED
); );
sci_base_state_machine_change_state(&this_request->state_machine, sci_base_state_machine_change_state(&sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
...@@ -1491,13 +1491,13 @@ static enum sci_status scic_sds_request_aborting_state_tc_completion_handler( ...@@ -1491,13 +1491,13 @@ static enum sci_status scic_sds_request_aborting_state_tc_completion_handler(
* completion. enum sci_status SCI_SUCCESS * completion. enum sci_status SCI_SUCCESS
*/ */
static enum sci_status scic_sds_request_aborting_state_frame_handler( static enum sci_status scic_sds_request_aborting_state_frame_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 frame_index) u32 frame_index)
{ {
/* TODO: Is it even possible to get an unsolicited frame in the aborting state? */ /* TODO: Is it even possible to get an unsolicited frame in the aborting state? */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->owning_controller, frame_index); sci_req->owning_controller, frame_index);
return SCI_SUCCESS; return SCI_SUCCESS;
} }
...@@ -1539,10 +1539,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_request_state_han ...@@ -1539,10 +1539,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_request_state_han
static void scic_sds_request_initial_state_enter( static void scic_sds_request_initial_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_request_state_handler_table, scic_sds_request_state_handler_table,
SCI_BASE_REQUEST_STATE_INITIAL SCI_BASE_REQUEST_STATE_INITIAL
); );
...@@ -1559,10 +1559,10 @@ static void scic_sds_request_initial_state_enter( ...@@ -1559,10 +1559,10 @@ static void scic_sds_request_initial_state_enter(
static void scic_sds_request_constructed_state_enter( static void scic_sds_request_constructed_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_request_state_handler_table, scic_sds_request_state_handler_table,
SCI_BASE_REQUEST_STATE_CONSTRUCTED SCI_BASE_REQUEST_STATE_CONSTRUCTED
); );
...@@ -1580,10 +1580,10 @@ static void scic_sds_request_constructed_state_enter( ...@@ -1580,10 +1580,10 @@ static void scic_sds_request_constructed_state_enter(
static void scic_sds_request_started_state_enter( static void scic_sds_request_started_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_request_state_handler_table, scic_sds_request_state_handler_table,
SCI_BASE_REQUEST_STATE_STARTED SCI_BASE_REQUEST_STATE_STARTED
); );
...@@ -1591,8 +1591,8 @@ static void scic_sds_request_started_state_enter( ...@@ -1591,8 +1591,8 @@ static void scic_sds_request_started_state_enter(
/* /*
* Most of the request state machines have a started substate machine so * Most of the request state machines have a started substate machine so
* start its execution on the entry to the started state. */ * start its execution on the entry to the started state. */
if (this_request->has_started_substate_machine == true) if (sci_req->has_started_substate_machine == true)
sci_base_state_machine_start(&this_request->started_substate_machine); sci_base_state_machine_start(&sci_req->started_substate_machine);
} }
/** /**
...@@ -1608,10 +1608,10 @@ static void scic_sds_request_started_state_enter( ...@@ -1608,10 +1608,10 @@ static void scic_sds_request_started_state_enter(
static void scic_sds_request_started_state_exit( static void scic_sds_request_started_state_exit(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
if (this_request->has_started_substate_machine == true) if (sci_req->has_started_substate_machine == true)
sci_base_state_machine_stop(&this_request->started_substate_machine); sci_base_state_machine_stop(&sci_req->started_substate_machine);
} }
/** /**
...@@ -1660,13 +1660,13 @@ static void scic_sds_request_completed_state_enter( ...@@ -1660,13 +1660,13 @@ static void scic_sds_request_completed_state_enter(
static void scic_sds_request_aborting_state_enter( static void scic_sds_request_aborting_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
/* Setting the abort bit in the Task Context is required by the silicon. */ /* Setting the abort bit in the Task Context is required by the silicon. */
this_request->task_context_buffer->abort = 1; sci_req->task_context_buffer->abort = 1;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_request_state_handler_table, scic_sds_request_state_handler_table,
SCI_BASE_REQUEST_STATE_ABORTING SCI_BASE_REQUEST_STATE_ABORTING
); );
...@@ -1684,10 +1684,10 @@ static void scic_sds_request_aborting_state_enter( ...@@ -1684,10 +1684,10 @@ static void scic_sds_request_aborting_state_enter(
static void scic_sds_request_final_state_enter( static void scic_sds_request_final_state_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_request_state_handler_table, scic_sds_request_state_handler_table,
SCI_BASE_REQUEST_STATE_FINAL SCI_BASE_REQUEST_STATE_FINAL
); );
......
...@@ -336,32 +336,32 @@ extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substat ...@@ -336,32 +336,32 @@ extern const struct sci_base_state scic_sds_io_request_started_task_mgmt_substat
* *
* This macro will return the controller for this io request object * This macro will return the controller for this io request object
*/ */
#define scic_sds_request_get_controller(this_request) \ #define scic_sds_request_get_controller(sci_req) \
((this_request)->owning_controller) ((sci_req)->owning_controller)
/** /**
* scic_sds_request_get_device() - * scic_sds_request_get_device() -
* *
* This macro will return the device for this io request object * This macro will return the device for this io request object
*/ */
#define scic_sds_request_get_device(this_request) \ #define scic_sds_request_get_device(sci_req) \
((this_request)->target_device) ((sci_req)->target_device)
/** /**
* scic_sds_request_get_port() - * scic_sds_request_get_port() -
* *
* This macro will return the port for this io request object * This macro will return the port for this io request object
*/ */
#define scic_sds_request_get_port(this_request) \ #define scic_sds_request_get_port(sci_req) \
scic_sds_remote_device_get_port(scic_sds_request_get_device(this_request)) scic_sds_remote_device_get_port(scic_sds_request_get_device(sci_req))
/** /**
* scic_sds_request_get_post_context() - * scic_sds_request_get_post_context() -
* *
* This macro returns the constructed post context result for the io request. * This macro returns the constructed post context result for the io request.
*/ */
#define scic_sds_request_get_post_context(this_request) \ #define scic_sds_request_get_post_context(sci_req) \
((this_request)->post_context) ((sci_req)->post_context)
/** /**
* scic_sds_request_get_task_context() - * scic_sds_request_get_task_context() -
...@@ -433,41 +433,41 @@ scic_sds_io_request_tc_completion(struct scic_sds_request *request, u32 completi ...@@ -433,41 +433,41 @@ scic_sds_io_request_tc_completion(struct scic_sds_request *request, u32 completi
* ***************************************************************************** */ * ***************************************************************************** */
void scic_sds_request_build_sgl( void scic_sds_request_build_sgl(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
void scic_sds_stp_request_assign_buffers( void scic_sds_stp_request_assign_buffers(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
void scic_sds_smp_request_assign_buffers( void scic_sds_smp_request_assign_buffers(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
/* --------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------- */
enum sci_status scic_sds_request_start( enum sci_status scic_sds_request_start(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
enum sci_status scic_sds_io_request_terminate( enum sci_status scic_sds_io_request_terminate(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
enum sci_status scic_sds_io_request_complete( enum sci_status scic_sds_io_request_complete(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
void scic_sds_io_request_copy_response( void scic_sds_io_request_copy_response(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
enum sci_status scic_sds_io_request_event_handler( enum sci_status scic_sds_io_request_event_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 event_code); u32 event_code);
enum sci_status scic_sds_io_request_frame_handler( enum sci_status scic_sds_io_request_frame_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 frame_index); u32 frame_index);
enum sci_status scic_sds_task_request_terminate( enum sci_status scic_sds_task_request_terminate(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
/* /*
* ***************************************************************************** * *****************************************************************************
...@@ -475,10 +475,10 @@ enum sci_status scic_sds_task_request_terminate( ...@@ -475,10 +475,10 @@ enum sci_status scic_sds_task_request_terminate(
* ***************************************************************************** */ * ***************************************************************************** */
enum sci_status scic_sds_request_started_state_abort_handler( enum sci_status scic_sds_request_started_state_abort_handler(
struct scic_sds_request *request); struct scic_sds_request *sci_req);
enum sci_status scic_sds_request_started_state_tc_completion_handler( enum sci_status scic_sds_request_started_state_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code); u32 completion_code);
#endif /* _SCIC_SDS_IO_REQUEST_H_ */ #endif /* _SCIC_SDS_IO_REQUEST_H_ */
...@@ -142,15 +142,15 @@ scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler( ...@@ -142,15 +142,15 @@ scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
enum sci_status status; enum sci_status status;
struct scic_sds_request *the_request; struct scic_sds_request *sci_req;
the_request = (struct scic_sds_request *)request; sci_req = (struct scic_sds_request *)request;
status = scic_sds_io_request_complete(the_request); status = scic_sds_io_request_complete(sci_req);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io( status = scic_sds_port_complete_io(
device->owning_port, device, the_request); device->owning_port, device, sci_req);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
scic_sds_remote_device_decrement_request_count(device); scic_sds_remote_device_decrement_request_count(device);
...@@ -165,7 +165,7 @@ scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler( ...@@ -165,7 +165,7 @@ scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
"failed with status %d.\n", "failed with status %d.\n",
__func__, __func__,
device, device,
the_request, sci_req,
device->owning_port, device->owning_port,
status); status);
} }
...@@ -175,13 +175,13 @@ scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler( ...@@ -175,13 +175,13 @@ scic_sds_smp_remote_device_ready_cmd_substate_complete_io_handler(
/** /**
* This is frame handler for smp device ready cmd substate. * This is frame handler for smp device ready cmd substate.
* @this_device: This is the device object that is receiving the frame. * @sci_dev: This is the device object that is receiving the frame.
* @frame_index: The index for the frame received. * @frame_index: The index for the frame received.
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handler( static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index) u32 frame_index)
{ {
enum sci_status status; enum sci_status status;
...@@ -191,7 +191,7 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl ...@@ -191,7 +191,7 @@ static enum sci_status scic_sds_smp_remote_device_ready_cmd_substate_frame_handl
* / in this state. All unsolicited frames are forwarded to the io request * / in this state. All unsolicited frames are forwarded to the io request
* / object. */ * / object. */
status = scic_sds_io_request_frame_handler( status = scic_sds_io_request_frame_handler(
this_device->working_request, sci_dev->working_request,
frame_index frame_index
); );
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
#include "scu_task_context.h" #include "scu_task_context.h"
static void scu_smp_request_construct_task_context( static void scu_smp_request_construct_task_context(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
struct smp_request *smp_request); struct smp_request *smp_request);
/** /**
...@@ -118,27 +118,27 @@ u32 scic_sds_smp_request_get_object_size(void) ...@@ -118,27 +118,27 @@ u32 scic_sds_smp_request_get_object_size(void)
/** /**
* This method build the remainder of the IO request object. * This method build the remainder of the IO request object.
* @this_request: This parameter specifies the request object being constructed. * @sci_req: This parameter specifies the request object being constructed.
* *
* The scic_sds_general_request_construct() must be called before this call is * The scic_sds_general_request_construct() must be called before this call is
* valid. none * valid. none
*/ */
void scic_sds_smp_request_assign_buffers( void scic_sds_smp_request_assign_buffers(
struct scic_sds_request *this_request) struct scic_sds_request *sci_req)
{ {
/* Assign all of the buffer pointers */ /* Assign all of the buffer pointers */
this_request->command_buffer = sci_req->command_buffer =
scic_sds_smp_request_get_command_buffer(this_request); scic_sds_smp_request_get_command_buffer(sci_req);
this_request->response_buffer = sci_req->response_buffer =
scic_sds_smp_request_get_response_buffer(this_request); scic_sds_smp_request_get_response_buffer(sci_req);
this_request->sgl_element_pair_buffer = NULL; sci_req->sgl_element_pair_buffer = NULL;
if (this_request->was_tag_assigned_by_user == false) { if (sci_req->was_tag_assigned_by_user == false) {
this_request->task_context_buffer = sci_req->task_context_buffer =
scic_sds_smp_request_get_task_context_buffer(this_request); scic_sds_smp_request_get_task_context_buffer(sci_req);
this_request->task_context_buffer = sci_req->task_context_buffer =
PTR_ALIGN(this_request->task_context_buffer, SMP_CACHE_BYTES); PTR_ALIGN(sci_req->task_context_buffer, SMP_CACHE_BYTES);
} }
} }
...@@ -163,7 +163,7 @@ void scic_sds_smp_request_assign_buffers( ...@@ -163,7 +163,7 @@ void scic_sds_smp_request_assign_buffers(
* (i.e. non-raw frame) is being utilized to perform task management. -# * (i.e. non-raw frame) is being utilized to perform task management. -#
* control_frame == 1. This ensures that the proper endianess is set so * control_frame == 1. This ensures that the proper endianess is set so
* that the bytes are transmitted in the right order for a smp request frame. * that the bytes are transmitted in the right order for a smp request frame.
* @this_request: This parameter specifies the smp request object being * @sci_req: This parameter specifies the smp request object being
* constructed. * constructed.
* *
*/ */
...@@ -295,7 +295,7 @@ static void scu_smp_request_construct_task_context( ...@@ -295,7 +295,7 @@ static void scu_smp_request_construct_task_context(
* for a response frame. It will copy the response data, release the * for a response frame. It will copy the response data, release the
* unsolicited frame, and transition the request to the * unsolicited frame, and transition the request to the
* SCI_BASE_REQUEST_STATE_COMPLETED state. * SCI_BASE_REQUEST_STATE_COMPLETED state.
* @this_request: This parameter specifies the request for which the * @sci_req: This parameter specifies the request for which the
* unsolicited frame was received. * unsolicited frame was received.
* @frame_index: This parameter indicates the unsolicited frame index that * @frame_index: This parameter indicates the unsolicited frame index that
* should contain the response. * should contain the response.
...@@ -305,16 +305,16 @@ static void scu_smp_request_construct_task_context( ...@@ -305,16 +305,16 @@ static void scu_smp_request_construct_task_context(
* indicates successful processing of the TC response. * indicates successful processing of the TC response.
*/ */
static enum sci_status scic_sds_smp_request_await_response_frame_handler( static enum sci_status scic_sds_smp_request_await_response_frame_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 frame_index) u32 frame_index)
{ {
enum sci_status status; enum sci_status status;
void *frame_header; void *frame_header;
struct smp_response_header *this_frame_header; struct smp_response_header *rsp_hdr;
u8 *user_smp_buffer = this_request->response_buffer; u8 *user_smp_buffer = sci_req->response_buffer;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(scic_sds_request_get_controller(this_request)->uf_control), &(scic_sds_request_get_controller(sci_req)->uf_control),
frame_index, frame_index,
&frame_header &frame_header
); );
...@@ -325,13 +325,13 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler( ...@@ -325,13 +325,13 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler(
frame_header, frame_header,
sizeof(struct smp_response_header) / sizeof(u32) sizeof(struct smp_response_header) / sizeof(u32)
); );
this_frame_header = (struct smp_response_header *)user_smp_buffer; rsp_hdr = (struct smp_response_header *)user_smp_buffer;
if (this_frame_header->smp_frame_type == SMP_FRAME_TYPE_RESPONSE) { if (rsp_hdr->smp_frame_type == SMP_FRAME_TYPE_RESPONSE) {
void *smp_response_buffer; void *smp_response_buffer;
status = scic_sds_unsolicited_frame_control_get_buffer( status = scic_sds_unsolicited_frame_control_get_buffer(
&(scic_sds_request_get_controller(this_request)->uf_control), &(scic_sds_request_get_controller(sci_req)->uf_control),
frame_index, frame_index,
&smp_response_buffer &smp_response_buffer
); );
...@@ -341,23 +341,23 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler( ...@@ -341,23 +341,23 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler(
smp_response_buffer, smp_response_buffer,
sizeof(union smp_response_body) / sizeof(u32) sizeof(union smp_response_body) / sizeof(u32)
); );
if (this_frame_header->function == SMP_FUNCTION_DISCOVER) { if (rsp_hdr->function == SMP_FUNCTION_DISCOVER) {
struct smp_response *this_smp_response; struct smp_response *smp_resp;
this_smp_response = (struct smp_response *)user_smp_buffer; smp_resp = (struct smp_response *)user_smp_buffer;
/* /*
* Some expanders only report an attached SATA device, and * Some expanders only report an attached SATA device, and
* not an STP target. Since the core depends on the STP * not an STP target. Since the core depends on the STP
* target attribute to correctly build I/O, set the bit now * target attribute to correctly build I/O, set the bit now
* if necessary. */ * if necessary. */
if (this_smp_response->response.discover.protocols.u.bits.attached_sata_device if (smp_resp->response.discover.protocols.u.bits.attached_sata_device
&& !this_smp_response->response.discover.protocols.u.bits.attached_stp_target) { && !smp_resp->response.discover.protocols.u.bits.attached_stp_target) {
this_smp_response->response.discover.protocols.u.bits.attached_stp_target = 1; smp_resp->response.discover.protocols.u.bits.attached_stp_target = 1;
dev_dbg(scic_to_dev(this_request->owning_controller), dev_dbg(scic_to_dev(sci_req->owning_controller),
"%s: scic_sds_smp_request_await_response_frame_handler(0x%p) Found SATA dev, setting STP bit.\n", "%s: scic_sds_smp_request_await_response_frame_handler(0x%p) Found SATA dev, setting STP bit.\n",
__func__, this_request); __func__, sci_req);
} }
} }
...@@ -367,40 +367,40 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler( ...@@ -367,40 +367,40 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler(
/* /*
* copy the smp response to framework smp request's response buffer. * copy the smp response to framework smp request's response buffer.
* scic_sds_smp_request_copy_response(this_request); */ * scic_sds_smp_request_copy_response(sci_req); */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION
); );
} else { } else {
/* This was not a response frame why did it get forwarded? */ /* This was not a response frame why did it get forwarded? */
dev_err(scic_to_dev(this_request->owning_controller), dev_err(scic_to_dev(sci_req->owning_controller),
"%s: SCIC SMP Request 0x%p received unexpected frame " "%s: SCIC SMP Request 0x%p received unexpected frame "
"%d type 0x%02x\n", "%d type 0x%02x\n",
__func__, __func__,
this_request, sci_req,
frame_index, frame_index,
this_frame_header->smp_frame_type); rsp_hdr->smp_frame_type);
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_TASK_DONE_SMP_FRM_TYPE_ERR, SCU_TASK_DONE_SMP_FRM_TYPE_ERR,
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
} }
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->owning_controller, frame_index sci_req->owning_controller, frame_index
); );
return SCI_SUCCESS; return SCI_SUCCESS;
...@@ -411,7 +411,7 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler( ...@@ -411,7 +411,7 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler(
* This method processes an abnormal TC completion while the SMP request is * This method processes an abnormal TC completion while the SMP request is
* waiting for a response frame. It decides what happened to the IO based * waiting for a response frame. It decides what happened to the IO based
* on TC completion status. * on TC completion status.
* @this_request: This parameter specifies the request for which the TC * @sci_req: This parameter specifies the request for which the TC
* completion was received. * completion was received.
* @completion_code: This parameter indicates the completion status information * @completion_code: This parameter indicates the completion status information
* for the TC. * for the TC.
...@@ -420,7 +420,7 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler( ...@@ -420,7 +420,7 @@ static enum sci_status scic_sds_smp_request_await_response_frame_handler(
* this method always returns success. * this method always returns success.
*/ */
static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler( static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
...@@ -429,11 +429,11 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler ...@@ -429,11 +429,11 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler
* In the AWAIT RESPONSE state, any TC completion is unexpected. * In the AWAIT RESPONSE state, any TC completion is unexpected.
* but if the TC has success status, we complete the IO anyway. */ * but if the TC has success status, we complete the IO anyway. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
...@@ -447,11 +447,11 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler ...@@ -447,11 +447,11 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler
* break the connection and set TC completion with one of these SMP_XXX_XX_ERR * break the connection and set TC completion with one of these SMP_XXX_XX_ERR
* status. For these type of error, we ask scic user to retry the request. */ * status. For these type of error, we ask scic user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_SMP_RESP_TO_ERR, SCI_FAILURE_RETRY_REQUIRED sci_req, SCU_TASK_DONE_SMP_RESP_TO_ERR, SCI_FAILURE_RETRY_REQUIRED
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
...@@ -460,13 +460,13 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler ...@@ -460,13 +460,13 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
} }
...@@ -480,7 +480,7 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler ...@@ -480,7 +480,7 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler
* determine if the SMP request was sent successfully. If the SMP request * determine if the SMP request was sent successfully. If the SMP request
* was sent successfully, then the state for the SMP request transits to * was sent successfully, then the state for the SMP request transits to
* waiting for a response frame. * waiting for a response frame.
* @this_request: This parameter specifies the request for which the TC * @sci_req: This parameter specifies the request for which the TC
* completion was received. * completion was received.
* @completion_code: This parameter indicates the completion status information * @completion_code: This parameter indicates the completion status information
* for the TC. * for the TC.
...@@ -489,17 +489,17 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler ...@@ -489,17 +489,17 @@ static enum sci_status scic_sds_smp_request_await_response_tc_completion_handler
* this method always returns success. * this method always returns success.
*/ */
static enum sci_status scic_sds_smp_request_await_tc_completion_tc_completion_handler( static enum sci_status scic_sds_smp_request_await_tc_completion_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
...@@ -508,13 +508,13 @@ static enum sci_status scic_sds_smp_request_await_tc_completion_tc_completion_ha ...@@ -508,13 +508,13 @@ static enum sci_status scic_sds_smp_request_await_tc_completion_tc_completion_ha
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
} }
...@@ -547,10 +547,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_smp_request_start ...@@ -547,10 +547,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_smp_request_start
static void scic_sds_smp_request_started_await_response_substate_enter( static void scic_sds_smp_request_started_await_response_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_smp_request_started_substate_handler_table, scic_sds_smp_request_started_substate_handler_table,
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_RESPONSE
); );
...@@ -568,10 +568,10 @@ static void scic_sds_smp_request_started_await_response_substate_enter( ...@@ -568,10 +568,10 @@ static void scic_sds_smp_request_started_await_response_substate_enter(
static void scic_sds_smp_request_started_await_tc_completion_substate_enter( static void scic_sds_smp_request_started_await_tc_completion_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_smp_request_started_substate_handler_table, scic_sds_smp_request_started_substate_handler_table,
SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION SCIC_SDS_SMP_REQUEST_STARTED_SUBSTATE_AWAIT_TC_COMPLETION
); );
......
...@@ -62,8 +62,7 @@ ...@@ -62,8 +62,7 @@
u32 scic_sds_smp_request_get_object_size(void); u32 scic_sds_smp_request_get_object_size(void);
void scic_sds_smp_request_copy_response( void scic_sds_smp_request_copy_response(struct scic_sds_request *sci_req);
struct scic_sds_request *this_request);
#endif /* _SCIC_SDS_SMP_REQUEST_T_ */ #endif /* _SCIC_SDS_SMP_REQUEST_T_ */
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
* determine if the RAW task management frame was sent successfully. If the * determine if the RAW task management frame was sent successfully. If the
* raw frame was sent successfully, then the state for the task request * raw frame was sent successfully, then the state for the task request
* transitions to waiting for a response frame. * transitions to waiting for a response frame.
* @this_request: This parameter specifies the request for which the TC * @sci_req: This parameter specifies the request for which the TC
* completion was received. * completion was received.
* @completion_code: This parameter indicates the completion status information * @completion_code: This parameter indicates the completion status information
* for the TC. * for the TC.
...@@ -76,17 +76,17 @@ ...@@ -76,17 +76,17 @@
* this method always returns success. * this method always returns success.
*/ */
static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completion_handler( static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE
); );
break; break;
...@@ -97,15 +97,15 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi ...@@ -97,15 +97,15 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi
* timeout if the task IU wasn't received successfully. * timeout if the task IU wasn't received successfully.
* There is a potential for receiving multiple task responses if we * There is a potential for receiving multiple task responses if we
* decide to send the task IU again. */ * decide to send the task IU again. */
dev_warn(scic_to_dev(this_request->owning_controller), dev_warn(scic_to_dev(sci_req->owning_controller),
"%s: TaskRequest:0x%p CompletionCode:%x - " "%s: TaskRequest:0x%p CompletionCode:%x - "
"ACK/NAK timeout\n", "ACK/NAK timeout\n",
__func__, __func__,
this_request, sci_req,
completion_code); completion_code);
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE
); );
break; break;
...@@ -115,12 +115,12 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi ...@@ -115,12 +115,12 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state(&this_request->state_machine, sci_base_state_machine_change_state(&sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
} }
...@@ -132,7 +132,7 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi ...@@ -132,7 +132,7 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_completion_tc_completi
* This method is responsible for processing a terminate/abort request for this * This method is responsible for processing a terminate/abort request for this
* TC while the request is waiting for the task management response * TC while the request is waiting for the task management response
* unsolicited frame. * unsolicited frame.
* @this_request: This parameter specifies the request for which the * @sci_req: This parameter specifies the request for which the
* termination was requested. * termination was requested.
* *
* This method returns an indication as to whether the abort request was * This method returns an indication as to whether the abort request was
...@@ -155,7 +155,7 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_response_abort_handler ...@@ -155,7 +155,7 @@ static enum sci_status scic_sds_ssp_task_request_await_tc_response_abort_handler
* waiting for a response frame. It will copy the response data, release * waiting for a response frame. It will copy the response data, release
* the unsolicited frame, and transition the request to the * the unsolicited frame, and transition the request to the
* SCI_BASE_REQUEST_STATE_COMPLETED state. * SCI_BASE_REQUEST_STATE_COMPLETED state.
* @this_request: This parameter specifies the request for which the * @sci_req: This parameter specifies the request for which the
* unsolicited frame was received. * unsolicited frame was received.
* @frame_index: This parameter indicates the unsolicited frame index that * @frame_index: This parameter indicates the unsolicited frame index that
* should contain the response. * should contain the response.
...@@ -202,10 +202,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_ssp_task_request_ ...@@ -202,10 +202,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_ssp_task_request_
static void scic_sds_io_request_started_task_mgmt_await_tc_completion_substate_enter( static void scic_sds_io_request_started_task_mgmt_await_tc_completion_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_ssp_task_request_started_substate_handler_table, scic_sds_ssp_task_request_started_substate_handler_table,
SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_COMPLETION
); );
...@@ -223,10 +223,10 @@ static void scic_sds_io_request_started_task_mgmt_await_tc_completion_substate_e ...@@ -223,10 +223,10 @@ static void scic_sds_io_request_started_task_mgmt_await_tc_completion_substate_e
static void scic_sds_io_request_started_task_mgmt_await_task_response_substate_enter( static void scic_sds_io_request_started_task_mgmt_await_task_response_substate_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_ssp_task_request_started_substate_handler_table, scic_sds_ssp_task_request_started_substate_handler_table,
SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE SCIC_SDS_IO_REQUEST_STARTED_TASK_MGMT_SUBSTATE_AWAIT_TC_RESPONSE
); );
......
...@@ -75,16 +75,16 @@ ...@@ -75,16 +75,16 @@
/** /**
* This method will fill in the SCU Task Context for a PACKET fis. And * This method will fill in the SCU Task Context for a PACKET fis. And
* construct the request STARTED sub-state machine for Packet Protocol IO. * construct the request STARTED sub-state machine for Packet Protocol IO.
* @this_request: This parameter specifies the stp packet request object being * @sci_req: This parameter specifies the stp packet request object being
* constructed. * constructed.
* *
*/ */
enum sci_status scic_sds_stp_packet_request_construct( enum sci_status scic_sds_stp_packet_request_construct(
struct scic_sds_request *this_request) struct scic_sds_request *sci_req)
{ {
struct sata_fis_reg_h2d *h2d_fis = struct sata_fis_reg_h2d *h2d_fis =
scic_stp_io_request_get_h2d_reg_address( scic_stp_io_request_get_h2d_reg_address(
this_request sci_req
); );
/* /*
...@@ -92,17 +92,17 @@ enum sci_status scic_sds_stp_packet_request_construct( ...@@ -92,17 +92,17 @@ enum sci_status scic_sds_stp_packet_request_construct(
* need to make change to Packet Fis features field. */ * need to make change to Packet Fis features field. */
h2d_fis->features = h2d_fis->features | ATA_PACKET_FEATURE_DMA; h2d_fis->features = h2d_fis->features | ATA_PACKET_FEATURE_DMA;
scic_sds_stp_non_ncq_request_construct(this_request); scic_sds_stp_non_ncq_request_construct(sci_req);
/* Build the Packet Fis task context structure */ /* Build the Packet Fis task context structure */
scu_stp_raw_request_construct_task_context( scu_stp_raw_request_construct_task_context(
(struct scic_sds_stp_request *)this_request, (struct scic_sds_stp_request *)sci_req,
this_request->task_context_buffer sci_req->task_context_buffer
); );
sci_base_state_machine_construct( sci_base_state_machine_construct(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
&this_request->parent.parent, &sci_req->parent.parent,
scic_sds_stp_packet_request_started_substate_table, scic_sds_stp_packet_request_started_substate_table,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
); );
...@@ -119,24 +119,24 @@ enum sci_status scic_sds_stp_packet_request_construct( ...@@ -119,24 +119,24 @@ enum sci_status scic_sds_stp_packet_request_construct(
* utilized to perform task management. -# control_frame == 1. This ensures * utilized to perform task management. -# control_frame == 1. This ensures
* that the proper endianess is set so that the bytes are transmitted in the * that the proper endianess is set so that the bytes are transmitted in the
* right order for a smp request frame. * right order for a smp request frame.
* @this_request: This parameter specifies the smp request object being * @sci_req: This parameter specifies the smp request object being
* constructed. * constructed.
* @task_context: The task_context to be reconstruct for packet request command * @task_context: The task_context to be reconstruct for packet request command
* phase. * phase.
* *
*/ */
void scu_stp_packet_request_command_phase_construct_task_context( void scu_stp_packet_request_command_phase_construct_task_context(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
struct scu_task_context *task_context) struct scu_task_context *task_context)
{ {
void *atapi_cdb; void *atapi_cdb;
u32 atapi_cdb_length; u32 atapi_cdb_length;
struct scic_sds_stp_request *stp_request = (struct scic_sds_stp_request *)this_request; struct scic_sds_stp_request *stp_request = (struct scic_sds_stp_request *)sci_req;
/* /*
* reference: SSTL 1.13.4.2 * reference: SSTL 1.13.4.2
* task_type, sata_direction */ * task_type, sata_direction */
if (scic_cb_io_request_get_data_direction(this_request->user_request) if (scic_cb_io_request_get_data_direction(sci_req->user_request)
== SCI_IO_REQUEST_DATA_OUT) { == SCI_IO_REQUEST_DATA_OUT) {
task_context->task_type = SCU_TASK_TYPE_PACKET_DMA_OUT; task_context->task_type = SCU_TASK_TYPE_PACKET_DMA_OUT;
task_context->sata_direction = 0; task_context->sata_direction = 0;
...@@ -152,15 +152,15 @@ void scu_stp_packet_request_command_phase_construct_task_context( ...@@ -152,15 +152,15 @@ void scu_stp_packet_request_command_phase_construct_task_context(
/* /*
* Copy in the command IU with CDB so that the commandIU address doesn't * Copy in the command IU with CDB so that the commandIU address doesn't
* change. */ * change. */
memset(this_request->command_buffer, 0, sizeof(struct sata_fis_reg_h2d)); memset(sci_req->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
atapi_cdb = atapi_cdb =
scic_cb_stp_packet_io_request_get_cdb_address(this_request->user_request); scic_cb_stp_packet_io_request_get_cdb_address(sci_req->user_request);
atapi_cdb_length = atapi_cdb_length =
scic_cb_stp_packet_io_request_get_cdb_length(this_request->user_request); scic_cb_stp_packet_io_request_get_cdb_length(sci_req->user_request);
memcpy(((u8 *)this_request->command_buffer + sizeof(u32)), atapi_cdb, atapi_cdb_length); memcpy(((u8 *)sci_req->command_buffer + sizeof(u32)), atapi_cdb, atapi_cdb_length);
atapi_cdb_length = atapi_cdb_length =
max(atapi_cdb_length, stp_request->type.packet.device_preferred_cdb_length); max(atapi_cdb_length, stp_request->type.packet.device_preferred_cdb_length);
...@@ -175,18 +175,18 @@ void scu_stp_packet_request_command_phase_construct_task_context( ...@@ -175,18 +175,18 @@ void scu_stp_packet_request_command_phase_construct_task_context(
/* retry counter */ /* retry counter */
task_context->stp_retry_count = 0; task_context->stp_retry_count = 0;
if (scic_cb_request_is_initial_construction(this_request->user_request)) { if (scic_cb_request_is_initial_construction(sci_req->user_request)) {
/* data transfer size. */ /* data transfer size. */
task_context->transfer_length_bytes = task_context->transfer_length_bytes =
scic_cb_io_request_get_transfer_length(this_request->user_request); scic_cb_io_request_get_transfer_length(sci_req->user_request);
/* setup sgl */ /* setup sgl */
scic_sds_request_build_sgl(this_request); scic_sds_request_build_sgl(sci_req);
} else { } else {
/* data transfer size, need to be 4 bytes aligned. */ /* data transfer size, need to be 4 bytes aligned. */
task_context->transfer_length_bytes = (SCSI_FIXED_SENSE_DATA_BASE_LENGTH + 2); task_context->transfer_length_bytes = (SCSI_FIXED_SENSE_DATA_BASE_LENGTH + 2);
scic_sds_stp_packet_internal_request_sense_build_sgl(this_request); scic_sds_stp_packet_internal_request_sense_build_sgl(sci_req);
} }
} }
...@@ -194,24 +194,24 @@ void scu_stp_packet_request_command_phase_construct_task_context( ...@@ -194,24 +194,24 @@ void scu_stp_packet_request_command_phase_construct_task_context(
* This method will fill in the SCU Task Context for a DATA fis containing CDB * This method will fill in the SCU Task Context for a DATA fis containing CDB
* in Raw Frame type. The TC for previous Packet fis was already there, we * in Raw Frame type. The TC for previous Packet fis was already there, we
* only need to change the H2D fis content. * only need to change the H2D fis content.
* @this_request: This parameter specifies the smp request object being * @sci_req: This parameter specifies the smp request object being
* constructed. * constructed.
* @task_context: The task_context to be reconstruct for packet request command * @task_context: The task_context to be reconstruct for packet request command
* phase. * phase.
* *
*/ */
void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context( void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
struct scu_task_context *task_context) struct scu_task_context *task_context)
{ {
void *atapi_cdb = void *atapi_cdb =
scic_cb_stp_packet_io_request_get_cdb_address(this_request->user_request); scic_cb_stp_packet_io_request_get_cdb_address(sci_req->user_request);
u32 atapi_cdb_length = u32 atapi_cdb_length =
scic_cb_stp_packet_io_request_get_cdb_length(this_request->user_request); scic_cb_stp_packet_io_request_get_cdb_length(sci_req->user_request);
memset(this_request->command_buffer, 0, sizeof(struct sata_fis_reg_h2d)); memset(sci_req->command_buffer, 0, sizeof(struct sata_fis_reg_h2d));
memcpy(((u8 *)this_request->command_buffer + sizeof(u32)), atapi_cdb, atapi_cdb_length); memcpy(((u8 *)sci_req->command_buffer + sizeof(u32)), atapi_cdb, atapi_cdb_length);
memset(&(task_context->type.stp), 0, sizeof(struct stp_task_context)); memset(&(task_context->type.stp), 0, sizeof(struct stp_task_context));
task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA; task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA;
...@@ -227,12 +227,12 @@ void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context( ...@@ -227,12 +227,12 @@ void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
* *@brief This methods decode the D2H status FIS and retrieve the sense data, * *@brief This methods decode the D2H status FIS and retrieve the sense data,
* then pass the sense data to user request. * then pass the sense data to user request.
* *
***@param[in] this_request The request receive D2H status FIS. ***@param[in] sci_req The request receive D2H status FIS.
***@param[in] status_fis The D2H status fis to be processed. ***@param[in] status_fis The D2H status fis to be processed.
* *
*/ */
enum sci_status scic_sds_stp_packet_request_process_status_fis( enum sci_status scic_sds_stp_packet_request_process_status_fis(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
struct sata_fis_reg_d2h *status_fis) struct sata_fis_reg_d2h *status_fis)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
...@@ -249,7 +249,7 @@ enum sci_status scic_sds_stp_packet_request_process_status_fis( ...@@ -249,7 +249,7 @@ enum sci_status scic_sds_stp_packet_request_process_status_fis(
* command using this request response buffer, only one sge is * command using this request response buffer, only one sge is
* needed. * needed.
* *
***@param[in] this_request The request receive request sense data. ***@param[in] sci_req The request receive request sense data.
* *
*/ */
void scic_sds_stp_packet_internal_request_sense_build_sgl( void scic_sds_stp_packet_internal_request_sense_build_sgl(
...@@ -284,7 +284,7 @@ void scic_sds_stp_packet_internal_request_sense_build_sgl( ...@@ -284,7 +284,7 @@ void scic_sds_stp_packet_internal_request_sense_build_sgl(
* determine if the Packet FIS was sent successfully. If the Packet FIS was * determine if the Packet FIS was sent successfully. If the Packet FIS was
* sent successfully, then the state for the Packet request transits to * sent successfully, then the state for the Packet request transits to
* waiting for a PIO SETUP frame. * waiting for a PIO SETUP frame.
* @this_request: This parameter specifies the request for which the TC * @sci_req: This parameter specifies the request for which the TC
* completion was received. * completion was received.
* @completion_code: This parameter indicates the completion status information * @completion_code: This parameter indicates the completion status information
* for the TC. * for the TC.
...@@ -293,7 +293,7 @@ void scic_sds_stp_packet_internal_request_sense_build_sgl( ...@@ -293,7 +293,7 @@ void scic_sds_stp_packet_internal_request_sense_build_sgl(
* this method always returns success. * this method always returns success.
*/ */
enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_completion_handler( enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
...@@ -301,11 +301,11 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_ ...@@ -301,11 +301,11 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE
); );
break; break;
...@@ -315,13 +315,13 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_ ...@@ -315,13 +315,13 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
break; break;
...@@ -336,7 +336,7 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_ ...@@ -336,7 +336,7 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_tc_completion_tc_
* waiting for a PIO SETUP FIS. It will release the unsolicited frame, and * waiting for a PIO SETUP FIS. It will release the unsolicited frame, and
* transition the request to the COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE * transition the request to the COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
* state. * state.
* @this_request: This parameter specifies the request for which the * @sci_req: This parameter specifies the request for which the
* unsolicited frame was received. * unsolicited frame was received.
* @frame_index: This parameter indicates the unsolicited frame index that * @frame_index: This parameter indicates the unsolicited frame index that
* should contain the response. * should contain the response.
...@@ -352,12 +352,12 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h ...@@ -352,12 +352,12 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h
enum sci_status status; enum sci_status status;
struct sata_fis_header *frame_header; struct sata_fis_header *frame_header;
u32 *frame_buffer; u32 *frame_buffer;
struct scic_sds_stp_request *this_request; struct scic_sds_stp_request *sci_req;
this_request = (struct scic_sds_stp_request *)request; sci_req = (struct scic_sds_stp_request *)request;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -369,7 +369,7 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h ...@@ -369,7 +369,7 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h
* Get from the frame buffer the PIO Setup Data, although we don't need * Get from the frame buffer the PIO Setup Data, although we don't need
* any info from this pio setup fis. */ * any info from this pio setup fis. */
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
...@@ -378,23 +378,23 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h ...@@ -378,23 +378,23 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h
* Get the data from the PIO Setup * Get the data from the PIO Setup
* The SCU Hardware returns first word in the frame_header and the rest * The SCU Hardware returns first word in the frame_header and the rest
* of the data is in the frame buffer so we need to back up one dword */ * of the data is in the frame buffer so we need to back up one dword */
this_request->type.packet.device_preferred_cdb_length = sci_req->type.packet.device_preferred_cdb_length =
(u16)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->transfter_count; (u16)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->transfter_count;
/* Frame has been decoded return it to the controller */ /* Frame has been decoded return it to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->parent.owning_controller, frame_index sci_req->parent.owning_controller, frame_index
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.started_substate_machine, &sci_req->parent.started_substate_machine,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
); );
} else } else
dev_err(scic_to_dev(request->owning_controller), dev_err(scic_to_dev(request->owning_controller),
"%s: SCIC IO Request 0x%p could not get frame header " "%s: SCIC IO Request 0x%p could not get frame header "
"for frame index %d, status %x\n", "for frame index %d, status %x\n",
__func__, this_request, frame_index, status); __func__, sci_req, frame_index, status);
return status; return status;
} }
...@@ -406,7 +406,7 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h ...@@ -406,7 +406,7 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h
* successfully, then the state for the packet request transits to COMPLETE * successfully, then the state for the packet request transits to COMPLETE
* state. If not successfuly, the request transits to * state. If not successfuly, the request transits to
* COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE. * COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE.
* @this_request: This parameter specifies the request for which the TC * @sci_req: This parameter specifies the request for which the TC
* completion was received. * completion was received.
* @completion_code: This parameter indicates the completion status information * @completion_code: This parameter indicates the completion status information
* for the TC. * for the TC.
...@@ -415,64 +415,64 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h ...@@ -415,64 +415,64 @@ enum sci_status scic_sds_stp_packet_request_packet_phase_await_pio_setup_frame_h
* this method always returns success. * this method always returns success.
*/ */
enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_tc_completion_handler( enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
u8 sat_packet_protocol = u8 sat_packet_protocol =
scic_cb_request_get_sat_protocol(this_request->user_request); scic_cb_request_get_sat_protocol(sci_req->user_request);
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT): case (SCU_TASK_DONE_GOOD << SCU_COMPLETION_TL_STATUS_SHIFT):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
if (sat_packet_protocol == SAT_PROTOCOL_PACKET_DMA_DATA_IN if (sat_packet_protocol == SAT_PROTOCOL_PACKET_DMA_DATA_IN
|| sat_packet_protocol == SAT_PROTOCOL_PACKET_DMA_DATA_OUT || sat_packet_protocol == SAT_PROTOCOL_PACKET_DMA_DATA_OUT
) )
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
else else
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE
); );
break; break;
case (SCU_TASK_DONE_UNEXP_FIS << SCU_COMPLETION_TL_STATUS_SHIFT): case (SCU_TASK_DONE_UNEXP_FIS << SCU_COMPLETION_TL_STATUS_SHIFT):
if (scic_io_request_get_number_of_bytes_transferred(this_request) < if (scic_io_request_get_number_of_bytes_transferred(sci_req) <
scic_cb_io_request_get_transfer_length(this_request->user_request)) { scic_cb_io_request_get_transfer_length(sci_req->user_request)) {
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS_IO_DONE_EARLY sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS_IO_DONE_EARLY
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
status = this_request->sci_status; status = sci_req->sci_status;
} }
break; break;
case (SCU_TASK_DONE_EXCESS_DATA << SCU_COMPLETION_TL_STATUS_SHIFT): case (SCU_TASK_DONE_EXCESS_DATA << SCU_COMPLETION_TL_STATUS_SHIFT):
/* In this case, there is no UF coming after. compelte the IO now. */ /* In this case, there is no UF coming after. compelte the IO now. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
break; break;
default: default:
if (this_request->sci_status != SCI_SUCCESS) { /* The io status was set already. This means an UF for the status if (sci_req->sci_status != SCI_SUCCESS) { /* The io status was set already. This means an UF for the status
* fis was received already. * fis was received already.
*/ */
...@@ -480,28 +480,28 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_tc ...@@ -480,28 +480,28 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_tc
* A device suspension event is expected, we need to have the device * A device suspension event is expected, we need to have the device
* coming out of suspension, then complete the IO. */ * coming out of suspension, then complete the IO. */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE
); );
/* change the device state to ATAPI_ERROR. */ /* change the device state to ATAPI_ERROR. */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->target_device->ready_substate_machine, &sci_req->target_device->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR
); );
status = this_request->sci_status; status = sci_req->sci_status;
} else { /* If receiving any non-sucess TC status, no UF received yet, then an UF for } else { /* If receiving any non-sucess TC status, no UF received yet, then an UF for
* the status fis is coming after. * the status fis is coming after.
*/ */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE
); );
} }
...@@ -514,7 +514,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_tc ...@@ -514,7 +514,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_tc
/** /**
* This method processes an unsolicited frame. * This method processes an unsolicited frame.
* @this_request: This parameter specifies the request for which the * @sci_req: This parameter specifies the request for which the
* unsolicited frame was received. * unsolicited frame was received.
* @frame_index: This parameter indicates the unsolicited frame index that * @frame_index: This parameter indicates the unsolicited frame index that
* should contain the response. * should contain the response.
...@@ -530,12 +530,12 @@ enum sci_status scic_sds_stp_packet_request_command_phase_common_frame_handler( ...@@ -530,12 +530,12 @@ enum sci_status scic_sds_stp_packet_request_command_phase_common_frame_handler(
enum sci_status status; enum sci_status status;
struct sata_fis_header *frame_header; struct sata_fis_header *frame_header;
u32 *frame_buffer; u32 *frame_buffer;
struct scic_sds_stp_request *this_request; struct scic_sds_stp_request *sci_req;
this_request = (struct scic_sds_stp_request *)request; sci_req = (struct scic_sds_stp_request *)request;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -547,18 +547,18 @@ enum sci_status scic_sds_stp_packet_request_command_phase_common_frame_handler( ...@@ -547,18 +547,18 @@ enum sci_status scic_sds_stp_packet_request_command_phase_common_frame_handler(
* Get from the frame buffer the PIO Setup Data, although we don't need * Get from the frame buffer the PIO Setup Data, although we don't need
* any info from this pio setup fis. */ * any info from this pio setup fis. */
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
scic_sds_controller_copy_sata_response( scic_sds_controller_copy_sata_response(
&this_request->d2h_reg_fis, (u32 *)frame_header, frame_buffer &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer
); );
/* Frame has been decoded return it to the controller */ /* Frame has been decoded return it to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->parent.owning_controller, frame_index sci_req->parent.owning_controller, frame_index
); );
} }
...@@ -568,7 +568,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_common_frame_handler( ...@@ -568,7 +568,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_common_frame_handler(
/** /**
* This method processes an unsolicited frame while the packet request is * This method processes an unsolicited frame while the packet request is
* expecting TC completion. It will process the FIS and construct sense data. * expecting TC completion. It will process the FIS and construct sense data.
* @this_request: This parameter specifies the request for which the * @sci_req: This parameter specifies the request for which the
* unsolicited frame was received. * unsolicited frame was received.
* @frame_index: This parameter indicates the unsolicited frame index that * @frame_index: This parameter indicates the unsolicited frame index that
* should contain the response. * should contain the response.
...@@ -581,7 +581,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_fr ...@@ -581,7 +581,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_fr
struct scic_sds_request *request, struct scic_sds_request *request,
u32 frame_index) u32 frame_index)
{ {
struct scic_sds_stp_request *this_request = (struct scic_sds_stp_request *)request; struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request;
enum sci_status status = enum sci_status status =
scic_sds_stp_packet_request_command_phase_common_frame_handler( scic_sds_stp_packet_request_command_phase_common_frame_handler(
...@@ -590,17 +590,17 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_fr ...@@ -590,17 +590,17 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_fr
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
/* The command has completed with error status from target device. */ /* The command has completed with error status from target device. */
status = scic_sds_stp_packet_request_process_status_fis( status = scic_sds_stp_packet_request_process_status_fis(
request, &this_request->d2h_reg_fis); request, &sci_req->d2h_reg_fis);
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
status status
); );
} else } else
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, SCU_TASK_DONE_GOOD, SCI_SUCCESS &sci_req->parent, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
} }
...@@ -611,7 +611,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_fr ...@@ -611,7 +611,7 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_tc_completion_fr
/** /**
* This method processes an unsolicited frame while the packet request is * This method processes an unsolicited frame while the packet request is
* expecting TC completion. It will process the FIS and construct sense data. * expecting TC completion. It will process the FIS and construct sense data.
* @this_request: This parameter specifies the request for which the * @sci_req: This parameter specifies the request for which the
* unsolicited frame was received. * unsolicited frame was received.
* @frame_index: This parameter indicates the unsolicited frame index that * @frame_index: This parameter indicates the unsolicited frame index that
* should contain the response. * should contain the response.
...@@ -628,12 +628,12 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_d2h_fis_frame_ha ...@@ -628,12 +628,12 @@ enum sci_status scic_sds_stp_packet_request_command_phase_await_d2h_fis_frame_ha
scic_sds_stp_packet_request_command_phase_common_frame_handler( scic_sds_stp_packet_request_command_phase_common_frame_handler(
request, frame_index); request, frame_index);
struct scic_sds_stp_request *this_request = (struct scic_sds_stp_request *)request; struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request;
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
/* The command has completed with error status from target device. */ /* The command has completed with error status from target device. */
status = scic_sds_stp_packet_request_process_status_fis( status = scic_sds_stp_packet_request_process_status_fis(
request, &this_request->d2h_reg_fis); request, &sci_req->d2h_reg_fis);
if (status != SCI_SUCCESS) { if (status != SCI_SUCCESS) {
scic_sds_request_set_status( scic_sds_request_set_status(
...@@ -696,26 +696,26 @@ const struct scic_sds_io_request_state_handler scic_sds_stp_packet_request_start ...@@ -696,26 +696,26 @@ const struct scic_sds_io_request_state_handler scic_sds_stp_packet_request_start
void scic_sds_stp_packet_request_started_packet_phase_await_tc_completion_enter( void scic_sds_stp_packet_request_started_packet_phase_await_tc_completion_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_packet_request_started_substate_handler_table, scic_sds_stp_packet_request_started_substate_handler_table,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
); );
scic_sds_remote_device_set_working_request( scic_sds_remote_device_set_working_request(
this_request->target_device, this_request sci_req->target_device, sci_req
); );
} }
void scic_sds_stp_packet_request_started_packet_phase_await_pio_setup_enter( void scic_sds_stp_packet_request_started_packet_phase_await_pio_setup_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_packet_request_started_substate_handler_table, scic_sds_stp_packet_request_started_substate_handler_table,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_PACKET_PHASE_AWAIT_PIO_SETUP_SUBSTATE
); );
...@@ -724,9 +724,9 @@ void scic_sds_stp_packet_request_started_packet_phase_await_pio_setup_enter( ...@@ -724,9 +724,9 @@ void scic_sds_stp_packet_request_started_packet_phase_await_pio_setup_enter(
void scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter( void scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
u8 sat_packet_protocol = u8 sat_packet_protocol =
scic_cb_request_get_sat_protocol(this_request->user_request); scic_cb_request_get_sat_protocol(sci_req->user_request);
struct scu_task_context *task_context; struct scu_task_context *task_context;
enum sci_status status; enum sci_status status;
...@@ -735,25 +735,25 @@ void scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter ...@@ -735,25 +735,25 @@ void scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter
* Recycle the TC and reconstruct it for sending out data fis containing * Recycle the TC and reconstruct it for sending out data fis containing
* CDB. */ * CDB. */
task_context = scic_sds_controller_get_task_context_buffer( task_context = scic_sds_controller_get_task_context_buffer(
this_request->owning_controller, this_request->io_tag); sci_req->owning_controller, sci_req->io_tag);
if (sat_packet_protocol == SAT_PROTOCOL_PACKET_NON_DATA) if (sat_packet_protocol == SAT_PROTOCOL_PACKET_NON_DATA)
scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context( scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
this_request, task_context); sci_req, task_context);
else else
scu_stp_packet_request_command_phase_construct_task_context( scu_stp_packet_request_command_phase_construct_task_context(
this_request, task_context); sci_req, task_context);
/* send the new TC out. */ /* send the new TC out. */
status = this_request->owning_controller->state_handlers->parent.continue_io_handler( status = sci_req->owning_controller->state_handlers->parent.continue_io_handler(
&this_request->owning_controller->parent, &sci_req->owning_controller->parent,
&this_request->target_device->parent, &sci_req->target_device->parent,
&this_request->parent &sci_req->parent
); );
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_packet_request_started_substate_handler_table, scic_sds_stp_packet_request_started_substate_handler_table,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_TC_COMPLETION_SUBSTATE
); );
...@@ -762,10 +762,10 @@ void scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter ...@@ -762,10 +762,10 @@ void scic_sds_stp_packet_request_started_command_phase_await_tc_completion_enter
void scic_sds_stp_packet_request_started_command_phase_await_d2h_fis_enter( void scic_sds_stp_packet_request_started_command_phase_await_d2h_fis_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_packet_request_started_substate_handler_table, scic_sds_stp_packet_request_started_substate_handler_table,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMMAND_PHASE_AWAIT_D2H_FIS_SUBSTATE
); );
...@@ -774,10 +774,10 @@ void scic_sds_stp_packet_request_started_command_phase_await_d2h_fis_enter( ...@@ -774,10 +774,10 @@ void scic_sds_stp_packet_request_started_command_phase_await_d2h_fis_enter(
void scic_sds_stp_packet_request_started_completion_delay_enter( void scic_sds_stp_packet_request_started_completion_delay_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_packet_request_started_substate_handler_table, scic_sds_stp_packet_request_started_substate_handler_table,
SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE SCIC_SDS_STP_PACKET_REQUEST_STARTED_COMPLETION_DELAY_SUBSTATE
); );
......
...@@ -113,14 +113,14 @@ extern const struct scic_sds_io_request_state_handler scic_sds_stp_packet_reques ...@@ -113,14 +113,14 @@ extern const struct scic_sds_io_request_state_handler scic_sds_stp_packet_reques
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
enum sci_status scic_sds_stp_packet_request_construct( enum sci_status scic_sds_stp_packet_request_construct(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
#else /* !defined(DISABLE_ATAPI) */ #else /* !defined(DISABLE_ATAPI) */
#define scic_sds_stp_packet_request_construct(request) SCI_FAILURE #define scic_sds_stp_packet_request_construct(request) SCI_FAILURE
#endif /* !defined(DISABLE_ATAPI) */ #endif /* !defined(DISABLE_ATAPI) */
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
void scu_stp_packet_request_command_phase_construct_task_context( void scu_stp_packet_request_command_phase_construct_task_context(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
struct scu_task_context *task_context); struct scu_task_context *task_context);
#else /* !defined(DISABLE_ATAPI) */ #else /* !defined(DISABLE_ATAPI) */
#define scu_stp_packet_request_command_phase_construct_task_context(reqeust, tc) #define scu_stp_packet_request_command_phase_construct_task_context(reqeust, tc)
...@@ -128,7 +128,7 @@ void scu_stp_packet_request_command_phase_construct_task_context( ...@@ -128,7 +128,7 @@ void scu_stp_packet_request_command_phase_construct_task_context(
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context( void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
struct scu_task_context *task_context); struct scu_task_context *task_context);
#else /* !defined(DISABLE_ATAPI) */ #else /* !defined(DISABLE_ATAPI) */
#define scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(reqeust, tc) #define scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(reqeust, tc)
...@@ -136,7 +136,7 @@ void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context( ...@@ -136,7 +136,7 @@ void scu_stp_packet_request_command_phase_reconstruct_raw_frame_task_context(
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
enum sci_status scic_sds_stp_packet_request_process_status_fis( enum sci_status scic_sds_stp_packet_request_process_status_fis(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
struct sata_fis_reg_d2h *status_fis); struct sata_fis_reg_d2h *status_fis);
#else /* !defined(DISABLE_ATAPI) */ #else /* !defined(DISABLE_ATAPI) */
#define scic_sds_stp_packet_request_process_status_fis(reqeust, fis) SCI_FAILURE #define scic_sds_stp_packet_request_process_status_fis(reqeust, fis) SCI_FAILURE
...@@ -144,7 +144,7 @@ enum sci_status scic_sds_stp_packet_request_process_status_fis( ...@@ -144,7 +144,7 @@ enum sci_status scic_sds_stp_packet_request_process_status_fis(
#if !defined(DISABLE_ATAPI) #if !defined(DISABLE_ATAPI)
void scic_sds_stp_packet_internal_request_sense_build_sgl( void scic_sds_stp_packet_internal_request_sense_build_sgl(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
#else /* !defined(DISABLE_ATAPI) */ #else /* !defined(DISABLE_ATAPI) */
#define scic_sds_stp_packet_internal_request_sense_build_sgl(request) #define scic_sds_stp_packet_internal_request_sense_build_sgl(request)
#endif /* !defined(DISABLE_ATAPI) */ #endif /* !defined(DISABLE_ATAPI) */
......
...@@ -252,18 +252,18 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_h ...@@ -252,18 +252,18 @@ static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_start_io_h
* resume the RNC right away. enum sci_status * resume the RNC right away. enum sci_status
*/ */
static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_event_handler( static enum sci_status scic_sds_stp_remote_device_ready_idle_substate_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code) u32 event_code)
{ {
enum sci_status status; enum sci_status status;
status = scic_sds_remote_device_general_event_handler(this_device, event_code); status = scic_sds_remote_device_general_event_handler(sci_dev, event_code);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX
|| scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) { || scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) {
status = scic_sds_remote_node_context_resume( status = scic_sds_remote_node_context_resume(
this_device->rnc, NULL, NULL); sci_dev->rnc, NULL, NULL);
} }
} }
...@@ -312,21 +312,21 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_ha ...@@ -312,21 +312,21 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_start_io_ha
/** /**
* This method will handle events received while the STP device is in the ready * This method will handle events received while the STP device is in the ready
* command substate. * command substate.
* @this_device: This is the device object that is receiving the event. * @sci_dev: This is the device object that is receiving the event.
* @event_code: The event code to process. * @event_code: The event code to process.
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handler( static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index) u32 frame_index)
{ {
enum sci_status status; enum sci_status status;
struct sata_fis_header *frame_header; struct sata_fis_header *frame_header;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(scic_sds_remote_device_get_controller(this_device)->uf_control), &(scic_sds_remote_device_get_controller(sci_dev)->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -334,7 +334,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl ...@@ -334,7 +334,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
if (frame_header->fis_type == SATA_FIS_TYPE_SETDEVBITS && if (frame_header->fis_type == SATA_FIS_TYPE_SETDEVBITS &&
(frame_header->status & ATA_STATUS_REG_ERROR_BIT)) { (frame_header->status & ATA_STATUS_REG_ERROR_BIT)) {
this_device->not_ready_reason = sci_dev->not_ready_reason =
SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED;
/* /*
...@@ -343,7 +343,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl ...@@ -343,7 +343,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl
*/ */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &sci_dev->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR
); );
} else if (frame_header->fis_type == SATA_FIS_TYPE_REGD2H && } else if (frame_header->fis_type == SATA_FIS_TYPE_REGD2H &&
...@@ -353,11 +353,11 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl ...@@ -353,11 +353,11 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl
* Some devices return D2H FIS when an NCQ error is detected. * Some devices return D2H FIS when an NCQ error is detected.
* Treat this like an SDB error FIS ready reason. * Treat this like an SDB error FIS ready reason.
*/ */
this_device->not_ready_reason = sci_dev->not_ready_reason =
SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED; SCIC_REMOTE_DEVICE_NOT_READY_SATA_SDB_ERROR_FIS_RECEIVED;
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_device->ready_substate_machine, &sci_dev->ready_substate_machine,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_NCQ_ERROR
); );
} else { } else {
...@@ -365,7 +365,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl ...@@ -365,7 +365,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_ncq_substate_frame_handl
} }
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
scic_sds_remote_device_get_controller(this_device), frame_index scic_sds_remote_device_get_controller(sci_dev), frame_index
); );
} }
...@@ -393,20 +393,20 @@ static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_start_io_ha ...@@ -393,20 +393,20 @@ static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_start_io_ha
} }
static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler( static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_suspend_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 suspend_type) u32 suspend_type)
{ {
enum sci_status status; enum sci_status status;
status = scic_sds_remote_node_context_suspend( status = scic_sds_remote_node_context_suspend(
this_device->rnc, suspend_type, NULL, NULL sci_dev->rnc, suspend_type, NULL, NULL
); );
return status; return status;
} }
static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handler( static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 frame_index) u32 frame_index)
{ {
enum sci_status status; enum sci_status status;
...@@ -416,7 +416,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handl ...@@ -416,7 +416,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_cmd_substate_frame_handl
* / in this state. All unsolicited frames are forwarded to the io request * / in this state. All unsolicited frames are forwarded to the io request
* / object. */ * / object. */
status = scic_sds_io_request_frame_handler( status = scic_sds_io_request_frame_handler(
this_device->working_request, sci_dev->working_request,
frame_index frame_index
); );
...@@ -461,14 +461,14 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com ...@@ -461,14 +461,14 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com
struct scic_sds_remote_device *device, struct scic_sds_remote_device *device,
struct scic_sds_request *request) struct scic_sds_request *request)
{ {
struct scic_sds_request *the_request = (struct scic_sds_request *)request; struct scic_sds_request *sci_req = (struct scic_sds_request *)request;
enum sci_status status; enum sci_status status;
status = scic_sds_io_request_complete(the_request); status = scic_sds_io_request_complete(sci_req);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
status = scic_sds_port_complete_io( status = scic_sds_port_complete_io(
device->owning_port, device, the_request device->owning_port, device, sci_req
); );
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
...@@ -482,7 +482,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com ...@@ -482,7 +482,7 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com
__func__, __func__,
device->owning_port, device->owning_port,
device, device,
the_request, sci_req,
status); status);
return status; return status;
...@@ -505,20 +505,20 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com ...@@ -505,20 +505,20 @@ static enum sci_status scic_sds_stp_remote_device_ready_await_reset_substate_com
* this device. enum sci_status * this device. enum sci_status
*/ */
enum sci_status scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler( enum sci_status scic_sds_stp_remote_device_ready_atapi_error_substate_event_handler(
struct scic_sds_remote_device *this_device, struct scic_sds_remote_device *sci_dev,
u32 event_code) u32 event_code)
{ {
enum sci_status status; enum sci_status status;
status = scic_sds_remote_device_general_event_handler(this_device, event_code); status = scic_sds_remote_device_general_event_handler(sci_dev, event_code);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX
|| scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) { || scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) {
status = scic_sds_remote_node_context_resume( status = scic_sds_remote_node_context_resume(
this_device->rnc, sci_dev->rnc,
this_device->working_request->state_handlers->parent.complete_handler, sci_dev->working_request->state_handlers->parent.complete_handler,
(void *)this_device->working_request (void *)sci_dev->working_request
); );
} }
} }
...@@ -673,30 +673,30 @@ scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *use ...@@ -673,30 +673,30 @@ scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(void *use
static void scic_sds_stp_remote_device_ready_idle_substate_enter( static void scic_sds_stp_remote_device_ready_idle_substate_enter(
struct sci_base_object *device) struct sci_base_object *device)
{ {
struct scic_sds_remote_device *this_device; struct scic_sds_remote_device *sci_dev;
this_device = (struct scic_sds_remote_device *)device; sci_dev = (struct scic_sds_remote_device *)device;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_device, sci_dev,
scic_sds_stp_remote_device_ready_substate_handler_table, scic_sds_stp_remote_device_ready_substate_handler_table,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_IDLE
); );
this_device->working_request = NULL; sci_dev->working_request = NULL;
if (scic_sds_remote_node_context_is_ready(this_device->rnc)) { if (scic_sds_remote_node_context_is_ready(sci_dev->rnc)) {
/* /*
* Since the RNC is ready, it's alright to finish completion * Since the RNC is ready, it's alright to finish completion
* processing (e.g. signal the remote device is ready). */ * processing (e.g. signal the remote device is ready). */
scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler( scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler(
this_device sci_dev
); );
} else { } else {
scic_sds_remote_node_context_resume( scic_sds_remote_node_context_resume(
this_device->rnc, sci_dev->rnc,
scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler, scic_sds_stp_remote_device_ready_idle_substate_resume_complete_handler,
this_device sci_dev
); );
} }
} }
...@@ -759,12 +759,12 @@ static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci ...@@ -759,12 +759,12 @@ static void scic_sds_stp_remote_device_ready_ncq_error_substate_enter(struct sci
static void scic_sds_stp_remote_device_ready_await_reset_substate_enter( static void scic_sds_stp_remote_device_ready_await_reset_substate_enter(
struct sci_base_object *device) struct sci_base_object *device)
{ {
struct scic_sds_remote_device *this_device; struct scic_sds_remote_device *sci_dev;
this_device = (struct scic_sds_remote_device *)device; sci_dev = (struct scic_sds_remote_device *)device;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_device, sci_dev,
scic_sds_stp_remote_device_ready_substate_handler_table, scic_sds_stp_remote_device_ready_substate_handler_table,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_AWAIT_RESET
); );
...@@ -785,12 +785,12 @@ static void scic_sds_stp_remote_device_ready_await_reset_substate_enter( ...@@ -785,12 +785,12 @@ static void scic_sds_stp_remote_device_ready_await_reset_substate_enter(
void scic_sds_stp_remote_device_ready_atapi_error_substate_enter( void scic_sds_stp_remote_device_ready_atapi_error_substate_enter(
struct sci_base_object *device) struct sci_base_object *device)
{ {
struct scic_sds_remote_device *this_device; struct scic_sds_remote_device *sci_dev;
this_device = (struct scic_sds_remote_device *)device; sci_dev = (struct scic_sds_remote_device *)device;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_device, sci_dev,
scic_sds_stp_remote_device_ready_substate_handler_table, scic_sds_stp_remote_device_ready_substate_handler_table,
SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR SCIC_SDS_STP_REMOTE_DEVICE_READY_SUBSTATE_ATAPI_ERROR
); );
......
...@@ -156,7 +156,7 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req) ...@@ -156,7 +156,7 @@ void scic_sds_stp_request_assign_buffers(struct scic_sds_request *sci_req)
/** /**
* This method is will fill in the SCU Task Context for any type of SATA * This method is will fill in the SCU Task Context for any type of SATA
* request. This is called from the various SATA constructors. * request. This is called from the various SATA constructors.
* @this_request: The general IO request object which is to be used in * @sci_req: The general IO request object which is to be used in
* constructing the SCU task context. * constructing the SCU task context.
* @task_context: The buffer pointer for the SCU task context which is being * @task_context: The buffer pointer for the SCU task context which is being
* constructed. * constructed.
...@@ -262,15 +262,15 @@ static void scu_sata_reqeust_construct_task_context( ...@@ -262,15 +262,15 @@ static void scu_sata_reqeust_construct_task_context(
/** /**
* *
* @this_request: * @sci_req:
* *
* This method will perform any general sata request construction. What part of * This method will perform any general sata request construction. What part of
* SATA IO request construction is general? none * SATA IO request construction is general? none
*/ */
static void scic_sds_stp_non_ncq_request_construct( static void scic_sds_stp_non_ncq_request_construct(
struct scic_sds_request *this_request) struct scic_sds_request *sci_req)
{ {
this_request->has_started_substate_machine = true; sci_req->has_started_substate_machine = true;
} }
/** /**
...@@ -338,7 +338,7 @@ enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_ ...@@ -338,7 +338,7 @@ enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_
/** /**
* scu_stp_raw_request_construct_task_context - * scu_stp_raw_request_construct_task_context -
* @this_request: This parameter specifies the STP request object for which to * @sci_req: This parameter specifies the STP request object for which to
* construct a RAW command frame task context. * construct a RAW command frame task context.
* @task_context: This parameter specifies the SCU specific task context buffer * @task_context: This parameter specifies the SCU specific task context buffer
* to construct. * to construct.
...@@ -347,10 +347,10 @@ enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_ ...@@ -347,10 +347,10 @@ enum sci_status scic_sds_stp_ncq_request_construct(struct scic_sds_request *sci_
* utilizing the raw frame method. none * utilizing the raw frame method. none
*/ */
static void scu_stp_raw_request_construct_task_context( static void scu_stp_raw_request_construct_task_context(
struct scic_sds_stp_request *this_request, struct scic_sds_stp_request *sci_req,
struct scu_task_context *task_context) struct scu_task_context *task_context)
{ {
scu_sata_reqeust_construct_task_context(&this_request->parent, task_context); scu_sata_reqeust_construct_task_context(&sci_req->parent, task_context);
task_context->control_frame = 0; task_context->control_frame = 0;
task_context->priority = SCU_TASK_PRIORITY_NORMAL; task_context->priority = SCU_TASK_PRIORITY_NORMAL;
...@@ -386,7 +386,7 @@ void *scic_stp_io_request_get_d2h_reg_address( ...@@ -386,7 +386,7 @@ void *scic_stp_io_request_get_d2h_reg_address(
/** /**
* *
* @this_request: * @sci_req:
* *
* Get the next SGL element from the request. - Check on which SGL element pair * Get the next SGL element from the request. - Check on which SGL element pair
* we are working - if working on SLG pair element A - advance to element B - * we are working - if working on SLG pair element A - advance to element B -
...@@ -430,7 +430,7 @@ static struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic ...@@ -430,7 +430,7 @@ static struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic
/** /**
* *
* @this_request: * @sci_req:
* @completion_code: * @completion_code:
* *
* This method processes a TC completion. The expected TC completion is for * This method processes a TC completion. The expected TC completion is for
...@@ -439,17 +439,17 @@ static struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic ...@@ -439,17 +439,17 @@ static struct scu_sgl_element *scic_sds_stp_request_pio_get_next_sgl(struct scic
* SCI_SUCCESS This value is always returned. * SCI_SUCCESS This value is always returned.
*/ */
static enum sci_status scic_sds_stp_request_non_data_await_h2d_tc_completion_handler( static enum sci_status scic_sds_stp_request_non_data_await_h2d_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE
); );
break; break;
...@@ -459,13 +459,13 @@ static enum sci_status scic_sds_stp_request_non_data_await_h2d_tc_completion_han ...@@ -459,13 +459,13 @@ static enum sci_status scic_sds_stp_request_non_data_await_h2d_tc_completion_han
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED); &sci_req->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
} }
...@@ -491,10 +491,10 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler( ...@@ -491,10 +491,10 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler(
enum sci_status status; enum sci_status status;
struct sata_fis_header *frame_header; struct sata_fis_header *frame_header;
u32 *frame_buffer; u32 *frame_buffer;
struct scic_sds_stp_request *this_request = (struct scic_sds_stp_request *)request; struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&this_request->parent.owning_controller->uf_control, &sci_req->parent.owning_controller->uf_control,
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -503,18 +503,18 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler( ...@@ -503,18 +503,18 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler(
switch (frame_header->fis_type) { switch (frame_header->fis_type) {
case SATA_FIS_TYPE_REGD2H: case SATA_FIS_TYPE_REGD2H:
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&this_request->parent.owning_controller->uf_control, &sci_req->parent.owning_controller->uf_control,
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
scic_sds_controller_copy_sata_response( scic_sds_controller_copy_sata_response(
&this_request->d2h_reg_fis, (u32 *)frame_header, frame_buffer &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer
); );
/* The command has completed with error */ /* The command has completed with error */
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
...@@ -524,10 +524,10 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler( ...@@ -524,10 +524,10 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler(
dev_warn(scic_to_dev(request->owning_controller), dev_warn(scic_to_dev(request->owning_controller),
"%s: IO Request:0x%p Frame Id:%d protocol " "%s: IO Request:0x%p Frame Id:%d protocol "
"violation occurred\n", "violation occurred\n",
__func__, this_request, frame_index); __func__, sci_req, frame_index);
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_UNEXP_FIS, SCU_TASK_DONE_UNEXP_FIS,
SCI_FAILURE_PROTOCOL_VIOLATION SCI_FAILURE_PROTOCOL_VIOLATION
); );
...@@ -535,18 +535,18 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler( ...@@ -535,18 +535,18 @@ static enum sci_status scic_sds_stp_request_non_data_await_d2h_frame_handler(
} }
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
/* Frame has been decoded return it to the controller */ /* Frame has been decoded return it to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->parent.owning_controller, frame_index); sci_req->parent.owning_controller, frame_index);
} else } else
dev_err(scic_to_dev(request->owning_controller), dev_err(scic_to_dev(request->owning_controller),
"%s: SCIC IO Request 0x%p could not get frame header " "%s: SCIC IO Request 0x%p could not get frame header "
"for frame index %d, status %x\n", "for frame index %d, status %x\n",
__func__, this_request, frame_index, status); __func__, sci_req, frame_index, status);
return status; return status;
} }
...@@ -567,26 +567,26 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start ...@@ -567,26 +567,26 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter( static void scic_sds_stp_request_started_non_data_await_h2d_completion_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_non_data_substate_handler_table, scic_sds_stp_request_started_non_data_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_H2D_COMPLETION_SUBSTATE
); );
scic_sds_remote_device_set_working_request( scic_sds_remote_device_set_working_request(
this_request->target_device, this_request sci_req->target_device, sci_req
); );
} }
static void scic_sds_stp_request_started_non_data_await_d2h_enter( static void scic_sds_stp_request_started_non_data_await_d2h_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_non_data_substate_handler_table, scic_sds_stp_request_started_non_data_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_NON_DATA_AWAIT_D2H_SUBSTATE
); );
...@@ -624,7 +624,7 @@ enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request ...@@ -624,7 +624,7 @@ enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request
/** /**
* *
* @this_request: * @sci_req:
* @length: * @length:
* *
* This function will transmit DATA_FIS from (current sgl + offset) for input * This function will transmit DATA_FIS from (current sgl + offset) for input
...@@ -633,24 +633,24 @@ enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request ...@@ -633,24 +633,24 @@ enum sci_status scic_sds_stp_non_data_request_construct(struct scic_sds_request
*/ */
static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame( static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 length) u32 length)
{ {
struct scic_sds_stp_request *this_sds_stp_request = (struct scic_sds_stp_request *)this_request; struct scic_sds_stp_request *stp_req = (struct scic_sds_stp_request *)sci_req;
struct scu_sgl_element *current_sgl; struct scu_sgl_element *current_sgl;
/* /*
* Recycle the TC and reconstruct it for sending out DATA FIS containing * Recycle the TC and reconstruct it for sending out DATA FIS containing
* for the data from current_sgl+offset for the input length */ * for the data from current_sgl+offset for the input length */
struct scu_task_context *task_context = scic_sds_controller_get_task_context_buffer( struct scu_task_context *task_context = scic_sds_controller_get_task_context_buffer(
this_request->owning_controller, sci_req->owning_controller,
this_request->io_tag sci_req->io_tag
); );
if (this_sds_stp_request->type.pio.request_current.sgl_set == SCU_SGL_ELEMENT_PAIR_A) if (stp_req->type.pio.request_current.sgl_set == SCU_SGL_ELEMENT_PAIR_A)
current_sgl = &(this_sds_stp_request->type.pio.request_current.sgl_pair->A); current_sgl = &(stp_req->type.pio.request_current.sgl_pair->A);
else else
current_sgl = &(this_sds_stp_request->type.pio.request_current.sgl_pair->B); current_sgl = &(stp_req->type.pio.request_current.sgl_pair->B);
/* update the TC */ /* update the TC */
task_context->command_iu_upper = current_sgl->address_upper; task_context->command_iu_upper = current_sgl->address_upper;
...@@ -659,17 +659,17 @@ static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame( ...@@ -659,17 +659,17 @@ static enum sci_status scic_sds_stp_request_pio_data_out_trasmit_data_frame(
task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA; task_context->type.stp.fis_type = SATA_FIS_TYPE_DATA;
/* send the new TC out. */ /* send the new TC out. */
return scic_controller_continue_io(this_request); return scic_controller_continue_io(sci_req);
} }
/** /**
* *
* @this_request: * @sci_req:
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_stp_request_pio_data_out_transmit_data( static enum sci_status scic_sds_stp_request_pio_data_out_transmit_data(
struct scic_sds_request *this_sds_request) struct scic_sds_request *sci_req)
{ {
struct scu_sgl_element *current_sgl; struct scu_sgl_element *current_sgl;
...@@ -677,45 +677,45 @@ static enum sci_status scic_sds_stp_request_pio_data_out_transmit_data( ...@@ -677,45 +677,45 @@ static enum sci_status scic_sds_stp_request_pio_data_out_transmit_data(
u32 remaining_bytes_in_current_sgl = 0; u32 remaining_bytes_in_current_sgl = 0;
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
struct scic_sds_stp_request *this_sds_stp_request = (struct scic_sds_stp_request *)this_sds_request; struct scic_sds_stp_request *stp_req = (struct scic_sds_stp_request *)sci_req;
sgl_offset = this_sds_stp_request->type.pio.request_current.sgl_offset; sgl_offset = stp_req->type.pio.request_current.sgl_offset;
if (this_sds_stp_request->type.pio.request_current.sgl_set == SCU_SGL_ELEMENT_PAIR_A) { if (stp_req->type.pio.request_current.sgl_set == SCU_SGL_ELEMENT_PAIR_A) {
current_sgl = &(this_sds_stp_request->type.pio.request_current.sgl_pair->A); current_sgl = &(stp_req->type.pio.request_current.sgl_pair->A);
remaining_bytes_in_current_sgl = this_sds_stp_request->type.pio.request_current.sgl_pair->A.length - sgl_offset; remaining_bytes_in_current_sgl = stp_req->type.pio.request_current.sgl_pair->A.length - sgl_offset;
} else { } else {
current_sgl = &(this_sds_stp_request->type.pio.request_current.sgl_pair->B); current_sgl = &(stp_req->type.pio.request_current.sgl_pair->B);
remaining_bytes_in_current_sgl = this_sds_stp_request->type.pio.request_current.sgl_pair->B.length - sgl_offset; remaining_bytes_in_current_sgl = stp_req->type.pio.request_current.sgl_pair->B.length - sgl_offset;
} }
if (this_sds_stp_request->type.pio.pio_transfer_bytes > 0) { if (stp_req->type.pio.pio_transfer_bytes > 0) {
if (this_sds_stp_request->type.pio.pio_transfer_bytes >= remaining_bytes_in_current_sgl) { if (stp_req->type.pio.pio_transfer_bytes >= remaining_bytes_in_current_sgl) {
/* recycle the TC and send the H2D Data FIS from (current sgl + sgl_offset) and length = remaining_bytes_in_current_sgl */ /* recycle the TC and send the H2D Data FIS from (current sgl + sgl_offset) and length = remaining_bytes_in_current_sgl */
status = scic_sds_stp_request_pio_data_out_trasmit_data_frame(this_sds_request, remaining_bytes_in_current_sgl); status = scic_sds_stp_request_pio_data_out_trasmit_data_frame(sci_req, remaining_bytes_in_current_sgl);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
this_sds_stp_request->type.pio.pio_transfer_bytes -= remaining_bytes_in_current_sgl; stp_req->type.pio.pio_transfer_bytes -= remaining_bytes_in_current_sgl;
/* update the current sgl, sgl_offset and save for future */ /* update the current sgl, sgl_offset and save for future */
current_sgl = scic_sds_stp_request_pio_get_next_sgl(this_sds_stp_request); current_sgl = scic_sds_stp_request_pio_get_next_sgl(stp_req);
sgl_offset = 0; sgl_offset = 0;
} }
} else if (this_sds_stp_request->type.pio.pio_transfer_bytes < remaining_bytes_in_current_sgl) { } else if (stp_req->type.pio.pio_transfer_bytes < remaining_bytes_in_current_sgl) {
/* recycle the TC and send the H2D Data FIS from (current sgl + sgl_offset) and length = type.pio.pio_transfer_bytes */ /* recycle the TC and send the H2D Data FIS from (current sgl + sgl_offset) and length = type.pio.pio_transfer_bytes */
scic_sds_stp_request_pio_data_out_trasmit_data_frame(this_sds_request, this_sds_stp_request->type.pio.pio_transfer_bytes); scic_sds_stp_request_pio_data_out_trasmit_data_frame(sci_req, stp_req->type.pio.pio_transfer_bytes);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
/* Sgl offset will be adjusted and saved for future */ /* Sgl offset will be adjusted and saved for future */
sgl_offset += this_sds_stp_request->type.pio.pio_transfer_bytes; sgl_offset += stp_req->type.pio.pio_transfer_bytes;
current_sgl->address_lower += this_sds_stp_request->type.pio.pio_transfer_bytes; current_sgl->address_lower += stp_req->type.pio.pio_transfer_bytes;
this_sds_stp_request->type.pio.pio_transfer_bytes = 0; stp_req->type.pio.pio_transfer_bytes = 0;
} }
} }
} }
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
this_sds_stp_request->type.pio.request_current.sgl_offset = sgl_offset; stp_req->type.pio.request_current.sgl_offset = sgl_offset;
} }
return status; return status;
...@@ -772,13 +772,13 @@ scic_sds_stp_request_pio_data_in_copy_data_buffer(struct scic_sds_stp_request *s ...@@ -772,13 +772,13 @@ scic_sds_stp_request_pio_data_in_copy_data_buffer(struct scic_sds_stp_request *s
/** /**
* *
* @this_request: The PIO DATA IN request that is to receive the data. * @sci_req: The PIO DATA IN request that is to receive the data.
* @data_buffer: The buffer to copy from. * @data_buffer: The buffer to copy from.
* *
* Copy the data buffer to the io request data region. enum sci_status * Copy the data buffer to the io request data region. enum sci_status
*/ */
static enum sci_status scic_sds_stp_request_pio_data_in_copy_data( static enum sci_status scic_sds_stp_request_pio_data_in_copy_data(
struct scic_sds_stp_request *this_request, struct scic_sds_stp_request *sci_req,
u8 *data_buffer) u8 *data_buffer)
{ {
enum sci_status status; enum sci_status status;
...@@ -786,19 +786,19 @@ static enum sci_status scic_sds_stp_request_pio_data_in_copy_data( ...@@ -786,19 +786,19 @@ static enum sci_status scic_sds_stp_request_pio_data_in_copy_data(
/* /*
* If there is less than 1K remaining in the transfer request * If there is less than 1K remaining in the transfer request
* copy just the data for the transfer */ * copy just the data for the transfer */
if (this_request->type.pio.pio_transfer_bytes < SCU_MAX_FRAME_BUFFER_SIZE) { if (sci_req->type.pio.pio_transfer_bytes < SCU_MAX_FRAME_BUFFER_SIZE) {
status = scic_sds_stp_request_pio_data_in_copy_data_buffer( status = scic_sds_stp_request_pio_data_in_copy_data_buffer(
this_request, data_buffer, this_request->type.pio.pio_transfer_bytes); sci_req, data_buffer, sci_req->type.pio.pio_transfer_bytes);
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
this_request->type.pio.pio_transfer_bytes = 0; sci_req->type.pio.pio_transfer_bytes = 0;
} else { } else {
/* We are transfering the whole frame so copy */ /* We are transfering the whole frame so copy */
status = scic_sds_stp_request_pio_data_in_copy_data_buffer( status = scic_sds_stp_request_pio_data_in_copy_data_buffer(
this_request, data_buffer, SCU_MAX_FRAME_BUFFER_SIZE); sci_req, data_buffer, SCU_MAX_FRAME_BUFFER_SIZE);
if (status == SCI_SUCCESS) if (status == SCI_SUCCESS)
this_request->type.pio.pio_transfer_bytes -= SCU_MAX_FRAME_BUFFER_SIZE; sci_req->type.pio.pio_transfer_bytes -= SCU_MAX_FRAME_BUFFER_SIZE;
} }
return status; return status;
...@@ -806,13 +806,13 @@ static enum sci_status scic_sds_stp_request_pio_data_in_copy_data( ...@@ -806,13 +806,13 @@ static enum sci_status scic_sds_stp_request_pio_data_in_copy_data(
/** /**
* *
* @this_request: * @sci_req:
* @completion_code: * @completion_code:
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completion_handler( static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
...@@ -820,11 +820,11 @@ static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completi ...@@ -820,11 +820,11 @@ static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completi
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE
); );
break; break;
...@@ -834,13 +834,13 @@ static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completi ...@@ -834,13 +834,13 @@ static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completi
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
break; break;
...@@ -851,7 +851,7 @@ static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completi ...@@ -851,7 +851,7 @@ static enum sci_status scic_sds_stp_request_pio_await_h2d_completion_tc_completi
/** /**
* *
* @this_request: * @sci_req:
* @frame_index: * @frame_index:
* *
* enum sci_status * enum sci_status
...@@ -863,12 +863,12 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( ...@@ -863,12 +863,12 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(
enum sci_status status; enum sci_status status;
struct sata_fis_header *frame_header; struct sata_fis_header *frame_header;
u32 *frame_buffer; u32 *frame_buffer;
struct scic_sds_stp_request *this_request; struct scic_sds_stp_request *sci_req;
this_request = (struct scic_sds_stp_request *)request; sci_req = (struct scic_sds_stp_request *)request;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -878,7 +878,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( ...@@ -878,7 +878,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(
case SATA_FIS_TYPE_PIO_SETUP: case SATA_FIS_TYPE_PIO_SETUP:
/* Get from the frame buffer the PIO Setup Data */ /* Get from the frame buffer the PIO Setup Data */
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
...@@ -887,30 +887,30 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( ...@@ -887,30 +887,30 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(
* Get the data from the PIO Setup * Get the data from the PIO Setup
* The SCU Hardware returns first word in the frame_header and the rest * The SCU Hardware returns first word in the frame_header and the rest
* of the data is in the frame buffer so we need to back up one dword */ * of the data is in the frame buffer so we need to back up one dword */
this_request->type.pio.pio_transfer_bytes = sci_req->type.pio.pio_transfer_bytes =
(u16)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->transfter_count; (u16)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->transfter_count;
this_request->type.pio.ending_status = sci_req->type.pio.ending_status =
(u8)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->ending_status; (u8)((struct sata_fis_pio_setup *)(&frame_buffer[-1]))->ending_status;
scic_sds_controller_copy_sata_response( scic_sds_controller_copy_sata_response(
&this_request->d2h_reg_fis, (u32 *)frame_header, frame_buffer &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer
); );
this_request->d2h_reg_fis.status = sci_req->d2h_reg_fis.status =
this_request->type.pio.ending_status; sci_req->type.pio.ending_status;
/* The next state is dependent on whether the request was PIO Data-in or Data out */ /* The next state is dependent on whether the request was PIO Data-in or Data out */
if (this_request->type.pio.sat_protocol == SAT_PROTOCOL_PIO_DATA_IN) { if (sci_req->type.pio.sat_protocol == SAT_PROTOCOL_PIO_DATA_IN) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.started_substate_machine, &sci_req->parent.started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE
); );
} else if (this_request->type.pio.sat_protocol == SAT_PROTOCOL_PIO_DATA_OUT) { } else if (sci_req->type.pio.sat_protocol == SAT_PROTOCOL_PIO_DATA_OUT) {
/* Transmit data */ /* Transmit data */
status = scic_sds_stp_request_pio_data_out_transmit_data(request); status = scic_sds_stp_request_pio_data_out_transmit_data(request);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.started_substate_machine, &sci_req->parent.started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE
); );
} }
...@@ -919,7 +919,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( ...@@ -919,7 +919,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(
case SATA_FIS_TYPE_SETDEVBITS: case SATA_FIS_TYPE_SETDEVBITS:
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.started_substate_machine, &sci_req->parent.started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE
); );
break; break;
...@@ -927,22 +927,22 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( ...@@ -927,22 +927,22 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(
case SATA_FIS_TYPE_REGD2H: case SATA_FIS_TYPE_REGD2H:
if ((frame_header->status & ATA_STATUS_REG_BSY_BIT) == 0) { if ((frame_header->status & ATA_STATUS_REG_BSY_BIT) == 0) {
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
scic_sds_controller_copy_sata_response( scic_sds_controller_copy_sata_response(
&this_request->d2h_reg_fis, (u32 *)frame_header, frame_buffer); &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer);
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
} else { } else {
...@@ -954,7 +954,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( ...@@ -954,7 +954,7 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(
"D2H Register FIS with BSY status " "D2H Register FIS with BSY status "
"0x%x\n", "0x%x\n",
__func__, __func__,
this_request, sci_req,
frame_header->status); frame_header->status);
} }
break; break;
...@@ -965,21 +965,21 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler( ...@@ -965,21 +965,21 @@ static enum sci_status scic_sds_stp_request_pio_await_frame_frame_handler(
/* Frame is decoded return it to the controller */ /* Frame is decoded return it to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->parent.owning_controller, sci_req->parent.owning_controller,
frame_index frame_index
); );
} else } else
dev_err(scic_to_dev(request->owning_controller), dev_err(scic_to_dev(request->owning_controller),
"%s: SCIC IO Request 0x%p could not get frame header " "%s: SCIC IO Request 0x%p could not get frame header "
"for frame index %d, status %x\n", "for frame index %d, status %x\n",
__func__, this_request, frame_index, status); __func__, sci_req, frame_index, status);
return status; return status;
} }
/** /**
* *
* @this_request: * @sci_req:
* @frame_index: * @frame_index:
* *
* enum sci_status * enum sci_status
...@@ -991,33 +991,33 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler ...@@ -991,33 +991,33 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler
enum sci_status status; enum sci_status status;
struct sata_fis_header *frame_header; struct sata_fis_header *frame_header;
struct sata_fis_data *frame_buffer; struct sata_fis_data *frame_buffer;
struct scic_sds_stp_request *this_request; struct scic_sds_stp_request *sci_req;
this_request = (struct scic_sds_stp_request *)request; sci_req = (struct scic_sds_stp_request *)request;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
if (frame_header->fis_type == SATA_FIS_TYPE_DATA) { if (frame_header->fis_type == SATA_FIS_TYPE_DATA) {
if (this_request->type.pio.request_current.sgl_pair == NULL) { if (sci_req->type.pio.request_current.sgl_pair == NULL) {
this_request->parent.saved_rx_frame_index = frame_index; sci_req->parent.saved_rx_frame_index = frame_index;
this_request->type.pio.pio_transfer_bytes = 0; sci_req->type.pio.pio_transfer_bytes = 0;
} else { } else {
status = scic_sds_unsolicited_frame_control_get_buffer( status = scic_sds_unsolicited_frame_control_get_buffer(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
status = scic_sds_stp_request_pio_data_in_copy_data(this_request, (u8 *)frame_buffer); status = scic_sds_stp_request_pio_data_in_copy_data(sci_req, (u8 *)frame_buffer);
/* Frame is decoded return it to the controller */ /* Frame is decoded return it to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->parent.owning_controller, sci_req->parent.owning_controller,
frame_index frame_index
); );
} }
...@@ -1027,17 +1027,17 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler ...@@ -1027,17 +1027,17 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler
* for this data transfer */ * for this data transfer */
if ( if (
(status == SCI_SUCCESS) (status == SCI_SUCCESS)
&& (this_request->type.pio.pio_transfer_bytes == 0) && (sci_req->type.pio.pio_transfer_bytes == 0)
) { ) {
if ((this_request->type.pio.ending_status & ATA_STATUS_REG_BSY_BIT) == 0) { if ((sci_req->type.pio.ending_status & ATA_STATUS_REG_BSY_BIT) == 0) {
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
} else { } else {
...@@ -1053,24 +1053,24 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler ...@@ -1053,24 +1053,24 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler
"with fis type 0x%02x when expecting a data " "with fis type 0x%02x when expecting a data "
"fis.\n", "fis.\n",
__func__, __func__,
this_request, sci_req,
frame_index, frame_index,
frame_header->fis_type); frame_header->fis_type);
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_GOOD, SCU_TASK_DONE_GOOD,
SCI_FAILURE_IO_REQUIRES_SCSI_ABORT SCI_FAILURE_IO_REQUIRES_SCSI_ABORT
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
/* Frame is decoded return it to the controller */ /* Frame is decoded return it to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->parent.owning_controller, sci_req->parent.owning_controller,
frame_index frame_index
); );
} }
...@@ -1078,7 +1078,7 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler ...@@ -1078,7 +1078,7 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler
dev_err(scic_to_dev(request->owning_controller), dev_err(scic_to_dev(request->owning_controller),
"%s: SCIC IO Request 0x%p could not get frame header " "%s: SCIC IO Request 0x%p could not get frame header "
"for frame index %d, status %x\n", "for frame index %d, status %x\n",
__func__, this_request, frame_index, status); __func__, sci_req, frame_index, status);
return status; return status;
} }
...@@ -1086,31 +1086,31 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler ...@@ -1086,31 +1086,31 @@ static enum sci_status scic_sds_stp_request_pio_data_in_await_data_frame_handler
/** /**
* *
* @this_request: * @sci_req:
* @completion_code: * @completion_code:
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_completion_tc_completion_handler( static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_completion_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
bool all_frames_transferred = false; bool all_frames_transferred = false;
struct scic_sds_stp_request *this_scic_sds_stp_request = (struct scic_sds_stp_request *)this_request; struct scic_sds_stp_request *stp_req = (struct scic_sds_stp_request *)sci_req;
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
/* Transmit data */ /* Transmit data */
if (this_scic_sds_stp_request->type.pio.pio_transfer_bytes != 0) { if (stp_req->type.pio.pio_transfer_bytes != 0) {
status = scic_sds_stp_request_pio_data_out_transmit_data(this_request); status = scic_sds_stp_request_pio_data_out_transmit_data(sci_req);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
if (this_scic_sds_stp_request->type.pio.pio_transfer_bytes == 0) if (stp_req->type.pio.pio_transfer_bytes == 0)
all_frames_transferred = true; all_frames_transferred = true;
} }
} else if (this_scic_sds_stp_request->type.pio.pio_transfer_bytes == 0) { } else if (stp_req->type.pio.pio_transfer_bytes == 0) {
/* /*
* this will happen if the all data is written at the * this will happen if the all data is written at the
* first time after the pio setup fis is received * first time after the pio setup fis is received
...@@ -1124,7 +1124,7 @@ static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_com ...@@ -1124,7 +1124,7 @@ static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_com
* Change the state to SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_FRAME_SUBSTATE * Change the state to SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_FRAME_SUBSTATE
* and wait for PIO_SETUP fis / or D2H REg fis. */ * and wait for PIO_SETUP fis / or D2H REg fis. */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE
); );
} }
...@@ -1135,13 +1135,13 @@ static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_com ...@@ -1135,13 +1135,13 @@ static enum sci_status scic_sds_stp_request_pio_data_out_await_data_transmit_com
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, &sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED SCI_BASE_REQUEST_STATE_COMPLETED
); );
break; break;
...@@ -1217,25 +1217,25 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start ...@@ -1217,25 +1217,25 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
static void scic_sds_stp_request_started_pio_await_h2d_completion_enter( static void scic_sds_stp_request_started_pio_await_h2d_completion_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_pio_substate_handler_table, scic_sds_stp_request_started_pio_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_H2D_COMPLETION_SUBSTATE
); );
scic_sds_remote_device_set_working_request( scic_sds_remote_device_set_working_request(
this_request->target_device, this_request); sci_req->target_device, sci_req);
} }
static void scic_sds_stp_request_started_pio_await_frame_enter( static void scic_sds_stp_request_started_pio_await_frame_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_pio_substate_handler_table, scic_sds_stp_request_started_pio_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_AWAIT_FRAME_SUBSTATE
); );
...@@ -1244,10 +1244,10 @@ static void scic_sds_stp_request_started_pio_await_frame_enter( ...@@ -1244,10 +1244,10 @@ static void scic_sds_stp_request_started_pio_await_frame_enter(
static void scic_sds_stp_request_started_pio_data_in_await_data_enter( static void scic_sds_stp_request_started_pio_data_in_await_data_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_pio_substate_handler_table, scic_sds_stp_request_started_pio_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_IN_AWAIT_DATA_SUBSTATE
); );
...@@ -1256,10 +1256,10 @@ static void scic_sds_stp_request_started_pio_data_in_await_data_enter( ...@@ -1256,10 +1256,10 @@ static void scic_sds_stp_request_started_pio_data_in_await_data_enter(
static void scic_sds_stp_request_started_pio_data_out_transmit_data_enter( static void scic_sds_stp_request_started_pio_data_out_transmit_data_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_pio_substate_handler_table, scic_sds_stp_request_started_pio_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_PIO_DATA_OUT_TRANSMIT_DATA_SUBSTATE
); );
...@@ -1333,13 +1333,13 @@ static void scic_sds_stp_request_udma_complete_request( ...@@ -1333,13 +1333,13 @@ static void scic_sds_stp_request_udma_complete_request(
/** /**
* *
* @this_request: * @sci_req:
* @frame_index: * @frame_index:
* *
* enum sci_status * enum sci_status
*/ */
static enum sci_status scic_sds_stp_request_udma_general_frame_handler( static enum sci_status scic_sds_stp_request_udma_general_frame_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 frame_index) u32 frame_index)
{ {
enum sci_status status; enum sci_status status;
...@@ -1347,7 +1347,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler( ...@@ -1347,7 +1347,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(
u32 *frame_buffer; u32 *frame_buffer;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&this_request->owning_controller->uf_control, &sci_req->owning_controller->uf_control,
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -1357,20 +1357,20 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler( ...@@ -1357,20 +1357,20 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(
&& (frame_header->fis_type == SATA_FIS_TYPE_REGD2H) && (frame_header->fis_type == SATA_FIS_TYPE_REGD2H)
) { ) {
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&this_request->owning_controller->uf_control, &sci_req->owning_controller->uf_control,
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
scic_sds_controller_copy_sata_response( scic_sds_controller_copy_sata_response(
&((struct scic_sds_stp_request *)this_request)->d2h_reg_fis, &((struct scic_sds_stp_request *)sci_req)->d2h_reg_fis,
(u32 *)frame_header, (u32 *)frame_header,
frame_buffer frame_buffer
); );
} }
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->owning_controller, frame_index); sci_req->owning_controller, frame_index);
return status; return status;
} }
...@@ -1378,7 +1378,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler( ...@@ -1378,7 +1378,7 @@ static enum sci_status scic_sds_stp_request_udma_general_frame_handler(
/** /**
* This method process TC completions while in the state where we are waiting * This method process TC completions while in the state where we are waiting
* for TC completions. * for TC completions.
* @this_request: * @sci_req:
* @completion_code: * @completion_code:
* *
* enum sci_status * enum sci_status
...@@ -1388,12 +1388,12 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi ...@@ -1388,12 +1388,12 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi
u32 completion_code) u32 completion_code)
{ {
enum sci_status status = SCI_SUCCESS; enum sci_status status = SCI_SUCCESS;
struct scic_sds_stp_request *this_request = (struct scic_sds_stp_request *)request; struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request;
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_stp_request_udma_complete_request( scic_sds_stp_request_udma_complete_request(
&this_request->parent, SCU_TASK_DONE_GOOD, SCI_SUCCESS &sci_req->parent, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
break; break;
...@@ -1402,14 +1402,14 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi ...@@ -1402,14 +1402,14 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi
/* /*
* We must check ther response buffer to see if the D2H Register FIS was * We must check ther response buffer to see if the D2H Register FIS was
* received before we got the TC completion. */ * received before we got the TC completion. */
if (this_request->d2h_reg_fis.fis_type == SATA_FIS_TYPE_REGD2H) { if (sci_req->d2h_reg_fis.fis_type == SATA_FIS_TYPE_REGD2H) {
scic_sds_remote_device_suspend( scic_sds_remote_device_suspend(
this_request->parent.target_device, sci_req->parent.target_device,
SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code)) SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))
); );
scic_sds_stp_request_udma_complete_request( scic_sds_stp_request_udma_complete_request(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
...@@ -1418,7 +1418,7 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi ...@@ -1418,7 +1418,7 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi
* If we have an error completion status for the TC then we can expect a * If we have an error completion status for the TC then we can expect a
* D2H register FIS from the device so we must change state to wait for it */ * D2H register FIS from the device so we must change state to wait for it */
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.started_substate_machine, &sci_req->parent.started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE
); );
} }
...@@ -1434,14 +1434,14 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi ...@@ -1434,14 +1434,14 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CMD_LL_R_ERR): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CMD_LL_R_ERR):
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CRC_ERR): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CRC_ERR):
scic_sds_remote_device_suspend( scic_sds_remote_device_suspend(
this_request->parent.target_device, sci_req->parent.target_device,
SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code)) SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code))
); );
/* Fall through to the default case */ /* Fall through to the default case */
default: default:
/* All other completion status cause the IO to be complete. */ /* All other completion status cause the IO to be complete. */
scic_sds_stp_request_udma_complete_request( scic_sds_stp_request_udma_complete_request(
&this_request->parent, &sci_req->parent,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
...@@ -1452,17 +1452,17 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi ...@@ -1452,17 +1452,17 @@ static enum sci_status scic_sds_stp_request_udma_await_tc_completion_tc_completi
} }
static enum sci_status scic_sds_stp_request_udma_await_d2h_reg_fis_frame_handler( static enum sci_status scic_sds_stp_request_udma_await_d2h_reg_fis_frame_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 frame_index) u32 frame_index)
{ {
enum sci_status status; enum sci_status status;
/* Use the general frame handler to copy the resposne data */ /* Use the general frame handler to copy the resposne data */
status = scic_sds_stp_request_udma_general_frame_handler(this_request, frame_index); status = scic_sds_stp_request_udma_general_frame_handler(sci_req, frame_index);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
scic_sds_stp_request_udma_complete_request( scic_sds_stp_request_udma_complete_request(
this_request, sci_req,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
...@@ -1488,10 +1488,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start ...@@ -1488,10 +1488,10 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
static void scic_sds_stp_request_started_udma_await_tc_completion_enter( static void scic_sds_stp_request_started_udma_await_tc_completion_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_udma_substate_handler_table, scic_sds_stp_request_started_udma_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_TC_COMPLETION_SUBSTATE
); );
...@@ -1507,10 +1507,10 @@ static void scic_sds_stp_request_started_udma_await_tc_completion_enter( ...@@ -1507,10 +1507,10 @@ static void scic_sds_stp_request_started_udma_await_tc_completion_enter(
static void scic_sds_stp_request_started_udma_await_d2h_reg_fis_enter( static void scic_sds_stp_request_started_udma_await_d2h_reg_fis_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_udma_substate_handler_table, scic_sds_stp_request_started_udma_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_UDMA_AWAIT_D2H_REG_FIS_SUBSTATE
); );
...@@ -1548,7 +1548,7 @@ enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci ...@@ -1548,7 +1548,7 @@ enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci
/** /**
* *
* @this_request: * @sci_req:
* @completion_code: * @completion_code:
* *
* This method processes a TC completion. The expected TC completion is for * This method processes a TC completion. The expected TC completion is for
...@@ -1557,17 +1557,17 @@ enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci ...@@ -1557,17 +1557,17 @@ enum sci_status scic_sds_stp_udma_request_construct(struct scic_sds_request *sci
* SCI_SUCCESS This value is always returned. * SCI_SUCCESS This value is always returned.
*/ */
static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_completion_handler( static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE
); );
break; break;
...@@ -1577,13 +1577,13 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_com ...@@ -1577,13 +1577,13 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_com
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED); &sci_req->state_machine, SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
} }
...@@ -1592,7 +1592,7 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_com ...@@ -1592,7 +1592,7 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_com
/** /**
* *
* @this_request: * @sci_req:
* @completion_code: * @completion_code:
* *
* This method processes a TC completion. The expected TC completion is for * This method processes a TC completion. The expected TC completion is for
...@@ -1601,17 +1601,17 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_com ...@@ -1601,17 +1601,17 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_asserted_tc_com
* SCI_SUCCESS This value is always returned. * SCI_SUCCESS This value is always returned.
*/ */
static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_completion_handler( static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_completion_handler(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 completion_code) u32 completion_code)
{ {
switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) { switch (SCU_GET_COMPLETION_TL_STATUS(completion_code)) {
case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD): case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_GOOD):
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, SCU_TASK_DONE_GOOD, SCI_SUCCESS sci_req, SCU_TASK_DONE_GOOD, SCI_SUCCESS
); );
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->started_substate_machine, &sci_req->started_substate_machine,
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE
); );
break; break;
...@@ -1621,12 +1621,12 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_c ...@@ -1621,12 +1621,12 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_h2d_diagnostic_tc_c
* All other completion status cause the IO to be complete. If a NAK * All other completion status cause the IO to be complete. If a NAK
* was received, then it is up to the user to retry the request. */ * was received, then it is up to the user to retry the request. */
scic_sds_request_set_status( scic_sds_request_set_status(
this_request, sci_req,
SCU_NORMALIZE_COMPLETION_STATUS(completion_code), SCU_NORMALIZE_COMPLETION_STATUS(completion_code),
SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR
); );
sci_base_state_machine_change_state(&this_request->state_machine, sci_base_state_machine_change_state(&sci_req->state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
break; break;
} }
...@@ -1653,10 +1653,10 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler( ...@@ -1653,10 +1653,10 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
enum sci_status status; enum sci_status status;
struct sata_fis_header *frame_header; struct sata_fis_header *frame_header;
u32 *frame_buffer; u32 *frame_buffer;
struct scic_sds_stp_request *this_request = (struct scic_sds_stp_request *)request; struct scic_sds_stp_request *sci_req = (struct scic_sds_stp_request *)request;
status = scic_sds_unsolicited_frame_control_get_header( status = scic_sds_unsolicited_frame_control_get_header(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_header (void **)&frame_header
); );
...@@ -1665,18 +1665,18 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler( ...@@ -1665,18 +1665,18 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
switch (frame_header->fis_type) { switch (frame_header->fis_type) {
case SATA_FIS_TYPE_REGD2H: case SATA_FIS_TYPE_REGD2H:
scic_sds_unsolicited_frame_control_get_buffer( scic_sds_unsolicited_frame_control_get_buffer(
&(this_request->parent.owning_controller->uf_control), &(sci_req->parent.owning_controller->uf_control),
frame_index, frame_index,
(void **)&frame_buffer (void **)&frame_buffer
); );
scic_sds_controller_copy_sata_response( scic_sds_controller_copy_sata_response(
&this_request->d2h_reg_fis, (u32 *)frame_header, frame_buffer &sci_req->d2h_reg_fis, (u32 *)frame_header, frame_buffer
); );
/* The command has completed with error */ /* The command has completed with error */
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_CHECK_RESPONSE, SCU_TASK_DONE_CHECK_RESPONSE,
SCI_FAILURE_IO_RESPONSE_VALID SCI_FAILURE_IO_RESPONSE_VALID
); );
...@@ -1687,11 +1687,11 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler( ...@@ -1687,11 +1687,11 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
"%s: IO Request:0x%p Frame Id:%d protocol " "%s: IO Request:0x%p Frame Id:%d protocol "
"violation occurred\n", "violation occurred\n",
__func__, __func__,
this_request, sci_req,
frame_index); frame_index);
scic_sds_request_set_status( scic_sds_request_set_status(
&this_request->parent, &sci_req->parent,
SCU_TASK_DONE_UNEXP_FIS, SCU_TASK_DONE_UNEXP_FIS,
SCI_FAILURE_PROTOCOL_VIOLATION SCI_FAILURE_PROTOCOL_VIOLATION
); );
...@@ -1699,18 +1699,18 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler( ...@@ -1699,18 +1699,18 @@ static enum sci_status scic_sds_stp_request_soft_reset_await_d2h_frame_handler(
} }
sci_base_state_machine_change_state( sci_base_state_machine_change_state(
&this_request->parent.state_machine, &sci_req->parent.state_machine,
SCI_BASE_REQUEST_STATE_COMPLETED); SCI_BASE_REQUEST_STATE_COMPLETED);
/* Frame has been decoded return it to the controller */ /* Frame has been decoded return it to the controller */
scic_sds_controller_release_frame( scic_sds_controller_release_frame(
this_request->parent.owning_controller, frame_index sci_req->parent.owning_controller, frame_index
); );
} else } else
dev_err(scic_to_dev(request->owning_controller), dev_err(scic_to_dev(request->owning_controller),
"%s: SCIC IO Request 0x%p could not get frame header " "%s: SCIC IO Request 0x%p could not get frame header "
"for frame index %d, status %x\n", "for frame index %d, status %x\n",
__func__, this_request, frame_index, status); __func__, sci_req, frame_index, status);
return status; return status;
} }
...@@ -1735,40 +1735,40 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start ...@@ -1735,40 +1735,40 @@ static const struct scic_sds_io_request_state_handler scic_sds_stp_request_start
static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter( static void scic_sds_stp_request_started_soft_reset_await_h2d_asserted_completion_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_soft_reset_substate_handler_table, scic_sds_stp_request_started_soft_reset_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_ASSERTED_COMPLETION_SUBSTATE
); );
scic_sds_remote_device_set_working_request( scic_sds_remote_device_set_working_request(
this_request->target_device, this_request sci_req->target_device, sci_req
); );
} }
static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter( static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_completion_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
struct scu_task_context *task_context; struct scu_task_context *task_context;
struct sata_fis_reg_h2d *h2d_fis; struct sata_fis_reg_h2d *h2d_fis;
enum sci_status status; enum sci_status status;
/* Clear the SRST bit */ /* Clear the SRST bit */
h2d_fis = scic_stp_io_request_get_h2d_reg_address(this_request); h2d_fis = scic_stp_io_request_get_h2d_reg_address(sci_req);
h2d_fis->control = 0; h2d_fis->control = 0;
/* Clear the TC control bit */ /* Clear the TC control bit */
task_context = scic_sds_controller_get_task_context_buffer( task_context = scic_sds_controller_get_task_context_buffer(
this_request->owning_controller, this_request->io_tag); sci_req->owning_controller, sci_req->io_tag);
task_context->control_frame = 0; task_context->control_frame = 0;
status = scic_controller_continue_io(this_request); status = scic_controller_continue_io(sci_req);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_soft_reset_substate_handler_table, scic_sds_stp_request_started_soft_reset_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_H2D_DIAGNOSTIC_COMPLETION_SUBSTATE
); );
...@@ -1778,10 +1778,10 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet ...@@ -1778,10 +1778,10 @@ static void scic_sds_stp_request_started_soft_reset_await_h2d_diagnostic_complet
static void scic_sds_stp_request_started_soft_reset_await_d2h_response_enter( static void scic_sds_stp_request_started_soft_reset_await_d2h_response_enter(
struct sci_base_object *object) struct sci_base_object *object)
{ {
struct scic_sds_request *this_request = (struct scic_sds_request *)object; struct scic_sds_request *sci_req = (struct scic_sds_request *)object;
SET_STATE_HANDLER( SET_STATE_HANDLER(
this_request, sci_req,
scic_sds_stp_request_started_soft_reset_substate_handler_table, scic_sds_stp_request_started_soft_reset_substate_handler_table,
SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE SCIC_SDS_STP_REQUEST_STARTED_SOFT_RESET_AWAIT_D2H_RESPONSE_FRAME_SUBSTATE
); );
......
...@@ -177,18 +177,18 @@ enum sci_status scic_sds_stp_pio_request_construct( ...@@ -177,18 +177,18 @@ enum sci_status scic_sds_stp_pio_request_construct(
bool copy_rx_frame); bool copy_rx_frame);
enum sci_status scic_sds_stp_udma_request_construct( enum sci_status scic_sds_stp_udma_request_construct(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 transfer_length, u32 transfer_length,
enum dma_data_direction dir); enum dma_data_direction dir);
enum sci_status scic_sds_stp_non_data_request_construct( enum sci_status scic_sds_stp_non_data_request_construct(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
enum sci_status scic_sds_stp_soft_reset_request_construct( enum sci_status scic_sds_stp_soft_reset_request_construct(
struct scic_sds_request *this_request); struct scic_sds_request *sci_req);
enum sci_status scic_sds_stp_ncq_request_construct( enum sci_status scic_sds_stp_ncq_request_construct(
struct scic_sds_request *this_request, struct scic_sds_request *sci_req,
u32 transfer_length, u32 transfer_length,
enum dma_data_direction dir); enum dma_data_direction dir);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册