9#ifndef __SOF_IPC_COMMON_H__
10#define __SOF_IPC_COMMON_H__
20#include <ipc/stream.h>
32#define IPC_IS_SIZE_INVALID(object) \
33 ((object).hdr.size != sizeof(object))
35#define IPC_TAIL_IS_SIZE_INVALID(object) \
36 ((object).comp.hdr.size + (object).comp.ext_data_length < sizeof(object))
42#define IPC_SIZE_ERROR_TRACE(ctx, object) \
43 tr_err(ctx, "ipc: size %d expected %zu", \
44 (object).hdr.size, sizeof(object))
47#define ipc_get_ppl_src_comp(ipc, ppl_id) \
48 ipc_get_ppl_comp(ipc, ppl_id, PPL_DIR_UPSTREAM)
51#define ipc_get_ppl_sink_comp(ipc, ppl_id) \
52 ipc_get_ppl_comp(ipc, ppl_id, PPL_DIR_DOWNSTREAM)
54#define IPC_TASK_INLINE BIT(0)
55#define IPC_TASK_IN_THREAD BIT(1)
56#define IPC_TASK_SECONDARY_CORE BIT(2)
57#define IPC_TASK_POWERDOWN BIT(3)
59#ifdef CONFIG_CORE_COUNT
60#define IPC_DSP_CORE_COUNT CONFIG_CORE_COUNT
62#define IPC_DSP_CORE_COUNT 1
112#if CONFIG_TWB_IPC_TASK
118#ifdef CONFIG_SOF_USERSPACE_LL
123#ifdef CONFIG_SOF_TELEMETRY_IO_PERFORMANCE_MEASUREMENTS
125 struct io_perf_data_item *io_perf_in_msg_count;
126 struct io_perf_data_item *io_perf_out_msg_count;
137#define ipc_set_drvdata(ipc, data) \
138 ((ipc)->private = data)
139#define ipc_get_drvdata(ipc) \
144#ifdef CONFIG_SOF_USERSPACE_LL
182#if CONFIG_ZEPHYR_NATIVE_DRIVERS
183 struct sof_dma *
dmac;
203 uint32_t *ring_size);
253#if defined(CONFIG_PM_DEVICE) && defined(CONFIG_IPC_SERVICE_BACKEND_INTEL_ADSP_HOST_IPC)
265void ipc_send_failed_power_transition_response(
void);
324#ifdef CONFIG_SOF_USERSPACE_LL
336int ipc_user_forward_cmd(uint32_t
primary, uint32_t
extension,
unsigned int core);
355int ipc_user_init_secondary(
unsigned int core);
Memory allocation API, zones, heaps, and alignment utilities.
void ipc_compound_msg_done(uint32_t msg_id, int error)
Complete the IPC compound message.
int ipc_dma_trace_send_position(void)
Send DMA trace host buffer position to host.
int ipc_dai_data_config(struct dai_data *dd, struct comp_dev *dev)
Configure DAI.
struct k_thread * ipc_thread_user(unsigned int core)
get pointer to the userspace IPC thread for core
int ipc4_user_process_glb_message(struct ipc4_message_request *ipc4, struct ipc_msg *reply)
Processes IPC4 userspace global message.
void ipc_cmd(struct ipc_cmd_hdr *_hdr)
Generic IPC command handler.
int ipc_init(struct sof *sof)
Initialise global IPC context.
int ipc_process_on_core(uint32_t core, bool blocking)
IPC message to be processed on other core.
struct ipc_cmd_hdr * mailbox_validate(void)
Validate mailbox contents for valid IPC header.
struct ipc_cmd_hdr * ipc_prepare_to_send(const struct ipc_msg *msg)
Prepare an IPC message for sending.
struct ipc_cmd_hdr * ipc_compact_read_msg(void)
Read a compact IPC message or return NULL for normal message.
void ipc_boot_complete_msg(struct ipc_cmd_hdr *header, uint32_t data)
create a IPC boot complete message.
void ipc_send_buffer_status_notify(void)
send a IPC buffer status notify message
static struct ipc * ipc_get(void)
Get the IPC global context.
Definition common.h:154
int ipc_compact_write_msg(struct ipc_cmd_hdr *hdr)
Write a compact IPC message.
int ipc4_user_process_module_message(struct ipc4_message_request *ipc4, struct ipc_msg *reply)
Processes IPC4 userspace module message.
void ipc_send_panic_notification(void)
Send a IPC notification that FW has hit a DSP notification.
void ipc_complete_cmd(struct ipc *ipc)
Call platform-specific IPC completion function.
struct task_ops ipc_task_ops
#define IPC_DSP_CORE_COUNT
Definition common.h:62
int ipc_process_host_buffer(struct ipc *ipc, struct sof_ipc_host_buffer *ring, uint32_t direction, struct dma_sg_elem_array *elem_array, uint32_t *ring_size)
Processes page tables for the host buffer.
void ipc_free(struct ipc *ipc)
Free global IPC context.
Sound Open Firmware global runtime context.
struct sof * sof_get(void)
Get the global Sound Open Firmware runtime instance pointer.
RTOS spinlock primitives and initialization.
User-space ABI log levels and binary trace packet header definitions.
Audio component base device "class" used by all other component types.
Definition component.h:587
Audio component base driver "class".
Definition component.h:528
DAI runtime data.
Definition dai-zephyr.h:119
SG elem array.
Definition dma.h:155
Standard 64-bit IPC4 message request envelope.
Definition header.h:127
Generic message header.
Definition header.h:36
Data provided by the platform which use ipc...page_descriptors().
Definition common.h:180
struct dma * dmac
Definition common.h:185
uint8_t * page_table
Definition common.h:187
uint8_t init_drv_data[160]
User-accessible copy of comp_driver + tr_ctx for create().
Definition common.h:94
const struct comp_driver * init_drv
Original kernel driver pointer for restoring dev->drv after create.
Definition common.h:84
uint32_t reply_tx_size
Reply TX data size from user thread (e.g.
Definition common.h:78
uint32_t reply_ext
Reply extension word from user thread (e.g.
Definition common.h:76
uint32_t ipc_msg_ext
Copy of IPC4 message extension word forwarded to user thread.
Definition common.h:72
int result
Result code from user thread processing.
Definition common.h:74
struct k_thread * audio_thread[IPC_DSP_CORE_COUNT]
Definition common.h:82
struct ipc * ipc
Definition common.h:81
struct k_thread * thread[IPC_DSP_CORE_COUNT]
Definition common.h:66
struct k_sem * sem
Definition common.h:67
uint32_t ipc_msg_pri
Copy of IPC4 message primary word forwarded to user thread.
Definition common.h:70
bool init_needed[IPC_DSP_CORE_COUNT]
Definition common.h:85
void * reply_tx_data
Reply TX data pointer from user thread (e.g.
Definition common.h:80
bool is_notification_pending
Definition common.h:105
struct k_work_q ipc_send_wq
Definition common.h:131
unsigned int core
Definition common.h:107
int pm_prepare_D3
Definition common.h:102
void * comp_data
Definition common.h:99
struct k_work_delayable z_delayed_work
Definition common.h:130
struct k_spinlock lock
Definition common.h:98
struct list_item msg_list
Definition common.h:104
uint32_t task_mask
Definition common.h:106
struct task ipc_task
Definition common.h:115
struct list_item comp_list
Definition common.h:109
Module and pipeline allocation context aggregating a Zephyr heap and optional virtual region.
Definition alloc.h:251
General firmware context.
Definition sof.h:50
struct ipc * ipc
Definition sof.h:57
Operations and callbacks associated with a scheduling task.
Definition task.h:72
Core task structure managed by SOF schedulers.
Definition task.h:81
Core task descriptor, task operations, and task execution state machine.