Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 293034
b: refs/heads/master
c: d7a0ccd
h: refs/heads/master
v: v3
  • Loading branch information
Dan Williams authored and James Bottomley committed Feb 29, 2012
1 parent 0dd2f24 commit 69b5f6f
Show file tree
Hide file tree
Showing 11 changed files with 433 additions and 521 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: 16d3db1b298529e6aec4a4cf0f56225d9e0bc641
refs/heads/master: d7a0ccdd9bd78b5b74d2963ec7ab67c9d896902a
34 changes: 22 additions & 12 deletions trunk/drivers/scsi/isci/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@
#include "scu_event_codes.h"
#include "probe_roms.h"

#undef C
#define C(a) (#a)
static const char *phy_state_name(enum sci_phy_states state)
{
static const char * const strings[] = PHY_STATES;

return strings[state];
}
#undef C

/* Maximum arbitration wait time in micro-seconds */
#define SCIC_SDS_PHY_MAX_ARBITRATION_WAIT_TIME (700)

Expand Down Expand Up @@ -454,8 +464,8 @@ enum sci_status sci_phy_start(struct isci_phy *iphy)
enum sci_phy_states state = iphy->sm.current_state_id;

if (state != SCI_PHY_STOPPED) {
dev_dbg(sciphy_to_dev(iphy),
"%s: in wrong state: %d\n", __func__, state);
dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n",
__func__, phy_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}

Expand All @@ -480,8 +490,8 @@ enum sci_status sci_phy_stop(struct isci_phy *iphy)
case SCI_PHY_READY:
break;
default:
dev_dbg(sciphy_to_dev(iphy),
"%s: in wrong state: %d\n", __func__, state);
dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n",
__func__, phy_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}

Expand All @@ -494,8 +504,8 @@ enum sci_status sci_phy_reset(struct isci_phy *iphy)
enum sci_phy_states state = iphy->sm.current_state_id;

if (state != SCI_PHY_READY) {
dev_dbg(sciphy_to_dev(iphy),
"%s: in wrong state: %d\n", __func__, state);
dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n",
__func__, phy_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -544,8 +554,8 @@ enum sci_status sci_phy_consume_power_handler(struct isci_phy *iphy)
return SCI_SUCCESS;
}
default:
dev_dbg(sciphy_to_dev(iphy),
"%s: in wrong state: %d\n", __func__, state);
dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n",
__func__, phy_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand Down Expand Up @@ -870,8 +880,8 @@ enum sci_status sci_phy_event_handler(struct isci_phy *iphy, u32 event_code)
}
return SCI_SUCCESS;
default:
dev_dbg(sciphy_to_dev(iphy),
"%s: in wrong state: %d\n", __func__, state);
dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n",
__func__, phy_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand Down Expand Up @@ -964,8 +974,8 @@ enum sci_status sci_phy_frame_handler(struct isci_phy *iphy, u32 frame_index)
return result;
}
default:
dev_dbg(sciphy_to_dev(iphy),
"%s: in wrong state: %d\n", __func__, state);
dev_dbg(sciphy_to_dev(iphy), "%s: in wrong state: %s\n",
__func__, phy_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}

Expand Down
154 changes: 59 additions & 95 deletions trunk/drivers/scsi/isci/phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,101 +343,65 @@ enum sci_phy_counter_id {
SCIC_PHY_COUNTER_SN_DWORD_SYNC_ERROR
};

enum sci_phy_states {
/**
* Simply the initial state for the base domain state machine.
*/
SCI_PHY_INITIAL,

/**
* This state indicates that the phy has successfully been stopped.
* In this state no new IO operations are permitted on this phy.
* This state is entered from the INITIAL state.
* This state is entered from the STARTING state.
* This state is entered from the READY state.
* This state is entered from the RESETTING state.
*/
SCI_PHY_STOPPED,

/**
* This state indicates that the phy is in the process of becomming
* ready. In this state no new IO operations are permitted on this phy.
* This state is entered from the STOPPED state.
* This state is entered from the READY state.
* This state is entered from the RESETTING state.
*/
SCI_PHY_STARTING,

/**
* Initial state
*/
SCI_PHY_SUB_INITIAL,

/**
* Wait state for the hardware OSSP event type notification
*/
SCI_PHY_SUB_AWAIT_OSSP_EN,

/**
* Wait state for the PHY speed notification
*/
SCI_PHY_SUB_AWAIT_SAS_SPEED_EN,

/**
* Wait state for the IAF Unsolicited frame notification
*/
SCI_PHY_SUB_AWAIT_IAF_UF,

/**
* Wait state for the request to consume power
*/
SCI_PHY_SUB_AWAIT_SAS_POWER,

/**
* Wait state for request to consume power
*/
SCI_PHY_SUB_AWAIT_SATA_POWER,

/**
* Wait state for the SATA PHY notification
*/
SCI_PHY_SUB_AWAIT_SATA_PHY_EN,

/**
* Wait for the SATA PHY speed notification
*/
SCI_PHY_SUB_AWAIT_SATA_SPEED_EN,

/**
* Wait state for the SIGNATURE FIS unsolicited frame notification
*/
SCI_PHY_SUB_AWAIT_SIG_FIS_UF,

/**
* Exit state for this state machine
*/
SCI_PHY_SUB_FINAL,

/**
* This state indicates the the phy is now ready. Thus, the user
* is able to perform IO operations utilizing this phy as long as it
* is currently part of a valid port.
* This state is entered from the STARTING state.
*/
SCI_PHY_READY,

/**
* This state indicates that the phy is in the process of being reset.
* In this state no new IO operations are permitted on this phy.
* This state is entered from the READY state.
*/
SCI_PHY_RESETTING,

/**
* Simply the final state for the base phy state machine.
*/
SCI_PHY_FINAL,
};
/**
* enum sci_phy_states - phy state machine states
* @SCI_PHY_INITIAL: Simply the initial state for the base domain state
* machine.
* @SCI_PHY_STOPPED: phy has successfully been stopped. In this state
* no new IO operations are permitted on this phy.
* @SCI_PHY_STARTING: the phy is in the process of becomming ready. In
* this state no new IO operations are permitted on
* this phy.
* @SCI_PHY_SUB_INITIAL: Initial state
* @SCI_PHY_SUB_AWAIT_OSSP_EN: Wait state for the hardware OSSP event
* type notification
* @SCI_PHY_SUB_AWAIT_SAS_SPEED_EN: Wait state for the PHY speed
* notification
* @SCI_PHY_SUB_AWAIT_IAF_UF: Wait state for the IAF Unsolicited frame
* notification
* @SCI_PHY_SUB_AWAIT_SAS_POWER: Wait state for the request to consume
* power
* @SCI_PHY_SUB_AWAIT_SATA_POWER: Wait state for request to consume
* power
* @SCI_PHY_SUB_AWAIT_SATA_PHY_EN: Wait state for the SATA PHY
* notification
* @SCI_PHY_SUB_AWAIT_SATA_SPEED_EN: Wait for the SATA PHY speed
* notification
* @SCI_PHY_SUB_AWAIT_SIG_FIS_UF: Wait state for the SIGNATURE FIS
* unsolicited frame notification
* @SCI_PHY_SUB_FINAL: Exit state for this state machine
* @SCI_PHY_READY: phy is now ready. Thus, the user is able to perform
* IO operations utilizing this phy as long as it is
* currently part of a valid port. This state is
* entered from the STARTING state.
* @SCI_PHY_RESETTING: phy is in the process of being reset. In this
* state no new IO operations are permitted on this
* phy. This state is entered from the READY state.
* @SCI_PHY_FINAL: Simply the final state for the base phy state
* machine.
*/
#define PHY_STATES {\
C(PHY_INITIAL),\
C(PHY_STOPPED),\
C(PHY_STARTING),\
C(PHY_SUB_INITIAL),\
C(PHY_SUB_AWAIT_OSSP_EN),\
C(PHY_SUB_AWAIT_SAS_SPEED_EN),\
C(PHY_SUB_AWAIT_IAF_UF),\
C(PHY_SUB_AWAIT_SAS_POWER),\
C(PHY_SUB_AWAIT_SATA_POWER),\
C(PHY_SUB_AWAIT_SATA_PHY_EN),\
C(PHY_SUB_AWAIT_SATA_SPEED_EN),\
C(PHY_SUB_AWAIT_SIG_FIS_UF),\
C(PHY_SUB_FINAL),\
C(PHY_READY),\
C(PHY_RESETTING),\
C(PHY_FINAL),\
}
#undef C
#define C(a) SCI_##a
enum sci_phy_states PHY_STATES;
#undef C

void sci_phy_construct(
struct isci_phy *iphy,
Expand Down
46 changes: 28 additions & 18 deletions trunk/drivers/scsi/isci/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@
#define SCIC_SDS_PORT_HARD_RESET_TIMEOUT (1000)
#define SCU_DUMMY_INDEX (0xFFFF)

#undef C
#define C(a) (#a)
const char *port_state_name(enum sci_port_states state)
{
static const char * const strings[] = PORT_STATES;

return strings[state];
}
#undef C

static struct device *sciport_to_dev(struct isci_port *iport)
{
int i = iport->physical_port_index;
Expand Down Expand Up @@ -1054,8 +1064,8 @@ enum sci_status sci_port_start(struct isci_port *iport)

state = iport->sm.current_state_id;
if (state != SCI_PORT_STOPPED) {
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -1129,8 +1139,8 @@ enum sci_status sci_port_stop(struct isci_port *iport)
SCI_PORT_STOPPING);
return SCI_SUCCESS;
default:
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand All @@ -1144,8 +1154,8 @@ static enum sci_status sci_port_hard_reset(struct isci_port *iport, u32 timeout)

state = iport->sm.current_state_id;
if (state != SCI_PORT_SUB_OPERATIONAL) {
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}

Expand Down Expand Up @@ -1239,8 +1249,8 @@ enum sci_status sci_port_add_phy(struct isci_port *iport,
SCI_PORT_SUB_CONFIGURING);
return SCI_SUCCESS;
default:
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand Down Expand Up @@ -1289,8 +1299,8 @@ enum sci_status sci_port_remove_phy(struct isci_port *iport,
SCI_PORT_SUB_CONFIGURING);
return SCI_SUCCESS;
default:
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand Down Expand Up @@ -1332,8 +1342,8 @@ enum sci_status sci_port_link_up(struct isci_port *iport,
sci_port_general_link_up_handler(iport, iphy, PF_RESUME);
return SCI_SUCCESS;
default:
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand Down Expand Up @@ -1362,8 +1372,8 @@ enum sci_status sci_port_link_down(struct isci_port *iport,
sci_port_deactivate_phy(iport, iphy, false);
return SCI_SUCCESS;
default:
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand All @@ -1382,8 +1392,8 @@ enum sci_status sci_port_start_io(struct isci_port *iport,
iport->started_request_count++;
return SCI_SUCCESS;
default:
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
}
}
Expand All @@ -1397,8 +1407,8 @@ enum sci_status sci_port_complete_io(struct isci_port *iport,
state = iport->sm.current_state_id;
switch (state) {
case SCI_PORT_STOPPED:
dev_warn(sciport_to_dev(iport),
"%s: in wrong state: %d\n", __func__, state);
dev_warn(sciport_to_dev(iport), "%s: in wrong state: %s\n",
__func__, port_state_name(state));
return SCI_FAILURE_INVALID_STATE;
case SCI_PORT_STOPPING:
sci_port_decrement_request_count(iport);
Expand Down
Loading

0 comments on commit 69b5f6f

Please sign in to comment.