FreeBSD/sys/dev/isci/scil/scic_sds_phy.c
/**
 * This method decodes the unsolicited frame when the SCIC_SDS_PHY is in the
 * SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF.
 *    - Get the UF Header
 *    - If the UF is an IAF
 *       - Copy IAF data to local phy object IAF data buffer.
 *       - Change starting substate to wait power.
 *    - else
 *       - log warning message of unexpected unsolicted frame
 *    - release frame buffer
 *
 * @param[in] phy This is SCIC_SDS_PHY object which is being requested to
 *       decode the frame data.
 * @param[in] frame_index This is the index of the unsolicited frame which was
 *       received for this phy.
 *
 * @return SCI_STATUS
 * @retval SCI_SUCCESS
 */
This method decodes the unsolicited frame when the SCIC_SDS_PHY is in the
SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF.
- Get the UF Header
- If the UF is an IAF
- Copy IAF data to local phy object IAF data buffer.
- Change starting substate to wait power.
- else
- log warning message of unexpected unsolicted frame
- release frame buffer

@param[in] phy This is SCIC_SDS_PHY object which is being requested to
decode the frame data.
@param[in] frame_index This is the index of the unsolicited frame which was
received for this phy.


This method decodes the unsolicited frame when the SCIC_SDS_PHY is in the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF . - Get the UF Header - If the UF is an IAF - Copy IAF data to local phy object IAF data buffer . - Change starting substate to wait power . - else - log warning message of unexpected unsolicted frame - release frame buffer @param [ in ] phy This is SCIC_SDS_PHY object which is being requested to decode the frame data . @param [ in ] frame_index This is the index of the unsolicited frame which was received for this phy .
static
SCI_STATUS scic_sds_phy_starting_substate_await_iaf_uf_frame_handler(
   SCIC_SDS_PHY_T *this_phy,
   U32            frame_index
)
{
   SCI_STATUS                        result;
   U32                              *frame_words;
   SCI_SAS_IDENTIFY_ADDRESS_FRAME_T *identify_frame;
   result = scic_sds_unsolicited_frame_control_get_header(
               &(scic_sds_phy_get_controller(this_phy)->uf_control),
               frame_index,
               (void **)&frame_words);
   if (result != SCI_SUCCESS)
   {
      return result;
   }
   frame_words[0] = SCIC_SWAP_DWORD(frame_words[0]);
   identify_frame = (SCI_SAS_IDENTIFY_ADDRESS_FRAME_T *)frame_words;
   if (identify_frame->address_frame_type == 0)
   {
      frame_words[1] = SCIC_SWAP_DWORD(frame_words[1]);
      frame_words[2] = SCIC_SWAP_DWORD(frame_words[2]);
      frame_words[3] = SCIC_SWAP_DWORD(frame_words[3]);
      frame_words[4] = SCIC_SWAP_DWORD(frame_words[4]);
      frame_words[5] = SCIC_SWAP_DWORD(frame_words[5]);
      memcpy(
         &this_phy->phy_type.sas.identify_address_frame_buffer,
         identify_frame,
         sizeof(SCI_SAS_IDENTIFY_ADDRESS_FRAME_T)
      );
      if (identify_frame->protocols.u.bits.smp_target)
      {
         sci_base_state_machine_change_state(
            scic_sds_phy_get_starting_substate_machine(this_phy),
            SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL
         );
      }
      else
      {
         sci_base_state_machine_change_state(
            scic_sds_phy_get_starting_substate_machine(this_phy),
            SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER
         );
      }
      result = SCI_SUCCESS;
   }
   else
   {
      SCIC_LOG_WARNING((
         sci_base_object_get_logger(this_phy),
         SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_UNSOLICITED_FRAMES,
         "PHY starting substate machine received unexpected frame id %x\n",
         frame_index
      ));
   }
   scic_sds_controller_release_frame(
      scic_sds_phy_get_controller(this_phy), frame_index
      );
   return result;
}
static SCI_STATUS scic_sds_phy_starting_substate_await_iaf_uf_frame_handler ( SCIC_SDS_PHY_T * this_phy , U32 frame_index ) { SCI_STATUS result ; U32 * frame_words ; SCI_SAS_IDENTIFY_ADDRESS_FRAME_T * identify_frame ; result = scic_sds_unsolicited_frame_control_get_header ( & ( scic_sds_phy_get_controller ( this_phy ) -> uf_control ) , frame_index , ( void * * ) & frame_words ) ; if ( result != SCI_SUCCESS ) { return result ; } frame_words [ 0 ] = SCIC_SWAP_DWORD ( frame_words [ 0 ] ) ; identify_frame = ( SCI_SAS_IDENTIFY_ADDRESS_FRAME_T * ) frame_words ; if ( identify_frame -> address_frame_type == 0 ) { frame_words [ 1 ] = SCIC_SWAP_DWORD ( frame_words [ 1 ] ) ; frame_words [ 2 ] = SCIC_SWAP_DWORD ( frame_words [ 2 ] ) ; frame_words [ 3 ] = SCIC_SWAP_DWORD ( frame_words [ 3 ] ) ; frame_words [ 4 ] = SCIC_SWAP_DWORD ( frame_words [ 4 ] ) ; frame_words [ 5 ] = SCIC_SWAP_DWORD ( frame_words [ 5 ] ) ; memcpy ( & this_phy -> phy_type . sas . identify_address_frame_buffer , identify_frame , sizeof ( SCI_SAS_IDENTIFY_ADDRESS_FRAME_T ) ) ; if ( identify_frame -> protocols . u . bits . smp_target ) { sci_base_state_machine_change_state ( scic_sds_phy_get_starting_substate_machine ( this_phy ) , SCIC_SDS_PHY_STARTING_SUBSTATE_FINAL ) ; } else { sci_base_state_machine_change_state ( scic_sds_phy_get_starting_substate_machine ( this_phy ) , SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_SAS_POWER ) ; } result = SCI_SUCCESS ; } else { SCIC_LOG_WARNING ( ( sci_base_object_get_logger ( this_phy ) , SCIC_LOG_OBJECT_PHY | SCIC_LOG_OBJECT_UNSOLICITED_FRAMES , " \n " , frame_index ) ) ; } scic_sds_controller_release_frame ( scic_sds_phy_get_controller ( this_phy ) , frame_index ) ; return result ; }
This method decodes the unsolicited frame when the SCIC_SDS_PHY is in the
 SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF.
This method decodes the unsolicited frame when the SCIC_SDS_PHY is in the SCIC_SDS_PHY_STARTING_SUBSTATE_AWAIT_IAF_UF .
// Byte swap the rest of the frame so we can make // a copy of the buffer // We got the IAF for an expander PHY go to the final state since // there are no power requirements for expander phys. // We got the IAF we can now go to the await spinup semaphore state // Regardless of the result release this frame since we are done with it