FreeBSD/sys/dev/isci/scil/scic_sds_remote_node_table.c
/**
 * This method will allocate a single RNi from the remote node table.  The
 * table index will determine from which remote node group table to search.
 * This search may fail and another group node table can be specified.  The
 * function is designed to allow a serach of the available single remote node
 * group up to the triple remote node group.  If an entry is found in the
 * specified table the remote node is removed and the remote node groups are
 * updated.
 *
 * @param[in out] remote_node_table The remote node table from which to
 *       allocate a remote node.
 * @param[in] table_index The group index that is to be used for the search.
 *
 * @return The RNi value or an invalid remote node context if an RNi can not
 *         be found.
 */
This method will allocate a single RNi from the remote node table.  The
table index will determine from which remote node group table to search.
This search may fail and another group node table can be specified.  The
function is designed to allow a serach of the available single remote node
group up to the triple remote node group.  If an entry is found in the
specified table the remote node is removed and the remote node groups are
updated.

@param[in out] remote_node_table The remote node table from which to
allocate a remote node.
@param[in] table_index The group index that is to be used for the search.

@return The RNi value or an invalid remote node context if an RNi can not
be found.
This method will allocate a single RNi from the remote node table . The table index will determine from which remote node group table to search . This search may fail and another group node table can be specified . The function is designed to allow a serach of the available single remote node group up to the triple remote node group . If an entry is found in the specified table the remote node is removed and the remote node groups are updated . @param [ in out ] remote_node_table The remote node table from which to allocate a remote node . @param [ in ] table_index The group index that is to be used for the search . @return The RNi value or an invalid remote node context if an RNi can not be found .
static
U16 scic_sds_remote_node_table_allocate_single_remote_node(
   SCIC_REMOTE_NODE_TABLE_T * remote_node_table,
   U32                        group_table_index
)
{
   U8  index;
   U8  group_value;
   U32 group_index;
   U16 remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX;
   group_index = scic_sds_remote_node_table_get_group_index(
                                             remote_node_table, group_table_index);
   if (group_index != SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX)
   {
      group_value = scic_sds_remote_node_table_get_group_value(
                                    remote_node_table, group_index);
      for (index = 0; index < SCU_STP_REMOTE_NODE_COUNT; index++)
      {
         if (((1 << index) & group_value) != 0)
         {
            remote_node_index = (U16) (group_index * SCU_STP_REMOTE_NODE_COUNT
                                       + index);
            scic_sds_remote_node_table_clear_group_index(
               remote_node_table, group_table_index, group_index
            );
            scic_sds_remote_node_table_clear_node_index(
               remote_node_table, remote_node_index
            );
            if (group_table_index > 0)
            {
               scic_sds_remote_node_table_set_group_index(
                  remote_node_table, group_table_index - 1, group_index
               );
            }
            break;
         }
      }
   }
   return remote_node_index;
}
static U16 scic_sds_remote_node_table_allocate_single_remote_node ( SCIC_REMOTE_NODE_TABLE_T * remote_node_table , U32 group_table_index ) { U8 index ; U8 group_value ; U32 group_index ; U16 remote_node_index = SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX ; group_index = scic_sds_remote_node_table_get_group_index ( remote_node_table , group_table_index ) ; if ( group_index != SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX ) { group_value = scic_sds_remote_node_table_get_group_value ( remote_node_table , group_index ) ; for ( index = 0 ; index < SCU_STP_REMOTE_NODE_COUNT ; index ++ ) { if ( ( ( 1 << index ) & group_value ) != 0 ) { remote_node_index = ( U16 ) ( group_index * SCU_STP_REMOTE_NODE_COUNT + index ) ; scic_sds_remote_node_table_clear_group_index ( remote_node_table , group_table_index , group_index ) ; scic_sds_remote_node_table_clear_node_index ( remote_node_table , remote_node_index ) ; if ( group_table_index > 0 ) { scic_sds_remote_node_table_set_group_index ( remote_node_table , group_table_index - 1 , group_index ) ; } break ; } } } return remote_node_index ; }
This method will allocate a single RNi from the remote node table.
This method will allocate a single RNi from the remote node table .
// We could not find an available slot in the table selector 0 // We have selected a bit now clear it