FreeBSD/sys/dev/isci/scil/scic_sds_phy.c
static
SCI_STATUS scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler(
   SCIC_SDS_PHY_T *this_phy,
   U32 event_code
)
{
   U32 result = SCI_SUCCESS;

   switch (scu_get_event_code(event_code))
   {
   case SCU_EVENT_SAS_PHY_DETECTED:
      // Why is this being reported again by the controller?
      // We would re-enter this state so just stay here
   break;

   case SCU_EVENT_SAS_15:
   case SCU_EVENT_SAS_15_SSC:
      scic_sds_phy_complete_link_training(
         this_phy, SCI_SAS_150_GB, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
      );
   break;

   case SCU_EVENT_SAS_30:
   case SCU_EVENT_SAS_30_SSC:
      scic_sds_phy_complete_link_training(
         this_phy, SCI_SAS_300_GB, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
      );
   break;

   case SCU_EVENT_SAS_60:
   case SCU_EVENT_SAS_60_SSC:
      scic_sds_phy_complete_link_training(
         this_phy, SCI_SAS_600_GB, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
      );
   break;

   case SCU_EVENT_SATA_SPINUP_HOLD:
      // We were doing SAS PHY link training and received a SATA PHY event
      // continue OOB/SN as if this were a SATA PHY
      scic_sds_phy_start_sata_link_training(this_phy);
   break;

   case SCU_EVENT_LINK_FAILURE:
      // Link failure change state back to the starting state
      scic_sds_phy_restart_starting_state(this_phy);
   break;

   default:
      SCIC_LOG_WARNING((
         sci_base_object_get_logger(this_phy),
         SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
         "PHY starting substate machine received unexpected event_code %x\n",
         event_code
      ));

      result = SCI_FAILURE;
   break;
   }

   return result;
}
/**
 * This method is called when an event notification is received for the phy
 * object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN.
 *    - decode the event
 *       - sas phy detected returns us back to this state.
 *       - speed event detected causes a state transition to the wait for iaf.
 *       - identify timeout is an un-expected event and the state machine is
 *         restarted.
 *       - link failure events restart the starting state machine
 *       - any other events log a warning message and set a failure status
 *
 * @param[in] phy This SCIC_SDS_PHY object which has received an event.
 * @param[in] event_code This is the event code which the phy object is to
 *       decode.
 *
 * @return SCI_STATUS
 * @retval SCI_SUCCESS on any valid event notification
 * @retval SCI_FAILURE on any unexpected event notifation
 */
This method is called when an event notification is received for the phy
object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN.
- decode the event
- sas phy detected returns us back to this state.
- speed event detected causes a state transition to the wait for iaf.
- identify timeout is an un-expected event and the state machine is
restarted.
- link failure events restart the starting state machine
- any other events log a warning message and set a failure status

@param[in] phy This SCIC_SDS_PHY object which has received an event.
@param[in] event_code This is the event code which the phy object is to
decode.

@return SCI_STATUS
@retval SCI_SUCCESS on any valid event notification
@retval SCI_FAILURE on any unexpected event notifation
This method is called when an event notification is received for the phy object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN . - decode the event - sas phy detected returns us back to this state . - speed event detected causes a state transition to the wait for iaf . - identify timeout is an un - expected event and the state machine is restarted . - link failure events restart the starting state machine - any other events log a warning message and set a failure status @param [ in ] phy This SCIC_SDS_PHY object which has received an event . @param [ in ] event_code This is the event code which the phy object is to decode . @return SCI_STATUS @retval SCI_SUCCESS on any valid event notification @retval SCI_FAILURE on any unexpected event notifation
static
SCI_STATUS scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler(
   SCIC_SDS_PHY_T *this_phy,
   U32 event_code
)
{
   U32 result = SCI_SUCCESS;
   switch (scu_get_event_code(event_code))
   {
   case SCU_EVENT_SAS_PHY_DETECTED:
   break;
   case SCU_EVENT_SAS_15:
   case SCU_EVENT_SAS_15_SSC:
      scic_sds_phy_complete_link_training(
         this_phy, SCI_SAS_150_GB, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
      );
   break;
   case SCU_EVENT_SAS_30:
   case SCU_EVENT_SAS_30_SSC:
      scic_sds_phy_complete_link_training(
         this_phy, SCI_SAS_300_GB, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
      );
   break;
   case SCU_EVENT_SAS_60:
   case SCU_EVENT_SAS_60_SSC:
      scic_sds_phy_complete_link_training(
         this_phy, SCI_SAS_600_GB, SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF
      );
   break;
   case SCU_EVENT_SATA_SPINUP_HOLD:
      scic_sds_phy_start_sata_link_training(this_phy);
   break;
   case SCU_EVENT_LINK_FAILURE:
      scic_sds_phy_restart_starting_state(this_phy);
   break;
   default:
      SCIC_LOG_WARNING((
         sci_base_object_get_logger(this_phy),
         SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
         "PHY starting substate machine received unexpected event_code %x\n",
         event_code
      ));
      result = SCI_FAILURE;
   break;
   }
   return result;
}
static SCI_STATUS scic_sds_phy_starting_substate_await_sas_phy_speed_event_handler ( SCIC_SDS_PHY_T * this_phy , U32 event_code ) { U32 result = SCI_SUCCESS ; switch ( scu_get_event_code ( event_code ) ) { case SCU_EVENT_SAS_PHY_DETECTED : break ; case SCU_EVENT_SAS_15 : case SCU_EVENT_SAS_15_SSC : scic_sds_phy_complete_link_training ( this_phy , SCI_SAS_150_GB , SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF ) ; break ; case SCU_EVENT_SAS_30 : case SCU_EVENT_SAS_30_SSC : scic_sds_phy_complete_link_training ( this_phy , SCI_SAS_300_GB , SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF ) ; break ; case SCU_EVENT_SAS_60 : case SCU_EVENT_SAS_60_SSC : scic_sds_phy_complete_link_training ( this_phy , SCI_SAS_600_GB , SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF ) ; break ; case SCU_EVENT_SATA_SPINUP_HOLD : scic_sds_phy_start_sata_link_training ( this_phy ) ; break ; case SCU_EVENT_LINK_FAILURE : scic_sds_phy_restart_starting_state ( this_phy ) ; break ; default : SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_phy ) , SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS , " \n " , event_code ) ) ; result = SCI_FAILURE ; break ; } return result ; }
This method is called when an event notification is received for the phy
 object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN.
This method is called when an event notification is received for the phy object when in the state SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SPEED_EN .
// Why is this being reported again by the controller? // We would re-enter this state so just stay here // We were doing SAS PHY link training and received a SATA PHY event // continue OOB/SN as if this were a SATA PHY // Link failure change state back to the starting state