Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 254347
b: refs/heads/master
c: c658b10
h: refs/heads/master
i:
  254345: 44ec615
  254343: 0616367
v: v3
  • Loading branch information
Pawel Marek authored and Dan Williams committed Jul 3, 2011
1 parent 2e3eed1 commit 08054e2
Show file tree
Hide file tree
Showing 7 changed files with 207 additions and 70 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3ff0121a704172aa4bca9c4026b419ddfe1921c8
refs/heads/master: c658b109d3a9444293700471a278a741a1e5033d
129 changes: 110 additions & 19 deletions trunk/drivers/scsi/isci/core/scic_sds_controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ static void scic_sds_controller_phy_startup_timeout_handler(
*
* This method initializes the phy startup operations for controller start.
*/
void scic_sds_controller_initialize_phy_startup(
enum sci_status scic_sds_controller_initialize_phy_startup(
struct scic_sds_controller *this_controller)
{
this_controller->phy_startup_timer = isci_event_timer_create(
Expand All @@ -261,8 +261,14 @@ void scic_sds_controller_initialize_phy_startup(
this_controller
);

this_controller->next_phy_to_start = 0;
this_controller->phy_startup_timer_pending = false;
if (this_controller->phy_startup_timer == NULL) {
return SCI_FAILURE_INSUFFICIENT_RESOURCES;
} else {
this_controller->next_phy_to_start = 0;
this_controller->phy_startup_timer_pending = false;
}

return SCI_SUCCESS;
}

/**
Expand Down Expand Up @@ -305,7 +311,7 @@ void scic_sds_controller_initialize_power_control(
* to build the memory table.
*
*/
static void scic_sds_controller_build_memory_descriptor_table(
void scic_sds_controller_build_memory_descriptor_table(
struct scic_sds_controller *this_controller)
{
sci_base_mde_construct(
Expand Down Expand Up @@ -1698,6 +1704,91 @@ void scic_sds_controller_link_down(
scic)));
}

/**
* This method is called by the remote device to inform the controller
* that this remote device has started.
*
*/

void scic_sds_controller_remote_device_started(
struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device)
{
u32 state;
scic_sds_controller_device_handler_t remote_device_started_handler;

state = this_controller->parent.state_machine.current_state_id;
remote_device_started_handler = scic_sds_controller_state_handler_table[state].remote_device_started_handler;

if (remote_device_started_handler != NULL)
remote_device_started_handler(this_controller, the_device);
else {
dev_warn(scic_to_dev(this_controller),
"%s: SCIC Controller 0x%p remote device started event "
"from device 0x%p in unexpected state %d\n",
__func__,
this_controller,
the_device,
sci_base_state_machine_get_state(
scic_sds_controller_get_base_state_machine(
this_controller)));
}
}

/**
* This is a helper method to determine if any remote devices on this
* controller are still in the stopping state.
*
*/
bool scic_sds_controller_has_remote_devices_stopping(
struct scic_sds_controller *this_controller)
{
u32 index;

for (index = 0; index < this_controller->remote_node_entries; index++) {
if ((this_controller->device_table[index] != NULL) &&
(this_controller->device_table[index]->parent.state_machine.current_state_id
== SCI_BASE_REMOTE_DEVICE_STATE_STOPPING))
return true;
}

return false;
}

/**
* This method is called by the remote device to inform the controller
* object that the remote device has stopped.
*
*/

void scic_sds_controller_remote_device_stopped(
struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device)
{

u32 state;
scic_sds_controller_device_handler_t remote_device_stopped_handler;

state = this_controller->parent.state_machine.current_state_id;
remote_device_stopped_handler = scic_sds_controller_state_handler_table[state].remote_device_stopped_handler;

if (remote_device_stopped_handler != NULL)
remote_device_stopped_handler(this_controller, the_device);
else {
dev_warn(scic_to_dev(this_controller),
"%s: SCIC Controller 0x%p remote device stopped event "
"from device 0x%p in unexpected state %d\n",
__func__,
this_controller,
the_device,
sci_base_state_machine_get_state(
scic_sds_controller_get_base_state_machine(
this_controller)));
}
}



/**
* This method will write to the SCU PCP register the request value. The method
* is used to suspend/resume ports, devices, and phys.
Expand Down Expand Up @@ -3461,23 +3552,22 @@ static enum sci_status scic_sds_controller_stopping_state_complete_io_handler(
* struct scic_sds_controller object.
* @remote_device: This is struct sci_base_remote_device which is cast to a
* struct scic_sds_remote_device object.
* @io_request: This is the struct sci_base_request which is cast to a
* SCIC_SDS_IO_REQUEST object.
*
* This method is called when the struct scic_sds_controller is in a stopping state
* and the complete task handler is called. - This function is not yet
* implemented enum sci_status SCI_FAILURE
*/

/*
* *****************************************************************************
* * STOPPED STATE HANDLERS
* ***************************************************************************** */

/*
* *****************************************************************************
* * FAILED STATE HANDLERS
* ***************************************************************************** */
* and the remote device has stopped.
**/
void scic_sds_controller_stopping_state_device_stopped_handler(
struct scic_sds_controller *controller,
struct scic_sds_remote_device *remote_device
)
{
if (!scic_sds_controller_has_remote_devices_stopping(controller)) {
sci_base_state_machine_change_state(
&controller->parent.state_machine,
SCI_BASE_CONTROLLER_STATE_STOPPED
);
}
}

const struct scic_sds_controller_state_handler scic_sds_controller_state_handler_table[] = {
[SCI_BASE_CONTROLLER_STATE_INITIAL] = {
Expand Down Expand Up @@ -3537,6 +3627,7 @@ const struct scic_sds_controller_state_handler scic_sds_controller_state_handler
.base.complete_io = scic_sds_controller_stopping_state_complete_io_handler,
.base.continue_io = scic_sds_controller_default_request_handler,
.terminate_request = scic_sds_controller_default_request_handler,
.remote_device_stopped_handler = scic_sds_controller_stopping_state_device_stopped_handler,
},
[SCI_BASE_CONTROLLER_STATE_STOPPED] = {
.base.reset = scic_sds_controller_general_reset_handler,
Expand Down
29 changes: 28 additions & 1 deletion trunk/drivers/scsi/isci/core/scic_sds_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ enum SCIC_SDS_CONTROLLER_MEMORY_DESCRIPTORS {
SCU_MAX_MDES
};


/**
*
*
Expand Down Expand Up @@ -390,6 +391,11 @@ struct scic_sds_controller {
typedef void (*scic_sds_controller_phy_handler_t)(struct scic_sds_controller *,
struct scic_sds_port *,
struct scic_sds_phy *);

typedef void (*scic_sds_controller_device_handler_t)(struct scic_sds_controller *,
struct scic_sds_remote_device *);


/**
* struct scic_sds_controller_state_handler -
*
Expand All @@ -402,6 +408,8 @@ struct scic_sds_controller_state_handler {
sci_base_controller_request_handler_t terminate_request;
scic_sds_controller_phy_handler_t link_up;
scic_sds_controller_phy_handler_t link_down;
scic_sds_controller_device_handler_t remote_device_started_handler;
scic_sds_controller_device_handler_t remote_device_stopped_handler;
};

extern const struct scic_sds_controller_state_handler
Expand Down Expand Up @@ -631,6 +639,23 @@ void scic_sds_controller_link_down(
struct scic_sds_port *the_port,
struct scic_sds_phy *the_phy);

/*
* *****************************************************************************
* * CORE CONTROLLER REMOTE DEVICE MESSAGE PROCESSING
* ***************************************************************************** */

bool scic_sds_controller_has_remote_devices_stopping(
struct scic_sds_controller *this_controller);

void scic_sds_controller_remote_device_started(
struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device);

void scic_sds_controller_remote_device_stopped(
struct scic_sds_controller *this_controller,
struct scic_sds_remote_device *the_device);


/*
* *****************************************************************************
* * CORE CONTROLLER PRIVATE METHODS
Expand Down Expand Up @@ -688,8 +713,10 @@ void scic_sds_controller_register_setup(
void scic_sds_controller_reset_hardware(
struct scic_sds_controller *this_controller);

enum sci_status scic_sds_controller_initialize_phy_startup(
struct scic_sds_controller *this_controller);

void scic_sds_controller_initialize_phy_startup(
void scic_sds_controller_build_memory_descriptor_table(
struct scic_sds_controller *this_controller);

#endif /* _SCIC_SDS_CONTROLLER_H_ */
Loading

0 comments on commit 08054e2

Please sign in to comment.