FreeBSD/sys/dev/isci/scil/scic_sds_remote_node_table.c
/**
 * This routine will find the bit position in absolute bit terms of the next
 * available bit for selection.  The absolute bit is index * 32 + bit
 * position.  If there are available bits in the first U32 then it is just bit
 * position.
 *  @param[in] remote_node_table This is the remote node index table from
 *       which the selection will be made.
 * @param[in] group_table_index This is the index to the group table from
 *       which to search for an available selection.
 *
 * @return U32 This is the absolute bit position for an available group.
 */
This routine will find the bit position in absolute bit terms of the next
available bit for selection.  The absolute bit is index * 32 + bit
position.  If there are available bits in the first U32 then it is just bit
position.
@param[in] remote_node_table This is the remote node index table from
which the selection will be made.
@param[in] group_table_index This is the index to the group table from
which to search for an available selection.

@return U32 This is the absolute bit position for an available group.
This routine will find the bit position in absolute bit terms of the next available bit for selection . The absolute bit is index * 32 + bit position . If there are available bits in the first U32 then it is just bit position . @param [ in ] remote_node_table This is the remote node index table from which the selection will be made . @param [ in ] group_table_index This is the index to the group table from which to search for an available selection . @return U32 This is the absolute bit position for an available group .
static
U32 scic_sds_remote_node_table_get_group_index(
   SCIC_REMOTE_NODE_TABLE_T * remote_node_table,
   U32                        group_table_index
)
{
   U32   dword_index;
   U32 * group_table;
   U32   bit_index;
   group_table = remote_node_table->remote_node_groups[group_table_index];
   for (dword_index = 0; dword_index < remote_node_table->group_array_size; dword_index++)
   {
      if (group_table[dword_index] != 0)
      {
         for (bit_index = 0; bit_index < 32; bit_index++)
         {
            if ((group_table[dword_index] & (1 << bit_index)) != 0)
            {
               return (dword_index * 32) + bit_index;
            }
         }
      }
   }
   return SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX;
}
static U32 scic_sds_remote_node_table_get_group_index ( SCIC_REMOTE_NODE_TABLE_T * remote_node_table , U32 group_table_index ) { U32 dword_index ; U32 * group_table ; U32 bit_index ; group_table = remote_node_table -> remote_node_groups [ group_table_index ] ; for ( dword_index = 0 ; dword_index < remote_node_table -> group_array_size ; dword_index ++ ) { if ( group_table [ dword_index ] != 0 ) { for ( bit_index = 0 ; bit_index < 32 ; bit_index ++ ) { if ( ( group_table [ dword_index ] & ( 1 << bit_index ) ) != 0 ) { return ( dword_index * 32 ) + bit_index ; } } } } return SCIC_SDS_REMOTE_NODE_TABLE_INVALID_INDEX ; }
This routine will find the bit position in absolute bit terms of the next
 available bit for selection.
This routine will find the bit position in absolute bit terms of the next available bit for selection .