Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
0002 /*
0003  * This file is provided under a dual BSD/GPLv2 license.  When using or
0004  * redistributing this file, you may do so under either license.
0005  *
0006  * Copyright(c) 2018 Intel Corporation. All rights reserved.
0007  */
0008 
0009 #ifndef __INCLUDE_SOUND_SOF_HEADER_H__
0010 #define __INCLUDE_SOUND_SOF_HEADER_H__
0011 
0012 #include <linux/types.h>
0013 #include <uapi/sound/sof/abi.h>
0014 
0015 /** \addtogroup sof_uapi uAPI
0016  *  SOF uAPI specification.
0017  *  @{
0018  */
0019 
0020 /*
0021  * IPC messages have a prefixed 32 bit identifier made up as follows :-
0022  *
0023  * 0xGCCCNNNN where
0024  * G is global cmd type (4 bits)
0025  * C is command type (12 bits)
0026  * I is the ID number (16 bits) - monotonic and overflows
0027  *
0028  * This is sent at the start of the IPM message in the mailbox. Messages should
0029  * not be sent in the doorbell (special exceptions for firmware .
0030  */
0031 
0032 /* Global Message - Generic */
0033 #define SOF_GLB_TYPE_SHIFT          28
0034 #define SOF_GLB_TYPE_MASK           (0xfUL << SOF_GLB_TYPE_SHIFT)
0035 #define SOF_GLB_TYPE(x)             ((x) << SOF_GLB_TYPE_SHIFT)
0036 
0037 /* Command Message - Generic */
0038 #define SOF_CMD_TYPE_SHIFT          16
0039 #define SOF_CMD_TYPE_MASK           (0xfffL << SOF_CMD_TYPE_SHIFT)
0040 #define SOF_CMD_TYPE(x)             ((x) << SOF_CMD_TYPE_SHIFT)
0041 
0042 /* Global Message Types */
0043 #define SOF_IPC_GLB_REPLY           SOF_GLB_TYPE(0x1U)
0044 #define SOF_IPC_GLB_COMPOUND            SOF_GLB_TYPE(0x2U)
0045 #define SOF_IPC_GLB_TPLG_MSG            SOF_GLB_TYPE(0x3U)
0046 #define SOF_IPC_GLB_PM_MSG          SOF_GLB_TYPE(0x4U)
0047 #define SOF_IPC_GLB_COMP_MSG            SOF_GLB_TYPE(0x5U)
0048 #define SOF_IPC_GLB_STREAM_MSG          SOF_GLB_TYPE(0x6U)
0049 #define SOF_IPC_FW_READY            SOF_GLB_TYPE(0x7U)
0050 #define SOF_IPC_GLB_DAI_MSG         SOF_GLB_TYPE(0x8U)
0051 #define SOF_IPC_GLB_TRACE_MSG           SOF_GLB_TYPE(0x9U)
0052 #define SOF_IPC_GLB_GDB_DEBUG           SOF_GLB_TYPE(0xAU)
0053 #define SOF_IPC_GLB_TEST_MSG            SOF_GLB_TYPE(0xBU)
0054 #define SOF_IPC_GLB_PROBE           SOF_GLB_TYPE(0xCU)
0055 #define SOF_IPC_GLB_DEBUG           SOF_GLB_TYPE(0xDU)
0056 
0057 /*
0058  * DSP Command Message Types
0059  */
0060 
0061 /* topology */
0062 #define SOF_IPC_TPLG_COMP_NEW           SOF_CMD_TYPE(0x001)
0063 #define SOF_IPC_TPLG_COMP_FREE          SOF_CMD_TYPE(0x002)
0064 #define SOF_IPC_TPLG_COMP_CONNECT       SOF_CMD_TYPE(0x003)
0065 #define SOF_IPC_TPLG_PIPE_NEW           SOF_CMD_TYPE(0x010)
0066 #define SOF_IPC_TPLG_PIPE_FREE          SOF_CMD_TYPE(0x011)
0067 #define SOF_IPC_TPLG_PIPE_CONNECT       SOF_CMD_TYPE(0x012)
0068 #define SOF_IPC_TPLG_PIPE_COMPLETE      SOF_CMD_TYPE(0x013)
0069 #define SOF_IPC_TPLG_BUFFER_NEW         SOF_CMD_TYPE(0x020)
0070 #define SOF_IPC_TPLG_BUFFER_FREE        SOF_CMD_TYPE(0x021)
0071 
0072 /* PM */
0073 #define SOF_IPC_PM_CTX_SAVE         SOF_CMD_TYPE(0x001)
0074 #define SOF_IPC_PM_CTX_RESTORE          SOF_CMD_TYPE(0x002)
0075 #define SOF_IPC_PM_CTX_SIZE         SOF_CMD_TYPE(0x003)
0076 #define SOF_IPC_PM_CLK_SET          SOF_CMD_TYPE(0x004)
0077 #define SOF_IPC_PM_CLK_GET          SOF_CMD_TYPE(0x005)
0078 #define SOF_IPC_PM_CLK_REQ          SOF_CMD_TYPE(0x006)
0079 #define SOF_IPC_PM_CORE_ENABLE          SOF_CMD_TYPE(0x007)
0080 #define SOF_IPC_PM_GATE             SOF_CMD_TYPE(0x008)
0081 
0082 /* component runtime config - multiple different types */
0083 #define SOF_IPC_COMP_SET_VALUE          SOF_CMD_TYPE(0x001)
0084 #define SOF_IPC_COMP_GET_VALUE          SOF_CMD_TYPE(0x002)
0085 #define SOF_IPC_COMP_SET_DATA           SOF_CMD_TYPE(0x003)
0086 #define SOF_IPC_COMP_GET_DATA           SOF_CMD_TYPE(0x004)
0087 #define SOF_IPC_COMP_NOTIFICATION       SOF_CMD_TYPE(0x005)
0088 
0089 /* DAI messages */
0090 #define SOF_IPC_DAI_CONFIG          SOF_CMD_TYPE(0x001)
0091 #define SOF_IPC_DAI_LOOPBACK            SOF_CMD_TYPE(0x002)
0092 
0093 /* stream */
0094 #define SOF_IPC_STREAM_PCM_PARAMS       SOF_CMD_TYPE(0x001)
0095 #define SOF_IPC_STREAM_PCM_PARAMS_REPLY     SOF_CMD_TYPE(0x002)
0096 #define SOF_IPC_STREAM_PCM_FREE         SOF_CMD_TYPE(0x003)
0097 #define SOF_IPC_STREAM_TRIG_START       SOF_CMD_TYPE(0x004)
0098 #define SOF_IPC_STREAM_TRIG_STOP        SOF_CMD_TYPE(0x005)
0099 #define SOF_IPC_STREAM_TRIG_PAUSE       SOF_CMD_TYPE(0x006)
0100 #define SOF_IPC_STREAM_TRIG_RELEASE     SOF_CMD_TYPE(0x007)
0101 #define SOF_IPC_STREAM_TRIG_DRAIN       SOF_CMD_TYPE(0x008)
0102 #define SOF_IPC_STREAM_TRIG_XRUN        SOF_CMD_TYPE(0x009)
0103 #define SOF_IPC_STREAM_POSITION         SOF_CMD_TYPE(0x00a)
0104 #define SOF_IPC_STREAM_VORBIS_PARAMS        SOF_CMD_TYPE(0x010)
0105 #define SOF_IPC_STREAM_VORBIS_FREE      SOF_CMD_TYPE(0x011)
0106 
0107 /* probe */
0108 #define SOF_IPC_PROBE_INIT          SOF_CMD_TYPE(0x001)
0109 #define SOF_IPC_PROBE_DEINIT            SOF_CMD_TYPE(0x002)
0110 #define SOF_IPC_PROBE_DMA_ADD           SOF_CMD_TYPE(0x003)
0111 #define SOF_IPC_PROBE_DMA_INFO          SOF_CMD_TYPE(0x004)
0112 #define SOF_IPC_PROBE_DMA_REMOVE        SOF_CMD_TYPE(0x005)
0113 #define SOF_IPC_PROBE_POINT_ADD         SOF_CMD_TYPE(0x006)
0114 #define SOF_IPC_PROBE_POINT_INFO        SOF_CMD_TYPE(0x007)
0115 #define SOF_IPC_PROBE_POINT_REMOVE      SOF_CMD_TYPE(0x008)
0116 
0117 /* trace */
0118 #define SOF_IPC_TRACE_DMA_PARAMS        SOF_CMD_TYPE(0x001)
0119 #define SOF_IPC_TRACE_DMA_POSITION      SOF_CMD_TYPE(0x002)
0120 #define SOF_IPC_TRACE_DMA_PARAMS_EXT        SOF_CMD_TYPE(0x003)
0121 #define SOF_IPC_TRACE_FILTER_UPDATE     SOF_CMD_TYPE(0x004) /**< ABI3.17 */
0122 #define SOF_IPC_TRACE_DMA_FREE      SOF_CMD_TYPE(0x005) /**< ABI3.20 */
0123 
0124 /* debug */
0125 #define SOF_IPC_DEBUG_MEM_USAGE         SOF_CMD_TYPE(0x001)
0126 
0127 /* test */
0128 #define SOF_IPC_TEST_IPC_FLOOD          SOF_CMD_TYPE(0x001)
0129 
0130 /* Get message component id */
0131 #define SOF_IPC_MESSAGE_ID(x)           ((x) & 0xffff)
0132 
0133 /* maximum message size for mailbox Tx/Rx */
0134 #define SOF_IPC_MSG_MAX_SIZE            384
0135 
0136 /*
0137  * Structure Header - Header for all IPC structures except command structs.
0138  * The size can be greater than the structure size and that means there is
0139  * extended bespoke data beyond the end of the structure including variable
0140  * arrays.
0141  */
0142 
0143 struct sof_ipc_hdr {
0144     uint32_t size;          /**< size of structure */
0145 } __packed;
0146 
0147 /*
0148  * Command Header - Header for all IPC commands. Identifies IPC message.
0149  * The size can be greater than the structure size and that means there is
0150  * extended bespoke data beyond the end of the structure including variable
0151  * arrays.
0152  */
0153 
0154 struct sof_ipc_cmd_hdr {
0155     uint32_t size;          /**< size of structure */
0156     uint32_t cmd;           /**< SOF_IPC_GLB_ + cmd */
0157 } __packed;
0158 
0159 /*
0160  * Generic reply message. Some commands override this with their own reply
0161  * types that must include this at start.
0162  */
0163 struct sof_ipc_reply {
0164     struct sof_ipc_cmd_hdr hdr;
0165     int32_t error;          /**< negative error numbers */
0166 }  __packed;
0167 
0168 /*
0169  * Compound commands - SOF_IPC_GLB_COMPOUND.
0170  *
0171  * Compound commands are sent to the DSP as a single IPC operation. The
0172  * commands are split into blocks and each block has a header. This header
0173  * identifies the command type and the number of commands before the next
0174  * header.
0175  */
0176 
0177 struct sof_ipc_compound_hdr {
0178     struct sof_ipc_cmd_hdr hdr;
0179     uint32_t count;     /**< count of 0 means end of compound sequence */
0180 }  __packed;
0181 
0182 /**
0183  * OOPS header architecture specific data.
0184  */
0185 struct sof_ipc_dsp_oops_arch_hdr {
0186     uint32_t arch;      /* Identifier of architecture */
0187     uint32_t totalsize; /* Total size of oops message */
0188 }  __packed;
0189 
0190 /**
0191  * OOPS header platform specific data.
0192  */
0193 struct sof_ipc_dsp_oops_plat_hdr {
0194     uint32_t configidhi;    /* ConfigID hi 32bits */
0195     uint32_t configidlo;    /* ConfigID lo 32bits */
0196     uint32_t numaregs;  /* Special regs num */
0197     uint32_t stackoffset;   /* Offset to stack pointer from beginning of
0198                  * oops message
0199                  */
0200     uint32_t stackptr;  /* Stack ptr */
0201 }  __packed;
0202 
0203 /** @}*/
0204 
0205 #endif