FreeBSD/sys/dev/isci/scil/scic_sds_phy.c
/**
 * This method request the SCIC_SDS_PHY handle the received event.  The only
 * event that we are interested in while in the ready state is the link
 * failure event.
 *    - decoded event is a link failure
 *       - transition the SCIC_SDS_PHY back to the SCI_BASE_PHY_STATE_STARTING
 *         state.
 *    - any other event received will report a warning message
 *
 * @param[in] phy This is the SCIC_SDS_PHY object which has received the
 *       event.
 *
 * @return SCI_STATUS
 * @retval SCI_SUCCESS if the event received is a link failure
 * @retval SCI_FAILURE_INVALID_STATE for any other event received.
 */
This method request the SCIC_SDS_PHY handle the received event.  The only
event that we are interested in while in the ready state is the link
failure event.
- decoded event is a link failure
- transition the SCIC_SDS_PHY back to the SCI_BASE_PHY_STATE_STARTING
state.
- any other event received will report a warning message

@param[in] phy This is the SCIC_SDS_PHY object which has received the
event.

@return SCI_STATUS
@retval SCI_SUCCESS if the event received is a link failure
@retval SCI_FAILURE_INVALID_STATE for any other event received.
This method request the SCIC_SDS_PHY handle the received event . The only event that we are interested in while in the ready state is the link failure event . - decoded event is a link failure - transition the SCIC_SDS_PHY back to the SCI_BASE_PHY_STATE_STARTING state . - any other event received will report a warning message @param [ in ] phy This is the SCIC_SDS_PHY object which has received the event . @return SCI_STATUS @retval SCI_SUCCESS if the event received is a link failure @retval SCI_FAILURE_INVALID_STATE for any other event received .
static
SCI_STATUS scic_sds_phy_ready_state_event_handler(
   SCIC_SDS_PHY_T *this_phy,
   U32            event_code
)
{
   SCI_STATUS result = SCI_FAILURE;
   switch (scu_get_event_code(event_code))
   {
   case SCU_EVENT_LINK_FAILURE:
      sci_base_state_machine_change_state(
         scic_sds_phy_get_base_state_machine(this_phy),
         SCI_BASE_PHY_STATE_STARTING
         );
      result = SCI_SUCCESS;
      break;
   case SCU_EVENT_BROADCAST_CHANGE:
      if (scic_sds_phy_get_port(this_phy) != SCI_INVALID_HANDLE)
         scic_sds_port_broadcast_change_received(this_phy->owning_port, this_phy);
      else
         this_phy->bcn_received_while_port_unassigned = TRUE;
      break;
   case SCU_EVENT_ERR_CNT(RX_CREDIT_BLOCKED_RECEIVED):
   case SCU_EVENT_ERR_CNT(TX_DONE_CREDIT_TIMEOUT):
   case SCU_EVENT_ERR_CNT(RX_DONE_CREDIT_TIMEOUT):
   case SCU_EVENT_ERR_CNT(INACTIVITY_TIMER_EXPIRED):
   case SCU_EVENT_ERR_CNT(TX_DONE_ACK_NAK_TIMEOUT):
   case SCU_EVENT_ERR_CNT(RX_DONE_ACK_NAK_TIMEOUT):
      {
         U32 error_counter_index =
                scu_get_event_specifier(event_code) >> SCU_EVENT_SPECIFIC_CODE_SHIFT;
         this_phy->error_counter[error_counter_index]++;
         result = SCI_SUCCESS;
      }
      break;
   default:
      SCIC_LOG_WARNING((
         sci_base_object_get_logger(this_phy),
         SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS,
         "SCIC PHY 0x%x ready state machine received unexpected event_code %x\n",
         this_phy, event_code
      ));
      result = SCI_FAILURE_INVALID_STATE;
      break;
   }
   return result;
}
static SCI_STATUS scic_sds_phy_ready_state_event_handler ( SCIC_SDS_PHY_T * this_phy , U32 event_code ) { SCI_STATUS result = SCI_FAILURE ; switch ( scu_get_event_code ( event_code ) ) { case SCU_EVENT_LINK_FAILURE : sci_base_state_machine_change_state ( scic_sds_phy_get_base_state_machine ( this_phy ) , SCI_BASE_PHY_STATE_STARTING ) ; result = SCI_SUCCESS ; break ; case SCU_EVENT_BROADCAST_CHANGE : if ( scic_sds_phy_get_port ( this_phy ) != SCI_INVALID_HANDLE ) scic_sds_port_broadcast_change_received ( this_phy -> owning_port , this_phy ) ; else this_phy -> bcn_received_while_port_unassigned = TRUE ; break ; case SCU_EVENT_ERR_CNT ( RX_CREDIT_BLOCKED_RECEIVED ) : case SCU_EVENT_ERR_CNT ( TX_DONE_CREDIT_TIMEOUT ) : case SCU_EVENT_ERR_CNT ( RX_DONE_CREDIT_TIMEOUT ) : case SCU_EVENT_ERR_CNT ( INACTIVITY_TIMER_EXPIRED ) : case SCU_EVENT_ERR_CNT ( TX_DONE_ACK_NAK_TIMEOUT ) : case SCU_EVENT_ERR_CNT ( RX_DONE_ACK_NAK_TIMEOUT ) : { U32 error_counter_index = scu_get_event_specifier ( event_code ) >> SCU_EVENT_SPECIFIC_CODE_SHIFT ; this_phy -> error_counter [ error_counter_index ] ++ ; result = SCI_SUCCESS ; } break ; default : SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_phy ) , SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_RECEIVED_EVENTS , " \n " , this_phy , event_code ) ) ; result = SCI_FAILURE_INVALID_STATE ; break ; } return result ; }
This method request the SCIC_SDS_PHY handle the received event.
This method request the SCIC_SDS_PHY handle the received event .
// Link failure change state back to the starting state // Broadcast change received. Notify the port.