Lines Matching defs:channel

45 /* Number of entries per channel to allocate */
86 /* DMA channel state */
88 /* DMA driver channel private pointer */
95 * number of outstanding allocs for this channel. used to track when
96 * it's safe to free up this channel so the DMA device driver can
101 /* state for if channel needs to be removed when ch_ref_cnt gets to 0 */
108 * per channel list of commands actively blocking waiting for
158 static int dcopy_stats_init(dcopy_handle_t channel);
159 static void dcopy_stats_fini(dcopy_handle_t channel);
285 dcopy_handle_t channel;
297 * if nothing is on the channel list, return DCOPY_NORESOURCES. This
301 channel = list_head(&list->dl_list);
302 if (channel == NULL) {
308 * increment the reference count, and pop the channel off the head and
312 channel->ch_ref_cnt++;
313 list_remove(&list->dl_list, channel);
314 list_insert_tail(&list->dl_list, channel);
317 *handle = (dcopy_handle_t)channel;
326 dcopy_free(dcopy_handle_t *channel)
333 ASSERT(*channel != NULL);
336 * we don't need to add the channel back to the list since we never
341 (*channel)->ch_ref_cnt--;
344 * if we need to remove this channel, and the reference count is down
348 if ((*channel)->ch_removing && ((*channel)->ch_ref_cnt == 0)) {
349 device = (*channel)->ch_device;
368 *channel = NULL;
376 dcopy_query_channel(dcopy_handle_t channel, dcopy_query_channel_t *query)
378 *query = channel->ch_info;
388 dcopy_handle_t channel;
393 channel = handle;
395 atomic_inc_64(&channel->ch_stat.cs_cmd_alloc.value.ui64);
396 e = channel->ch_cb->cb_cmd_alloc(channel->ch_channel_private, flags,
400 priv->pr_channel = channel;
418 dcopy_handle_t channel;
425 channel = priv->pr_channel;
433 channel->ch_cb->cb_cmd_free(channel->ch_channel_private, cmd);
443 dcopy_handle_t channel;
447 channel = cmd->dp_private->pr_channel;
449 atomic_inc_64(&channel->ch_stat.cs_cmd_post.value.ui64);
451 atomic_add_64(&channel->ch_stat.cs_bytes_xfer.value.ui64,
454 e = channel->ch_cb->cb_cmd_post(channel->ch_channel_private, cmd);
469 dcopy_handle_t channel;
475 channel = priv->pr_channel;
485 atomic_inc_64(&channel->ch_stat.cs_cmd_poll.value.ui64);
488 e = channel->ch_cb->cb_cmd_poll(channel->ch_channel_private, cmd);
511 dcopy_list_push(&channel->ch_poll_list, priv);
604 struct dcopy_channel_s *channel;
618 * we have a per device channel list so we can remove a device in the
629 * allocate state for each channel, allocate the channel, and then add
630 * the devices dma channels to the devices channel list.
633 channel = kmem_zalloc(sizeof (*channel), KM_SLEEP);
634 channel->ch_device = device;
635 channel->ch_removing = B_FALSE;
636 channel->ch_ref_cnt = 0;
637 channel->ch_cb = info->di_cb;
639 e = info->di_cb->cb_channel_alloc(device_private, channel,
640 DCOPY_SLEEP, dcopy_channel_size, &channel->ch_info,
641 &channel->ch_channel_private);
643 kmem_free(channel, sizeof (*channel));
647 e = dcopy_stats_init(channel);
650 &channel->ch_channel_private);
651 kmem_free(channel, sizeof (*channel));
655 e = dcopy_list_init(&channel->ch_poll_list,
659 dcopy_stats_fini(channel);
661 &channel->ch_channel_private);
662 kmem_free(channel, sizeof (*channel));
666 dcopy_list_push(&device->dc_devchan_list, channel);
673 * add the device's dma channels to the global channel list (where
678 channel = list_head(&device->dc_devchan_list.dl_list);
679 while (channel != NULL) {
681 channel);
683 channel = list_next(&device->dc_devchan_list.dl_list, channel);
696 channel = list_head(&device->dc_devchan_list.dl_list);
697 while (channel != NULL) {
699 channel = dcopy_list_pop(&device->dc_devchan_list);
700 ASSERT(channel != NULL);
702 dcopy_list_fini(&channel->ch_poll_list);
703 dcopy_stats_fini(channel);
704 info->di_cb->cb_channel_free(&channel->ch_channel_private);
705 kmem_free(channel, sizeof (*channel));
723 struct dcopy_channel_s *channel;
734 * remove the devices dma channels from the global channel list (where
739 channel = list_head(&device->dc_devchan_list.dl_list);
740 while (channel != NULL) {
742 * if the channel has outstanding allocs, mark it as having
746 if (channel->ch_ref_cnt != 0) {
747 channel->ch_removing = B_TRUE;
752 list_remove(&dcopy_statep->d_globalchan_list.dl_list, channel);
753 channel = list_next(&device->dc_devchan_list.dl_list, channel);
779 struct dcopy_channel_s *channel;
786 channel = list_head(&device->dc_devchan_list.dl_list);
787 while (channel != NULL) {
789 list_remove(&device->dc_devchan_list.dl_list, channel);
790 dcopy_list_fini(&channel->ch_poll_list);
791 dcopy_stats_fini(channel);
792 channel->ch_cb->cb_channel_free(&channel->ch_channel_private);
793 kmem_free(channel, sizeof (*channel));
794 channel = list_head(&device->dc_devchan_list.dl_list);
823 struct dcopy_channel_s *channel;
830 channel = handle;
832 poll_list = &channel->ch_poll_list;
836 * all of the commands blocking on this channel and see if they have
839 * polling since commands in a channel complete in order.
845 atomic_inc_64(&channel->
847 e = channel->ch_cb->cb_cmd_poll(
848 channel->ch_channel_private,
851 atomic_inc_64(&channel->
876 dcopy_stats_init(dcopy_handle_t channel)
885 stats = &channel->ch_stat;
886 name = (char *)ddi_driver_name(channel->ch_device->dc_info.di_dip);
887 instance = ddi_get_instance(channel->ch_device->dc_info.di_dip);
889 (void) snprintf(chanstr, CHANSTRSIZE, "channel%d",
890 (uint32_t)channel->ch_info.qc_chan_num);
892 channel->ch_kstat = kstat_create(name, instance, chanstr, "misc",
895 if (channel->ch_kstat == NULL) {
898 channel->ch_kstat->ks_data = stats;
917 kstat_install(channel->ch_kstat);
919 channel->ch_stat.cs_id.value.ui64 = channel->ch_info.qc_id;
920 channel->ch_stat.cs_capabilities.value.ui64 =
921 channel->ch_info.qc_capabilities;
931 dcopy_stats_fini(dcopy_handle_t channel)
933 kstat_delete(channel->ch_kstat);