FreeBSD/sys/dev/isci/scil/scic_sds_controller.c
/**
 * @brief This method allocates remote node index and the reserves the
 *        remote node context space for use. This method can fail if there
 *        are no more remote node index available.
 *
 * @param[in] this_controller This is the controller object which contains
 *            the set of free remote node ids
 * @param[in] the_devce This is the device object which is requesting the a
 *            remote node id
 * @param[out] node_id This is the remote node id that is assinged to the
 *             device if one is available
 *
 * @return SCI_STATUS
 * @retval SCI_FAILURE_OUT_OF_RESOURCES if there are no available remote
 *         node index available.
 */
@brief This method allocates remote node index and the reserves the
remote node context space for use. This method can fail if there
are no more remote node index available.

@param[in] this_controller This is the controller object which contains
the set of free remote node ids
@param[in] the_devce This is the device object which is requesting the a
remote node id
@param[out] node_id This is the remote node id that is assinged to the
device if one is available

@return SCI_STATUS
@retval SCI_FAILURE_OUT_OF_RESOURCES if there are no available remote
node index available.
@brief This method allocates remote node index and the reserves the remote node context space for use . This method can fail if there are no more remote node index available . @param [ in ] this_controller This is the controller object which contains the set of free remote node ids @param [ in ] the_devce This is the device object which is requesting the a remote node id @param [ out ] node_id This is the remote node id that is assinged to the device if one is available @return SCI_STATUS @retval SCI_FAILURE_OUT_OF_RESOURCES if there are no available remote node index available .
SCI_STATUS scic_sds_controller_allocate_remote_node_context(
   SCIC_SDS_CONTROLLER_T    * this_controller,
   SCIC_SDS_REMOTE_DEVICE_T * the_device,
   U16                      * node_id
)
{
   U16 node_index;
   U32 remote_node_count = scic_sds_remote_device_node_count(the_device);
   node_index = scic_sds_remote_node_table_allocate_remote_node(
                  &this_controller->available_remote_nodes, remote_node_count
              );
   if (node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX)
   {
      this_controller->device_table[node_index] = the_device;
      *node_id = node_index;
      return SCI_SUCCESS;
   }
   return SCI_FAILURE_INSUFFICIENT_RESOURCES;
}
SCI_STATUS scic_sds_controller_allocate_remote_node_context ( SCIC_SDS_CONTROLLER_T * this_controller , SCIC_SDS_REMOTE_DEVICE_T * the_device , U16 * node_id ) { U16 node_index ; U32 remote_node_count = scic_sds_remote_device_node_count ( the_device ) ; node_index = scic_sds_remote_node_table_allocate_remote_node ( & this_controller -> available_remote_nodes , remote_node_count ) ; if ( node_index != SCIC_SDS_REMOTE_NODE_CONTEXT_INVALID_INDEX ) { this_controller -> device_table [ node_index ] = the_device ; * node_id = node_index ; return SCI_SUCCESS ; } return SCI_FAILURE_INSUFFICIENT_RESOURCES ; }
@brief This method allocates remote node index and the reserves the
        remote node context space for use.
@brief This method allocates remote node index and the reserves the remote node context space for use .