提交 85280955 编写于 作者: D Dan Williams

isci: unify isci_phy and scic_sds_phy

They are one in the same object so remove the distinction.  The near
duplicate fields (owning_port, and isci_port) will be cleaned up
after the scic_sds_port isci_port unification.
Reported-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NDan Williams <dan.j.williams@intel.com>
上级 5076a1a9
...@@ -311,7 +311,7 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc ...@@ -311,7 +311,7 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc
struct isci_host *ihost = scic_to_ihost(scic); struct isci_host *ihost = scic_to_ihost(scic);
struct scu_unsolicited_frame_header *frame_header; struct scu_unsolicited_frame_header *frame_header;
struct scic_sds_phy *phy; struct isci_phy *iphy;
struct scic_sds_remote_device *device; struct scic_sds_remote_device *device;
enum sci_status result = SCI_FAILURE; enum sci_status result = SCI_FAILURE;
...@@ -332,8 +332,8 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc ...@@ -332,8 +332,8 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc
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 = &ihost->phys[index].sci; iphy = &ihost->phys[index];
result = scic_sds_phy_frame_handler(phy, frame_index); result = scic_sds_phy_frame_handler(iphy, frame_index);
} else { } else {
index = SCU_GET_COMPLETION_INDEX(completion_entry); index = SCU_GET_COMPLETION_INDEX(completion_entry);
...@@ -344,8 +344,8 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc ...@@ -344,8 +344,8 @@ static void scic_sds_controller_unsolicited_frame(struct scic_sds_controller *sc
* 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 = &ihost->phys[index].sci; iphy = &ihost->phys[index];
result = scic_sds_phy_frame_handler(phy, frame_index); result = scic_sds_phy_frame_handler(iphy, frame_index);
} else { } else {
if (index < scic->remote_node_entries) if (index < scic->remote_node_entries)
device = scic->device_table[index]; device = scic->device_table[index];
...@@ -372,7 +372,7 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci ...@@ -372,7 +372,7 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci
struct isci_host *ihost = scic_to_ihost(scic); struct isci_host *ihost = scic_to_ihost(scic);
struct scic_sds_remote_device *device; struct scic_sds_remote_device *device;
struct isci_request *ireq; struct isci_request *ireq;
struct scic_sds_phy *phy; struct isci_phy *iphy;
u32 index; u32 index;
index = SCU_GET_COMPLETION_INDEX(completion_entry); index = SCU_GET_COMPLETION_INDEX(completion_entry);
...@@ -452,8 +452,8 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci ...@@ -452,8 +452,8 @@ static void scic_sds_controller_event_completion(struct scic_sds_controller *sci
* 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 = &ihost->phys[index].sci; iphy = &ihost->phys[index];
scic_sds_phy_event_handler(phy, completion_entry); scic_sds_phy_event_handler(iphy, completion_entry);
break; break;
case SCU_EVENT_TYPE_RNC_SUSPEND_TX: case SCU_EVENT_TYPE_RNC_SUSPEND_TX:
...@@ -862,11 +862,11 @@ static void scic_sds_controller_transition_to_ready( ...@@ -862,11 +862,11 @@ static void scic_sds_controller_transition_to_ready(
} }
} }
static bool is_phy_starting(struct scic_sds_phy *sci_phy) static bool is_phy_starting(struct isci_phy *iphy)
{ {
enum scic_sds_phy_states state; enum scic_sds_phy_states state;
state = sci_phy->sm.current_state_id; state = iphy->sm.current_state_id;
switch (state) { switch (state) {
case SCI_PHY_STARTING: case SCI_PHY_STARTING:
case SCI_PHY_SUB_INITIAL: case SCI_PHY_SUB_INITIAL:
...@@ -896,7 +896,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro ...@@ -896,7 +896,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
{ {
struct isci_host *ihost = scic_to_ihost(scic); struct isci_host *ihost = scic_to_ihost(scic);
struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1; struct scic_sds_oem_params *oem = &scic->oem_parameters.sds1;
struct scic_sds_phy *sci_phy; struct isci_phy *iphy;
enum sci_status status; enum sci_status status;
status = SCI_SUCCESS; status = SCI_SUCCESS;
...@@ -910,10 +910,10 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro ...@@ -910,10 +910,10 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
u8 index; u8 index;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
sci_phy = &ihost->phys[index].sci; iphy = &ihost->phys[index];
state = sci_phy->sm.current_state_id; state = iphy->sm.current_state_id;
if (!phy_get_non_dummy_port(sci_phy)) if (!phy_get_non_dummy_port(iphy))
continue; continue;
/* The controller start operation is complete iff: /* The controller start operation is complete iff:
...@@ -922,9 +922,9 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro ...@@ -922,9 +922,9 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
* - have an indication of a connected device and it has * - have an indication of a connected device and it has
* finished the link training process. * finished the link training process.
*/ */
if ((sci_phy->is_in_link_training == false && state == SCI_PHY_INITIAL) || if ((iphy->is_in_link_training == false && state == SCI_PHY_INITIAL) ||
(sci_phy->is_in_link_training == false && state == SCI_PHY_STOPPED) || (iphy->is_in_link_training == false && state == SCI_PHY_STOPPED) ||
(sci_phy->is_in_link_training == true && is_phy_starting(sci_phy))) { (iphy->is_in_link_training == true && is_phy_starting(iphy))) {
is_controller_start_complete = false; is_controller_start_complete = false;
break; break;
} }
...@@ -939,10 +939,10 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro ...@@ -939,10 +939,10 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
scic->phy_startup_timer_pending = false; scic->phy_startup_timer_pending = false;
} }
} else { } else {
sci_phy = &ihost->phys[scic->next_phy_to_start].sci; iphy = &ihost->phys[scic->next_phy_to_start];
if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) { if (oem->controller.mode_type == SCIC_PORT_MANUAL_CONFIGURATION_MODE) {
if (phy_get_non_dummy_port(sci_phy) == NULL) { if (phy_get_non_dummy_port(iphy) == NULL) {
scic->next_phy_to_start++; scic->next_phy_to_start++;
/* Caution recursion ahead be forwarned /* Caution recursion ahead be forwarned
...@@ -958,7 +958,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro ...@@ -958,7 +958,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
} }
} }
status = scic_sds_phy_start(sci_phy); status = scic_sds_phy_start(iphy);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
sci_mod_timer(&scic->phy_timer, sci_mod_timer(&scic->phy_timer,
...@@ -970,7 +970,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro ...@@ -970,7 +970,7 @@ static enum sci_status scic_sds_controller_start_next_phy(struct scic_sds_contro
"to stop phy %d because of status " "to stop phy %d because of status "
"%d.\n", "%d.\n",
__func__, __func__,
ihost->phys[scic->next_phy_to_start].sci.phy_index, ihost->phys[scic->next_phy_to_start].phy_index,
status); status);
} }
...@@ -1312,8 +1312,8 @@ void isci_host_deinit(struct isci_host *ihost) ...@@ -1312,8 +1312,8 @@ void isci_host_deinit(struct isci_host *ihost)
/* Cancel any/all outstanding phy timers */ /* Cancel any/all outstanding phy timers */
for (i = 0; i < SCI_MAX_PHYS; i++) { for (i = 0; i < SCI_MAX_PHYS; i++) {
struct scic_sds_phy *sci_phy = &ihost->phys[i].sci; struct isci_phy *iphy = &ihost->phys[i];
del_timer_sync(&sci_phy->sata_timer.timer); del_timer_sync(&iphy->sata_timer.timer);
} }
del_timer_sync(&ihost->sci.port_agent.timer.timer); del_timer_sync(&ihost->sci.port_agent.timer.timer);
...@@ -1527,7 +1527,7 @@ static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller ...@@ -1527,7 +1527,7 @@ static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller
status = SCI_SUCCESS; status = SCI_SUCCESS;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
phy_status = scic_sds_phy_stop(&ihost->phys[index].sci); phy_status = scic_sds_phy_stop(&ihost->phys[index]);
if (phy_status != SCI_SUCCESS && if (phy_status != SCI_SUCCESS &&
phy_status != SCI_FAILURE_INVALID_STATE) { phy_status != SCI_FAILURE_INVALID_STATE) {
...@@ -1537,7 +1537,7 @@ static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller ...@@ -1537,7 +1537,7 @@ static enum sci_status scic_sds_controller_stop_phys(struct scic_sds_controller
"%s: Controller stop operation failed to stop " "%s: Controller stop operation failed to stop "
"phy %d because of status %d.\n", "phy %d because of status %d.\n",
__func__, __func__,
ihost->phys[index].sci.phy_index, phy_status); ihost->phys[index].phy_index, phy_status);
} }
} }
...@@ -1786,7 +1786,7 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci ...@@ -1786,7 +1786,7 @@ static enum sci_status scic_controller_construct(struct scic_sds_controller *sci
/* Construct the phys for this controller */ /* Construct the phys for this controller */
for (i = 0; i < SCI_MAX_PHYS; i++) { for (i = 0; i < SCI_MAX_PHYS; i++) {
/* Add all the PHYs to the dummy port */ /* Add all the PHYs to the dummy port */
scic_sds_phy_construct(&ihost->phys[i].sci, scic_sds_phy_construct(&ihost->phys[i],
&ihost->ports[SCI_MAX_PORTS].sci, i); &ihost->ports[SCI_MAX_PORTS].sci, i);
} }
...@@ -1865,7 +1865,7 @@ static void power_control_timeout(unsigned long data) ...@@ -1865,7 +1865,7 @@ static void power_control_timeout(unsigned long data)
struct sci_timer *tmr = (struct sci_timer *)data; struct sci_timer *tmr = (struct sci_timer *)data;
struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), power_control.timer); struct scic_sds_controller *scic = container_of(tmr, typeof(*scic), power_control.timer);
struct isci_host *ihost = scic_to_ihost(scic); struct isci_host *ihost = scic_to_ihost(scic);
struct scic_sds_phy *sci_phy; struct isci_phy *iphy;
unsigned long flags; unsigned long flags;
u8 i; u8 i;
...@@ -1886,8 +1886,8 @@ static void power_control_timeout(unsigned long data) ...@@ -1886,8 +1886,8 @@ static void power_control_timeout(unsigned long data)
if (scic->power_control.phys_waiting == 0) if (scic->power_control.phys_waiting == 0)
break; break;
sci_phy = scic->power_control.requesters[i]; iphy = scic->power_control.requesters[i];
if (sci_phy == NULL) if (iphy == NULL)
continue; continue;
if (scic->power_control.phys_granted_power >= if (scic->power_control.phys_granted_power >=
...@@ -1897,7 +1897,7 @@ static void power_control_timeout(unsigned long data) ...@@ -1897,7 +1897,7 @@ static void power_control_timeout(unsigned long data)
scic->power_control.requesters[i] = NULL; scic->power_control.requesters[i] = NULL;
scic->power_control.phys_waiting--; scic->power_control.phys_waiting--;
scic->power_control.phys_granted_power++; scic->power_control.phys_granted_power++;
scic_sds_phy_consume_power_handler(sci_phy); scic_sds_phy_consume_power_handler(iphy);
} }
/* /*
...@@ -1919,14 +1919,14 @@ static void power_control_timeout(unsigned long data) ...@@ -1919,14 +1919,14 @@ static void power_control_timeout(unsigned long data)
*/ */
void scic_sds_controller_power_control_queue_insert( void scic_sds_controller_power_control_queue_insert(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_phy *sci_phy) struct isci_phy *iphy)
{ {
BUG_ON(sci_phy == NULL); BUG_ON(iphy == NULL);
if (scic->power_control.phys_granted_power < if (scic->power_control.phys_granted_power <
scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) { scic->oem_parameters.sds1.controller.max_concurrent_dev_spin_up) {
scic->power_control.phys_granted_power++; scic->power_control.phys_granted_power++;
scic_sds_phy_consume_power_handler(sci_phy); scic_sds_phy_consume_power_handler(iphy);
/* /*
* stop and start the power_control timer. When the timer fires, the * stop and start the power_control timer. When the timer fires, the
...@@ -1941,7 +1941,7 @@ void scic_sds_controller_power_control_queue_insert( ...@@ -1941,7 +1941,7 @@ void scic_sds_controller_power_control_queue_insert(
} else { } else {
/* Add the phy in the waiting list */ /* Add the phy in the waiting list */
scic->power_control.requesters[sci_phy->phy_index] = sci_phy; scic->power_control.requesters[iphy->phy_index] = iphy;
scic->power_control.phys_waiting++; scic->power_control.phys_waiting++;
} }
} }
...@@ -1954,15 +1954,15 @@ void scic_sds_controller_power_control_queue_insert( ...@@ -1954,15 +1954,15 @@ void scic_sds_controller_power_control_queue_insert(
*/ */
void scic_sds_controller_power_control_queue_remove( void scic_sds_controller_power_control_queue_remove(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_phy *sci_phy) struct isci_phy *iphy)
{ {
BUG_ON(sci_phy == NULL); BUG_ON(iphy == NULL);
if (scic->power_control.requesters[sci_phy->phy_index] != NULL) { if (scic->power_control.requesters[iphy->phy_index] != NULL) {
scic->power_control.phys_waiting--; scic->power_control.phys_waiting--;
} }
scic->power_control.requesters[sci_phy->phy_index] = NULL; scic->power_control.requesters[iphy->phy_index] = NULL;
} }
#define AFE_REGISTER_WRITE_DELAY 10 #define AFE_REGISTER_WRITE_DELAY 10
...@@ -2225,7 +2225,7 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc ...@@ -2225,7 +2225,7 @@ static enum sci_status scic_controller_initialize(struct scic_sds_controller *sc
* are accessed during the port initialization. * are accessed during the port initialization.
*/ */
for (i = 0; i < SCI_MAX_PHYS; i++) { for (i = 0; i < SCI_MAX_PHYS; i++) {
result = scic_sds_phy_initialize(&ihost->phys[i].sci, result = scic_sds_phy_initialize(&ihost->phys[i],
&scic->scu_registers->peg0.pe[i].tl, &scic->scu_registers->peg0.pe[i].tl,
&scic->scu_registers->peg0.pe[i].ll); &scic->scu_registers->peg0.pe[i].ll);
if (result != SCI_SUCCESS) if (result != SCI_SUCCESS)
...@@ -2484,43 +2484,43 @@ int isci_host_init(struct isci_host *isci_host) ...@@ -2484,43 +2484,43 @@ int isci_host_init(struct isci_host *isci_host)
} }
void scic_sds_controller_link_up(struct scic_sds_controller *scic, void scic_sds_controller_link_up(struct scic_sds_controller *scic,
struct scic_sds_port *port, struct scic_sds_phy *phy) struct scic_sds_port *port, struct isci_phy *iphy)
{ {
switch (scic->sm.current_state_id) { switch (scic->sm.current_state_id) {
case SCIC_STARTING: case SCIC_STARTING:
sci_del_timer(&scic->phy_timer); sci_del_timer(&scic->phy_timer);
scic->phy_startup_timer_pending = false; scic->phy_startup_timer_pending = false;
scic->port_agent.link_up_handler(scic, &scic->port_agent, scic->port_agent.link_up_handler(scic, &scic->port_agent,
port, phy); port, iphy);
scic_sds_controller_start_next_phy(scic); scic_sds_controller_start_next_phy(scic);
break; break;
case SCIC_READY: case SCIC_READY:
scic->port_agent.link_up_handler(scic, &scic->port_agent, scic->port_agent.link_up_handler(scic, &scic->port_agent,
port, phy); port, iphy);
break; break;
default: default:
dev_dbg(scic_to_dev(scic), dev_dbg(scic_to_dev(scic),
"%s: SCIC Controller linkup event from phy %d in " "%s: SCIC Controller linkup event from phy %d in "
"unexpected state %d\n", __func__, phy->phy_index, "unexpected state %d\n", __func__, iphy->phy_index,
scic->sm.current_state_id); scic->sm.current_state_id);
} }
} }
void scic_sds_controller_link_down(struct scic_sds_controller *scic, void scic_sds_controller_link_down(struct scic_sds_controller *scic,
struct scic_sds_port *port, struct scic_sds_phy *phy) struct scic_sds_port *port, struct isci_phy *iphy)
{ {
switch (scic->sm.current_state_id) { switch (scic->sm.current_state_id) {
case SCIC_STARTING: case SCIC_STARTING:
case SCIC_READY: case SCIC_READY:
scic->port_agent.link_down_handler(scic, &scic->port_agent, scic->port_agent.link_down_handler(scic, &scic->port_agent,
port, phy); port, iphy);
break; break;
default: default:
dev_dbg(scic_to_dev(scic), dev_dbg(scic_to_dev(scic),
"%s: SCIC Controller linkdown event from phy %d in " "%s: SCIC Controller linkdown event from phy %d in "
"unexpected state %d\n", "unexpected state %d\n",
__func__, __func__,
phy->phy_index, iphy->phy_index,
scic->sm.current_state_id); scic->sm.current_state_id);
} }
} }
......
...@@ -101,14 +101,14 @@ struct scic_power_control { ...@@ -101,14 +101,14 @@ struct scic_power_control {
* This field is an array of phys that we are waiting on. The phys are direct * This field is an array of phys that we are waiting on. The phys are direct
* mapped into requesters via struct scic_sds_phy.phy_index * mapped into requesters via struct scic_sds_phy.phy_index
*/ */
struct scic_sds_phy *requesters[SCI_MAX_PHYS]; struct isci_phy *requesters[SCI_MAX_PHYS];
}; };
struct scic_sds_port_configuration_agent; struct scic_sds_port_configuration_agent;
typedef void (*port_config_fn)(struct scic_sds_controller *, typedef void (*port_config_fn)(struct scic_sds_controller *,
struct scic_sds_port_configuration_agent *, struct scic_sds_port_configuration_agent *,
struct scic_sds_port *, struct scic_sds_phy *); struct scic_sds_port *, struct isci_phy *);
struct scic_sds_port_configuration_agent { struct scic_sds_port_configuration_agent {
u16 phy_configured_mask; u16 phy_configured_mask;
...@@ -523,9 +523,8 @@ static inline struct device *scic_to_dev(struct scic_sds_controller *scic) ...@@ -523,9 +523,8 @@ static inline struct device *scic_to_dev(struct scic_sds_controller *scic)
return &scic_to_ihost(scic)->pdev->dev; return &scic_to_ihost(scic)->pdev->dev;
} }
static inline struct device *sciphy_to_dev(struct scic_sds_phy *sci_phy) static inline struct device *sciphy_to_dev(struct isci_phy *iphy)
{ {
struct isci_phy *iphy = sci_phy_to_iphy(sci_phy);
if (!iphy || !iphy->isci_port || !iphy->isci_port->isci_host) if (!iphy || !iphy->isci_port || !iphy->isci_port->isci_host)
return NULL; return NULL;
...@@ -606,21 +605,21 @@ struct isci_request *scic_request_by_tag(struct scic_sds_controller *scic, ...@@ -606,21 +605,21 @@ struct isci_request *scic_request_by_tag(struct scic_sds_controller *scic,
void scic_sds_controller_power_control_queue_insert( void scic_sds_controller_power_control_queue_insert(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
void scic_sds_controller_power_control_queue_remove( void scic_sds_controller_power_control_queue_remove(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
void scic_sds_controller_link_up( void scic_sds_controller_link_up(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
void scic_sds_controller_link_down( void scic_sds_controller_link_down(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
void scic_sds_controller_remote_device_stopped( void scic_sds_controller_remote_device_stopped(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
...@@ -651,7 +650,7 @@ void isci_host_deinit( ...@@ -651,7 +650,7 @@ void isci_host_deinit(
void isci_host_port_link_up( void isci_host_port_link_up(
struct isci_host *, struct isci_host *,
struct scic_sds_port *, struct scic_sds_port *,
struct scic_sds_phy *); struct isci_phy *);
int isci_host_dev_found(struct domain_device *); int isci_host_dev_found(struct domain_device *);
void isci_host_remote_device_start_complete( void isci_host_remote_device_start_complete(
......
此差异已折叠。
...@@ -84,102 +84,40 @@ enum scic_sds_phy_protocol { ...@@ -84,102 +84,40 @@ enum scic_sds_phy_protocol {
}; };
/** /**
* struct scic_sds_phy - This structure contains or references all of the data * isci_phy - hba local phy infrastructure
* necessary to represent the core phy object and SCU harware protocol * @sm:
* engine. * @protocol: attached device protocol
* * @phy_index: physical index relative to the controller (0-3)
* * @bcn_received_while_port_unassigned: bcn to report after port association
* @sata_timer: timeout SATA signature FIS arrival
*/ */
struct scic_sds_phy { struct isci_phy {
/**
* This field contains the information for the base phy state machine.
*/
struct sci_base_state_machine sm; struct sci_base_state_machine sm;
/**
* This field specifies the port object that owns/contains this phy.
*/
struct scic_sds_port *owning_port; struct scic_sds_port *owning_port;
/**
* This field indicates whether the phy supports 1.5 Gb/s, 3.0 Gb/s,
* or 6.0 Gb/s operation.
*/
enum sas_linkrate max_negotiated_speed; enum sas_linkrate max_negotiated_speed;
/**
* This member specifies the protocol being utilized on this phy. This
* field contains a legitamite value once the PHY has link trained with
* a remote phy.
*/
enum scic_sds_phy_protocol protocol; enum scic_sds_phy_protocol protocol;
/**
* This field specifies the index with which this phy is associated (0-3).
*/
u8 phy_index; u8 phy_index;
/**
* This member indicates if this particular PHY has received a BCN while
* it had no port assignement. This BCN will be reported once the phy is
* assigned to a port.
*/
bool bcn_received_while_port_unassigned; bool bcn_received_while_port_unassigned;
/**
* This field indicates if this PHY is currently in the process of
* link training (i.e. it has started OOB, but has yet to perform
* IAF exchange/Signature FIS reception).
*/
bool is_in_link_training; bool is_in_link_training;
struct sci_timer sata_timer;
/**
* Timer to detect when a signature FIS timeout has occurred. The
* signature FIS is the first FIS sent by an attached SATA device
* after OOB/SN.
*/
struct sci_timer sata_timer;
/**
* This field is the pointer to the transport layer register for the SCU
* hardware.
*/
struct scu_transport_layer_registers __iomem *transport_layer_registers; struct scu_transport_layer_registers __iomem *transport_layer_registers;
/**
* This field points to the link layer register set within the SCU.
*/
struct scu_link_layer_registers __iomem *link_layer_registers; struct scu_link_layer_registers __iomem *link_layer_registers;
};
struct isci_phy {
struct scic_sds_phy sci;
struct asd_sas_phy sas_phy; struct asd_sas_phy sas_phy;
struct isci_port *isci_port; struct isci_port *isci_port;
u8 sas_addr[SAS_ADDR_SIZE]; u8 sas_addr[SAS_ADDR_SIZE];
union { union {
struct sas_identify_frame iaf; struct sas_identify_frame iaf;
struct dev_to_host_fis fis; struct dev_to_host_fis fis;
} frame_rcvd; } frame_rcvd;
}; };
static inline struct isci_phy *to_isci_phy(struct asd_sas_phy *sas_phy) static inline struct isci_phy *to_iphy(struct asd_sas_phy *sas_phy)
{ {
struct isci_phy *iphy = container_of(sas_phy, typeof(*iphy), sas_phy); struct isci_phy *iphy = container_of(sas_phy, typeof(*iphy), sas_phy);
return iphy; return iphy;
} }
static inline struct isci_phy *sci_phy_to_iphy(struct scic_sds_phy *sci_phy)
{
struct isci_phy *iphy = container_of(sci_phy, typeof(*iphy), sci);
return iphy;
}
struct scic_phy_cap { struct scic_phy_cap {
union { union {
struct { struct {
...@@ -520,61 +458,61 @@ enum scic_sds_phy_states { ...@@ -520,61 +458,61 @@ enum scic_sds_phy_states {
(scic_sds_port_get_controller((phy)->owning_port)) (scic_sds_port_get_controller((phy)->owning_port))
void scic_sds_phy_construct( void scic_sds_phy_construct(
struct scic_sds_phy *this_phy, struct isci_phy *iphy,
struct scic_sds_port *owning_port, struct scic_sds_port *owning_port,
u8 phy_index); u8 phy_index);
struct scic_sds_port *phy_get_non_dummy_port(struct scic_sds_phy *sci_phy); struct scic_sds_port *phy_get_non_dummy_port(struct isci_phy *iphy);
void scic_sds_phy_set_port( void scic_sds_phy_set_port(
struct scic_sds_phy *this_phy, struct isci_phy *iphy,
struct scic_sds_port *owning_port); struct scic_sds_port *owning_port);
enum sci_status scic_sds_phy_initialize( enum sci_status scic_sds_phy_initialize(
struct scic_sds_phy *this_phy, struct isci_phy *iphy,
struct scu_transport_layer_registers __iomem *transport_layer_registers, struct scu_transport_layer_registers __iomem *transport_layer_registers,
struct scu_link_layer_registers __iomem *link_layer_registers); struct scu_link_layer_registers __iomem *link_layer_registers);
enum sci_status scic_sds_phy_start( enum sci_status scic_sds_phy_start(
struct scic_sds_phy *this_phy); struct isci_phy *iphy);
enum sci_status scic_sds_phy_stop( enum sci_status scic_sds_phy_stop(
struct scic_sds_phy *this_phy); struct isci_phy *iphy);
enum sci_status scic_sds_phy_reset( enum sci_status scic_sds_phy_reset(
struct scic_sds_phy *this_phy); struct isci_phy *iphy);
void scic_sds_phy_resume( void scic_sds_phy_resume(
struct scic_sds_phy *this_phy); struct isci_phy *iphy);
void scic_sds_phy_setup_transport( void scic_sds_phy_setup_transport(
struct scic_sds_phy *this_phy, struct isci_phy *iphy,
u32 device_id); u32 device_id);
enum sci_status scic_sds_phy_event_handler( enum sci_status scic_sds_phy_event_handler(
struct scic_sds_phy *this_phy, struct isci_phy *iphy,
u32 event_code); u32 event_code);
enum sci_status scic_sds_phy_frame_handler( enum sci_status scic_sds_phy_frame_handler(
struct scic_sds_phy *this_phy, struct isci_phy *iphy,
u32 frame_index); u32 frame_index);
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 isci_phy *iphy);
void scic_sds_phy_get_sas_address( void scic_sds_phy_get_sas_address(
struct scic_sds_phy *this_phy, struct isci_phy *iphy,
struct sci_sas_address *sas_address); struct sci_sas_address *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 isci_phy *iphy,
struct sci_sas_address *sas_address); struct sci_sas_address *sas_address);
struct scic_phy_proto; struct scic_phy_proto;
void scic_sds_phy_get_protocols( void scic_sds_phy_get_protocols(
struct scic_sds_phy *sci_phy, struct isci_phy *iphy,
struct scic_phy_proto *protocols); struct scic_phy_proto *protocols);
enum sas_linkrate sci_phy_linkrate(struct scic_sds_phy *sci_phy); enum sas_linkrate sci_phy_linkrate(struct isci_phy *iphy);
struct isci_host; struct isci_host;
void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index); void isci_phy_init(struct isci_phy *iphy, struct isci_host *ihost, int index);
......
此差异已折叠。
...@@ -131,7 +131,7 @@ struct scic_sds_port { ...@@ -131,7 +131,7 @@ struct scic_sds_port {
/** /**
* This field is the table of phys assigned to the port. * This field is the table of phys assigned to the port.
*/ */
struct scic_sds_phy *phy_table[SCI_MAX_PHYS]; struct isci_phy *phy_table[SCI_MAX_PHYS];
/** /**
* This field is a pointer back to the controller that owns this * This field is a pointer back to the controller that owns this
...@@ -328,11 +328,11 @@ enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port); ...@@ -328,11 +328,11 @@ enum sci_status scic_sds_port_stop(struct scic_sds_port *sci_port);
enum sci_status scic_sds_port_add_phy( enum sci_status scic_sds_port_add_phy(
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
enum sci_status scic_sds_port_remove_phy( enum sci_status scic_sds_port_remove_phy(
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
void scic_sds_port_setup_transports( void scic_sds_port_setup_transports(
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
...@@ -342,17 +342,17 @@ void isci_port_bcn_enable(struct isci_host *, struct isci_port *); ...@@ -342,17 +342,17 @@ void isci_port_bcn_enable(struct isci_host *, struct isci_port *);
void scic_sds_port_deactivate_phy( void scic_sds_port_deactivate_phy(
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy, struct isci_phy *iphy,
bool do_notify_user); bool do_notify_user);
bool scic_sds_port_link_detected( bool scic_sds_port_link_detected(
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port, enum sci_status scic_sds_port_link_up(struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port, enum sci_status scic_sds_port_link_down(struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
struct isci_request; struct isci_request;
struct scic_sds_remote_device; struct scic_sds_remote_device;
...@@ -371,7 +371,7 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed( ...@@ -371,7 +371,7 @@ enum sas_linkrate scic_sds_port_get_max_allowed_speed(
void scic_sds_port_broadcast_change_received( void scic_sds_port_broadcast_change_received(
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy); struct isci_phy *iphy);
bool scic_sds_port_is_valid_phy_assignment( bool scic_sds_port_is_valid_phy_assignment(
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
......
...@@ -114,7 +114,7 @@ static s32 sci_sas_address_compare( ...@@ -114,7 +114,7 @@ static s32 sci_sas_address_compare(
*/ */
static struct scic_sds_port *scic_sds_port_configuration_agent_find_port( static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_phy *phy) struct isci_phy *iphy)
{ {
u8 i; u8 i;
struct sci_sas_address port_sas_address; struct sci_sas_address port_sas_address;
...@@ -127,8 +127,8 @@ static struct scic_sds_port *scic_sds_port_configuration_agent_find_port( ...@@ -127,8 +127,8 @@ static struct scic_sds_port *scic_sds_port_configuration_agent_find_port(
* more phys match the sent and received SAS address as this phy in which * more phys match the sent and received SAS address as this phy in which
* case it should participate in the same port. * case it should participate in the same port.
*/ */
scic_sds_phy_get_sas_address(phy, &phy_sas_address); scic_sds_phy_get_sas_address(iphy, &phy_sas_address);
scic_sds_phy_get_attached_sas_address(phy, &phy_attached_device_address); scic_sds_phy_get_attached_sas_address(iphy, &phy_attached_device_address);
for (i = 0; i < scic->logical_port_entries; i++) { for (i = 0; i < scic->logical_port_entries; i++) {
struct isci_host *ihost = scic_to_ihost(scic); struct isci_host *ihost = scic_to_ihost(scic);
...@@ -196,8 +196,8 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports( ...@@ -196,8 +196,8 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports(
* PE0 and PE3 can never have the same SAS Address unless they * PE0 and PE3 can never have the same SAS Address unless they
* are part of the same x4 wide port and we have already checked * are part of the same x4 wide port and we have already checked
* for this condition. */ * for this condition. */
scic_sds_phy_get_sas_address(&ihost->phys[0].sci, &first_address); scic_sds_phy_get_sas_address(&ihost->phys[0], &first_address);
scic_sds_phy_get_sas_address(&ihost->phys[3].sci, &second_address); scic_sds_phy_get_sas_address(&ihost->phys[3], &second_address);
if (sci_sas_address_compare(first_address, second_address) == 0) { if (sci_sas_address_compare(first_address, second_address) == 0) {
return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
...@@ -209,8 +209,8 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports( ...@@ -209,8 +209,8 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports(
* part of the same port. */ * part of the same port. */
if (port_agent->phy_valid_port_range[0].min_index == 0 && if (port_agent->phy_valid_port_range[0].min_index == 0 &&
port_agent->phy_valid_port_range[1].min_index == 1) { port_agent->phy_valid_port_range[1].min_index == 1) {
scic_sds_phy_get_sas_address(&ihost->phys[0].sci, &first_address); scic_sds_phy_get_sas_address(&ihost->phys[0], &first_address);
scic_sds_phy_get_sas_address(&ihost->phys[2].sci, &second_address); scic_sds_phy_get_sas_address(&ihost->phys[2], &second_address);
if (sci_sas_address_compare(first_address, second_address) == 0) { if (sci_sas_address_compare(first_address, second_address) == 0) {
return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
...@@ -223,8 +223,8 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports( ...@@ -223,8 +223,8 @@ static enum sci_status scic_sds_port_configuration_agent_validate_ports(
* part of the same port. */ * part of the same port. */
if (port_agent->phy_valid_port_range[2].min_index == 2 && if (port_agent->phy_valid_port_range[2].min_index == 2 &&
port_agent->phy_valid_port_range[3].min_index == 3) { port_agent->phy_valid_port_range[3].min_index == 3) {
scic_sds_phy_get_sas_address(&ihost->phys[1].sci, &first_address); scic_sds_phy_get_sas_address(&ihost->phys[1], &first_address);
scic_sds_phy_get_sas_address(&ihost->phys[3].sci, &second_address); scic_sds_phy_get_sas_address(&ihost->phys[3], &second_address);
if (sci_sas_address_compare(first_address, second_address) == 0) { if (sci_sas_address_compare(first_address, second_address) == 0) {
return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION; return SCI_FAILURE_UNSUPPORTED_PORT_CONFIGURATION;
...@@ -277,7 +277,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration( ...@@ -277,7 +277,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
for (phy_index = 0; phy_index < SCI_MAX_PHYS; phy_index++) { for (phy_index = 0; phy_index < SCI_MAX_PHYS; phy_index++) {
if ((phy_mask & (1 << phy_index)) == 0) if ((phy_mask & (1 << phy_index)) == 0)
continue; continue;
scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci, scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
&sas_address); &sas_address);
/* /*
...@@ -302,7 +302,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration( ...@@ -302,7 +302,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
while (phy_index < SCI_MAX_PHYS) { while (phy_index < SCI_MAX_PHYS) {
if ((phy_mask & (1 << phy_index)) == 0) if ((phy_mask & (1 << phy_index)) == 0)
continue; continue;
scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci, scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
&phy_assigned_address); &phy_assigned_address);
if (sci_sas_address_compare(sas_address, phy_assigned_address) != 0) { if (sci_sas_address_compare(sas_address, phy_assigned_address) != 0) {
...@@ -316,7 +316,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration( ...@@ -316,7 +316,7 @@ static enum sci_status scic_sds_mpc_agent_validate_phy_configuration(
port_agent->phy_valid_port_range[phy_index].max_index = phy_index; port_agent->phy_valid_port_range[phy_index].max_index = phy_index;
scic_sds_port_add_phy(&ihost->ports[port_index].sci, scic_sds_port_add_phy(&ihost->ports[port_index].sci,
&ihost->phys[phy_index].sci); &ihost->phys[phy_index]);
assigned_phy_mask |= (1 << phy_index); assigned_phy_mask |= (1 << phy_index);
} }
...@@ -352,12 +352,12 @@ static void mpc_agent_timeout(unsigned long data) ...@@ -352,12 +352,12 @@ static void mpc_agent_timeout(unsigned long data)
configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask; configure_phy_mask = ~port_agent->phy_configured_mask & port_agent->phy_ready_mask;
for (index = 0; index < SCI_MAX_PHYS; index++) { for (index = 0; index < SCI_MAX_PHYS; index++) {
struct scic_sds_phy *sci_phy = &ihost->phys[index].sci; struct isci_phy *iphy = &ihost->phys[index];
if (configure_phy_mask & (1 << index)) { if (configure_phy_mask & (1 << index)) {
port_agent->link_up_handler(scic, port_agent, port_agent->link_up_handler(scic, port_agent,
phy_get_non_dummy_port(sci_phy), phy_get_non_dummy_port(iphy),
sci_phy); iphy);
} }
} }
...@@ -365,37 +365,22 @@ static void mpc_agent_timeout(unsigned long data) ...@@ -365,37 +365,22 @@ static void mpc_agent_timeout(unsigned long data)
spin_unlock_irqrestore(&ihost->scic_lock, flags); spin_unlock_irqrestore(&ihost->scic_lock, flags);
} }
/** static void scic_sds_mpc_agent_link_up(struct scic_sds_controller *controller,
* struct scic_sds_port_configuration_agent *port_agent,
* @controller: This is the controller object that receives the link up struct scic_sds_port *port,
* notification. struct isci_phy *iphy)
* @port: This is the port object associated with the phy. If the is no
* associated port this is an NULL.
* @phy: This is the phy object which has gone ready.
*
* This method handles the manual port configuration link up notifications.
* Since all ports and phys are associate at initialization time we just turn
* around and notifiy the port object that there is a link up. If this PHY is
* not associated with a port there is no action taken. Is it possible to get a
* link up notification from a phy that has no assocoated port?
*/
static void scic_sds_mpc_agent_link_up(
struct scic_sds_controller *controller,
struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *port,
struct scic_sds_phy *phy)
{ {
/* /* If the port has an invalid handle then the phy was not assigned to
* If the port has an invalid handle then the phy was not assigned to
* a port. This is because the phy was not given the same SAS Address * a port. This is because the phy was not given the same SAS Address
* as the other PHYs in the port. */ * as the other PHYs in the port.
*/
if (port != NULL) { if (port != NULL) {
port_agent->phy_ready_mask |= (1 << scic_sds_phy_get_index(phy)); port_agent->phy_ready_mask |= (1 << scic_sds_phy_get_index(iphy));
scic_sds_port_link_up(port, phy); scic_sds_port_link_up(port, iphy);
if ((port->active_phy_mask & (1 << scic_sds_phy_get_index(phy))) != 0) { if ((port->active_phy_mask & (1 << scic_sds_phy_get_index(iphy))) != 0) {
port_agent->phy_configured_mask |= (1 << scic_sds_phy_get_index(phy)); port_agent->phy_configured_mask |= (1 << scic_sds_phy_get_index(iphy));
} }
} }
} }
...@@ -421,7 +406,7 @@ static void scic_sds_mpc_agent_link_down( ...@@ -421,7 +406,7 @@ static void scic_sds_mpc_agent_link_down(
struct scic_sds_controller *scic, struct scic_sds_controller *scic,
struct scic_sds_port_configuration_agent *port_agent, struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy) struct isci_phy *iphy)
{ {
if (sci_port != NULL) { if (sci_port != NULL) {
/* /*
...@@ -432,9 +417,9 @@ static void scic_sds_mpc_agent_link_down( ...@@ -432,9 +417,9 @@ static void scic_sds_mpc_agent_link_down(
* state. * state.
*/ */
port_agent->phy_ready_mask &= port_agent->phy_ready_mask &=
~(1 << scic_sds_phy_get_index(sci_phy)); ~(1 << scic_sds_phy_get_index(iphy));
port_agent->phy_configured_mask &= port_agent->phy_configured_mask &=
~(1 << scic_sds_phy_get_index(sci_phy)); ~(1 << scic_sds_phy_get_index(iphy));
/* /*
* Check to see if there are more phys waiting to be * Check to see if there are more phys waiting to be
...@@ -451,7 +436,7 @@ static void scic_sds_mpc_agent_link_down( ...@@ -451,7 +436,7 @@ static void scic_sds_mpc_agent_link_down(
SCIC_SDS_MPC_RECONFIGURATION_TIMEOUT); SCIC_SDS_MPC_RECONFIGURATION_TIMEOUT);
} }
scic_sds_port_link_down(sci_port, sci_phy); scic_sds_port_link_down(sci_port, iphy);
} }
} }
...@@ -482,11 +467,11 @@ static enum sci_status scic_sds_apc_agent_validate_phy_configuration( ...@@ -482,11 +467,11 @@ static enum sci_status scic_sds_apc_agent_validate_phy_configuration(
port_index = phy_index; port_index = phy_index;
/* Get the assigned SAS Address for the first PHY on the controller. */ /* Get the assigned SAS Address for the first PHY on the controller. */
scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci, scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
&sas_address); &sas_address);
while (++phy_index < SCI_MAX_PHYS) { while (++phy_index < SCI_MAX_PHYS) {
scic_sds_phy_get_sas_address(&ihost->phys[phy_index].sci, scic_sds_phy_get_sas_address(&ihost->phys[phy_index],
&phy_assigned_address); &phy_assigned_address);
/* Verify each of the SAS address are all the same for every PHY */ /* Verify each of the SAS address are all the same for every PHY */
...@@ -504,20 +489,10 @@ static enum sci_status scic_sds_apc_agent_validate_phy_configuration( ...@@ -504,20 +489,10 @@ static enum sci_status scic_sds_apc_agent_validate_phy_configuration(
return scic_sds_port_configuration_agent_validate_ports(controller, port_agent); return scic_sds_port_configuration_agent_validate_ports(controller, port_agent);
} }
/** static void scic_sds_apc_agent_configure_ports(struct scic_sds_controller *controller,
* struct scic_sds_port_configuration_agent *port_agent,
* @controller: This is the controller object that receives the link up struct isci_phy *iphy,
* notification. bool start_timer)
* @phy: This is the phy object which has gone link up.
*
* This method handles the automatic port configuration for link up
* notifications.
*/
static void scic_sds_apc_agent_configure_ports(
struct scic_sds_controller *controller,
struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_phy *phy,
bool start_timer)
{ {
u8 port_index; u8 port_index;
enum sci_status status; enum sci_status status;
...@@ -525,10 +500,10 @@ static void scic_sds_apc_agent_configure_ports( ...@@ -525,10 +500,10 @@ static void scic_sds_apc_agent_configure_ports(
enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY; enum SCIC_SDS_APC_ACTIVITY apc_activity = SCIC_SDS_APC_SKIP_PHY;
struct isci_host *ihost = scic_to_ihost(controller); struct isci_host *ihost = scic_to_ihost(controller);
port = scic_sds_port_configuration_agent_find_port(controller, phy); port = scic_sds_port_configuration_agent_find_port(controller, iphy);
if (port != NULL) { if (port != NULL) {
if (scic_sds_port_is_valid_phy_assignment(port, phy->phy_index)) if (scic_sds_port_is_valid_phy_assignment(port, iphy->phy_index))
apc_activity = SCIC_SDS_APC_ADD_PHY; apc_activity = SCIC_SDS_APC_ADD_PHY;
else else
apc_activity = SCIC_SDS_APC_SKIP_PHY; apc_activity = SCIC_SDS_APC_SKIP_PHY;
...@@ -540,20 +515,20 @@ static void scic_sds_apc_agent_configure_ports( ...@@ -540,20 +515,20 @@ static void scic_sds_apc_agent_configure_ports(
* *
* Note the break when we reach the condition of the port id == phy id */ * Note the break when we reach the condition of the port id == phy id */
for ( for (
port_index = port_agent->phy_valid_port_range[phy->phy_index].min_index; port_index = port_agent->phy_valid_port_range[iphy->phy_index].min_index;
port_index <= port_agent->phy_valid_port_range[phy->phy_index].max_index; port_index <= port_agent->phy_valid_port_range[iphy->phy_index].max_index;
port_index++ port_index++
) { ) {
port = &ihost->ports[port_index].sci; port = &ihost->ports[port_index].sci;
/* First we must make sure that this PHY can be added to this Port. */ /* First we must make sure that this PHY can be added to this Port. */
if (scic_sds_port_is_valid_phy_assignment(port, phy->phy_index)) { if (scic_sds_port_is_valid_phy_assignment(port, iphy->phy_index)) {
/* /*
* Port contains a PHY with a greater PHY ID than the current * Port contains a PHY with a greater PHY ID than the current
* PHY that has gone link up. This phy can not be part of any * PHY that has gone link up. This phy can not be part of any
* port so skip it and move on. */ * port so skip it and move on. */
if (port->active_phy_mask > (1 << phy->phy_index)) { if (port->active_phy_mask > (1 << iphy->phy_index)) {
apc_activity = SCIC_SDS_APC_SKIP_PHY; apc_activity = SCIC_SDS_APC_SKIP_PHY;
break; break;
} }
...@@ -562,7 +537,7 @@ static void scic_sds_apc_agent_configure_ports( ...@@ -562,7 +537,7 @@ static void scic_sds_apc_agent_configure_ports(
* We have reached the end of our Port list and have not found * We have reached the end of our Port list and have not found
* any reason why we should not either add the PHY to the port * any reason why we should not either add the PHY to the port
* or wait for more phys to become active. */ * or wait for more phys to become active. */
if (port->physical_port_index == phy->phy_index) { if (port->physical_port_index == iphy->phy_index) {
/* /*
* The Port either has no active PHYs. * The Port either has no active PHYs.
* Consider that if the port had any active PHYs we would have * Consider that if the port had any active PHYs we would have
...@@ -608,10 +583,10 @@ static void scic_sds_apc_agent_configure_ports( ...@@ -608,10 +583,10 @@ static void scic_sds_apc_agent_configure_ports(
switch (apc_activity) { switch (apc_activity) {
case SCIC_SDS_APC_ADD_PHY: case SCIC_SDS_APC_ADD_PHY:
status = scic_sds_port_add_phy(port, phy); status = scic_sds_port_add_phy(port, iphy);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
port_agent->phy_configured_mask |= (1 << phy->phy_index); port_agent->phy_configured_mask |= (1 << iphy->phy_index);
} }
break; break;
...@@ -651,14 +626,14 @@ static void scic_sds_apc_agent_configure_ports( ...@@ -651,14 +626,14 @@ static void scic_sds_apc_agent_configure_ports(
static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic, static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
struct scic_sds_port_configuration_agent *port_agent, struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *sci_port, struct scic_sds_port *sci_port,
struct scic_sds_phy *sci_phy) struct isci_phy *iphy)
{ {
u8 phy_index = sci_phy->phy_index; u8 phy_index = iphy->phy_index;
if (!sci_port) { if (!sci_port) {
/* the phy is not the part of this port */ /* the phy is not the part of this port */
port_agent->phy_ready_mask |= 1 << phy_index; port_agent->phy_ready_mask |= 1 << phy_index;
scic_sds_apc_agent_configure_ports(scic, port_agent, sci_phy, true); scic_sds_apc_agent_configure_ports(scic, port_agent, iphy, true);
} else { } else {
/* the phy is already the part of the port */ /* the phy is already the part of the port */
u32 port_state = sci_port->sm.current_state_id; u32 port_state = sci_port->sm.current_state_id;
...@@ -669,7 +644,7 @@ static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic, ...@@ -669,7 +644,7 @@ static void scic_sds_apc_agent_link_up(struct scic_sds_controller *scic,
*/ */
BUG_ON(port_state != SCI_PORT_RESETTING); BUG_ON(port_state != SCI_PORT_RESETTING);
port_agent->phy_ready_mask |= 1 << phy_index; port_agent->phy_ready_mask |= 1 << phy_index;
scic_sds_port_link_up(sci_port, sci_phy); scic_sds_port_link_up(sci_port, iphy);
} }
} }
...@@ -690,18 +665,18 @@ static void scic_sds_apc_agent_link_down( ...@@ -690,18 +665,18 @@ static void scic_sds_apc_agent_link_down(
struct scic_sds_controller *controller, struct scic_sds_controller *controller,
struct scic_sds_port_configuration_agent *port_agent, struct scic_sds_port_configuration_agent *port_agent,
struct scic_sds_port *port, struct scic_sds_port *port,
struct scic_sds_phy *phy) struct isci_phy *iphy)
{ {
port_agent->phy_ready_mask &= ~(1 << scic_sds_phy_get_index(phy)); port_agent->phy_ready_mask &= ~(1 << scic_sds_phy_get_index(iphy));
if (port != NULL) { if (port != NULL) {
if (port_agent->phy_configured_mask & (1 << phy->phy_index)) { if (port_agent->phy_configured_mask & (1 << iphy->phy_index)) {
enum sci_status status; enum sci_status status;
status = scic_sds_port_remove_phy(port, phy); status = scic_sds_port_remove_phy(port, iphy);
if (status == SCI_SUCCESS) { if (status == SCI_SUCCESS) {
port_agent->phy_configured_mask &= ~(1 << phy->phy_index); port_agent->phy_configured_mask &= ~(1 << iphy->phy_index);
} }
} }
} }
...@@ -739,7 +714,7 @@ static void apc_agent_timeout(unsigned long data) ...@@ -739,7 +714,7 @@ static void apc_agent_timeout(unsigned long data)
continue; continue;
scic_sds_apc_agent_configure_ports(scic, port_agent, scic_sds_apc_agent_configure_ports(scic, port_agent,
&ihost->phys[index].sci, false); &ihost->phys[index], false);
} }
done: done:
......
...@@ -1389,7 +1389,7 @@ int isci_remote_device_found(struct domain_device *domain_dev) ...@@ -1389,7 +1389,7 @@ int isci_remote_device_found(struct domain_device *domain_dev)
sas_port = domain_dev->port; sas_port = domain_dev->port;
sas_phy = list_first_entry(&sas_port->phy_list, struct asd_sas_phy, sas_phy = list_first_entry(&sas_port->phy_list, struct asd_sas_phy,
port_phy_el); port_phy_el);
isci_phy = to_isci_phy(sas_phy); isci_phy = to_iphy(sas_phy);
isci_port = isci_phy->isci_port; isci_port = isci_phy->isci_port;
/* we are being called for a device on this port, /* we are being called for a device on this port,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册