Lines Matching refs:core_data
129 struct sof_mtrace_core_data *core_data = inode->i_private; in sof_ipc4_mtrace_dfs_open() local
132 mutex_lock(&core_data->buffer_lock); in sof_ipc4_mtrace_dfs_open()
134 if (core_data->log_buffer) { in sof_ipc4_mtrace_dfs_open()
143 core_data->log_buffer = kmalloc(SOF_MTRACE_SLOT_SIZE, GFP_KERNEL); in sof_ipc4_mtrace_dfs_open()
144 if (!core_data->log_buffer) { in sof_ipc4_mtrace_dfs_open()
152 kfree(core_data->log_buffer); in sof_ipc4_mtrace_dfs_open()
157 mutex_unlock(&core_data->buffer_lock); in sof_ipc4_mtrace_dfs_open()
162 static bool sof_wait_mtrace_avail(struct sof_mtrace_core_data *core_data) in sof_wait_mtrace_avail() argument
167 if (core_data->host_read_ptr != core_data->dsp_write_ptr) in sof_wait_mtrace_avail()
173 add_wait_queue(&core_data->trace_sleep, &wait); in sof_wait_mtrace_avail()
179 remove_wait_queue(&core_data->trace_sleep, &wait); in sof_wait_mtrace_avail()
181 if (core_data->host_read_ptr != core_data->dsp_write_ptr) in sof_wait_mtrace_avail()
190 struct sof_mtrace_core_data *core_data = file->private_data; in sof_ipc4_mtrace_dfs_read() local
192 struct snd_sof_dev *sdev = core_data->sdev; in sof_ipc4_mtrace_dfs_read()
194 void *log_buffer = core_data->log_buffer; in sof_ipc4_mtrace_dfs_read()
206 if (!sof_wait_mtrace_avail(core_data)) { in sof_ipc4_mtrace_dfs_read()
215 if (core_data->slot_offset == INVALID_SLOT_OFFSET) in sof_ipc4_mtrace_dfs_read()
219 log_buffer_offset = core_data->slot_offset + (sizeof(u32) * 2); in sof_ipc4_mtrace_dfs_read()
223 read_ptr = core_data->host_read_ptr; in sof_ipc4_mtrace_dfs_read()
224 write_ptr = core_data->dsp_write_ptr; in sof_ipc4_mtrace_dfs_read()
244 core_data->id, read_ptr, write_ptr, avail); in sof_ipc4_mtrace_dfs_read()
274 sof_mailbox_write(sdev, core_data->slot_offset, &read_ptr, sizeof(read_ptr)); in sof_ipc4_mtrace_dfs_read()
278 core_data->host_read_ptr = read_ptr; in sof_ipc4_mtrace_dfs_read()
291 struct sof_mtrace_core_data *core_data = inode->i_private; in sof_ipc4_mtrace_dfs_release() local
295 mutex_lock(&core_data->buffer_lock); in sof_ipc4_mtrace_dfs_release()
296 kfree(core_data->log_buffer); in sof_ipc4_mtrace_dfs_release()
297 core_data->log_buffer = NULL; in sof_ipc4_mtrace_dfs_release()
298 mutex_unlock(&core_data->buffer_lock); in sof_ipc4_mtrace_dfs_release()
492 struct sof_mtrace_core_data *core_data = &priv->cores[i]; in ipc4_mtrace_disable() local
494 core_data->host_read_ptr = 0; in ipc4_mtrace_disable()
495 core_data->dsp_write_ptr = 0; in ipc4_mtrace_disable()
496 wake_up(&core_data->trace_sleep); in ipc4_mtrace_disable()
509 struct sof_mtrace_core_data *core_data; in sof_mtrace_find_core_slots() local
528 core_data = &priv->cores[core]; in sof_mtrace_find_core_slots()
535 core_data->slot_offset = sdev->debug_box.offset; in sof_mtrace_find_core_slots()
536 core_data->slot_offset += SOF_MTRACE_SLOT_SIZE * (i + 1); in sof_mtrace_find_core_slots()
538 if (core_data->delayed_pos_update) { in sof_mtrace_find_core_slots()
540 core_data->delayed_pos_update = false; in sof_mtrace_find_core_slots()
579 struct sof_mtrace_core_data *core_data = &priv->cores[i]; in ipc4_mtrace_init() local
581 init_waitqueue_head(&core_data->trace_sleep); in ipc4_mtrace_init()
582 mutex_init(&core_data->buffer_lock); in ipc4_mtrace_init()
583 core_data->sdev = sdev; in ipc4_mtrace_init()
584 core_data->id = i; in ipc4_mtrace_init()
625 struct sof_mtrace_core_data *core_data; in sof_ipc4_mtrace_update_pos() local
634 core_data = &priv->cores[core]; in sof_ipc4_mtrace_update_pos()
636 if (core_data->slot_offset == INVALID_SLOT_OFFSET) { in sof_ipc4_mtrace_update_pos()
637 core_data->delayed_pos_update = true; in sof_ipc4_mtrace_update_pos()
642 sof_mailbox_read(sdev, core_data->slot_offset + sizeof(u32), in sof_ipc4_mtrace_update_pos()
643 &core_data->dsp_write_ptr, 4); in sof_ipc4_mtrace_update_pos()
644 core_data->dsp_write_ptr -= core_data->dsp_write_ptr % 4; in sof_ipc4_mtrace_update_pos()
648 core, core_data->host_read_ptr, core_data->dsp_write_ptr); in sof_ipc4_mtrace_update_pos()
650 wake_up(&core_data->trace_sleep); in sof_ipc4_mtrace_update_pos()