xref: /OK3568_Linux_fs/kernel/include/sound/sof/info.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * This file is provided under a dual BSD/GPLv2 license.  When using or
4*4882a593Smuzhiyun  * redistributing this file, you may do so under either license.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * Copyright(c) 2018 Intel Corporation. All rights reserved.
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __INCLUDE_SOUND_SOF_INFO_H__
10*4882a593Smuzhiyun #define __INCLUDE_SOUND_SOF_INFO_H__
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <sound/sof/header.h>
13*4882a593Smuzhiyun #include <sound/sof/stream.h>
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun /*
16*4882a593Smuzhiyun  * Firmware boot and version
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun 
19*4882a593Smuzhiyun #define SOF_IPC_MAX_ELEMS	16
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /*
22*4882a593Smuzhiyun  * Firmware boot info flag bits (64-bit)
23*4882a593Smuzhiyun  */
24*4882a593Smuzhiyun #define SOF_IPC_INFO_BUILD		BIT(0)
25*4882a593Smuzhiyun #define SOF_IPC_INFO_LOCKS		BIT(1)
26*4882a593Smuzhiyun #define SOF_IPC_INFO_LOCKSV		BIT(2)
27*4882a593Smuzhiyun #define SOF_IPC_INFO_GDB		BIT(3)
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun /* extended data types that can be appended onto end of sof_ipc_fw_ready */
30*4882a593Smuzhiyun enum sof_ipc_ext_data {
31*4882a593Smuzhiyun 	SOF_IPC_EXT_UNUSED		= 0,
32*4882a593Smuzhiyun 	SOF_IPC_EXT_WINDOW		= 1,
33*4882a593Smuzhiyun 	SOF_IPC_EXT_CC_INFO		= 2,
34*4882a593Smuzhiyun 	SOF_IPC_EXT_PROBE_INFO		= 3,
35*4882a593Smuzhiyun 	SOF_IPC_EXT_USER_ABI_INFO	= 4,
36*4882a593Smuzhiyun };
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /* FW version - SOF_IPC_GLB_VERSION */
39*4882a593Smuzhiyun struct sof_ipc_fw_version {
40*4882a593Smuzhiyun 	struct sof_ipc_hdr hdr;
41*4882a593Smuzhiyun 	uint16_t major;
42*4882a593Smuzhiyun 	uint16_t minor;
43*4882a593Smuzhiyun 	uint16_t micro;
44*4882a593Smuzhiyun 	uint16_t build;
45*4882a593Smuzhiyun 	uint8_t date[12];
46*4882a593Smuzhiyun 	uint8_t time[10];
47*4882a593Smuzhiyun 	uint8_t tag[6];
48*4882a593Smuzhiyun 	uint32_t abi_version;
49*4882a593Smuzhiyun 	/* used to check FW and ldc file compatibility, reproducible value */
50*4882a593Smuzhiyun 	uint32_t src_hash;
51*4882a593Smuzhiyun 
52*4882a593Smuzhiyun 	/* reserved for future use */
53*4882a593Smuzhiyun 	uint32_t reserved[3];
54*4882a593Smuzhiyun } __packed;
55*4882a593Smuzhiyun 
56*4882a593Smuzhiyun /* FW ready Message - sent by firmware when boot has completed */
57*4882a593Smuzhiyun struct sof_ipc_fw_ready {
58*4882a593Smuzhiyun 	struct sof_ipc_cmd_hdr hdr;
59*4882a593Smuzhiyun 	uint32_t dspbox_offset;	 /* dsp initiated IPC mailbox */
60*4882a593Smuzhiyun 	uint32_t hostbox_offset; /* host initiated IPC mailbox */
61*4882a593Smuzhiyun 	uint32_t dspbox_size;
62*4882a593Smuzhiyun 	uint32_t hostbox_size;
63*4882a593Smuzhiyun 	struct sof_ipc_fw_version version;
64*4882a593Smuzhiyun 
65*4882a593Smuzhiyun 	/* Miscellaneous flags */
66*4882a593Smuzhiyun 	uint64_t flags;
67*4882a593Smuzhiyun 
68*4882a593Smuzhiyun 	/* reserved for future use */
69*4882a593Smuzhiyun 	uint32_t reserved[4];
70*4882a593Smuzhiyun } __packed;
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun /*
73*4882a593Smuzhiyun  * Extended Firmware data. All optional, depends on platform/arch.
74*4882a593Smuzhiyun  */
75*4882a593Smuzhiyun enum sof_ipc_region {
76*4882a593Smuzhiyun 	SOF_IPC_REGION_DOWNBOX	= 0,
77*4882a593Smuzhiyun 	SOF_IPC_REGION_UPBOX,
78*4882a593Smuzhiyun 	SOF_IPC_REGION_TRACE,
79*4882a593Smuzhiyun 	SOF_IPC_REGION_DEBUG,
80*4882a593Smuzhiyun 	SOF_IPC_REGION_STREAM,
81*4882a593Smuzhiyun 	SOF_IPC_REGION_REGS,
82*4882a593Smuzhiyun 	SOF_IPC_REGION_EXCEPTION,
83*4882a593Smuzhiyun };
84*4882a593Smuzhiyun 
85*4882a593Smuzhiyun struct sof_ipc_ext_data_hdr {
86*4882a593Smuzhiyun 	struct sof_ipc_cmd_hdr hdr;
87*4882a593Smuzhiyun 	uint32_t type;		/**< SOF_IPC_EXT_ */
88*4882a593Smuzhiyun } __packed;
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun struct sof_ipc_window_elem {
91*4882a593Smuzhiyun 	struct sof_ipc_hdr hdr;
92*4882a593Smuzhiyun 	uint32_t type;		/**< SOF_IPC_REGION_ */
93*4882a593Smuzhiyun 	uint32_t id;		/**< platform specific - used to map to host memory */
94*4882a593Smuzhiyun 	uint32_t flags;		/**< R, W, RW, etc - to define */
95*4882a593Smuzhiyun 	uint32_t size;		/**< size of region in bytes */
96*4882a593Smuzhiyun 	/* offset in window region as windows can be partitioned */
97*4882a593Smuzhiyun 	uint32_t offset;
98*4882a593Smuzhiyun } __packed;
99*4882a593Smuzhiyun 
100*4882a593Smuzhiyun /* extended data memory windows for IPC, trace and debug */
101*4882a593Smuzhiyun struct sof_ipc_window {
102*4882a593Smuzhiyun 	struct sof_ipc_ext_data_hdr ext_hdr;
103*4882a593Smuzhiyun 	uint32_t num_windows;
104*4882a593Smuzhiyun 	struct sof_ipc_window_elem window[SOF_IPC_MAX_ELEMS];
105*4882a593Smuzhiyun }  __packed;
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun struct sof_ipc_cc_version {
108*4882a593Smuzhiyun 	struct sof_ipc_ext_data_hdr ext_hdr;
109*4882a593Smuzhiyun 	uint32_t major;
110*4882a593Smuzhiyun 	uint32_t minor;
111*4882a593Smuzhiyun 	uint32_t micro;
112*4882a593Smuzhiyun 
113*4882a593Smuzhiyun 	/* reserved for future use */
114*4882a593Smuzhiyun 	uint32_t reserved[4];
115*4882a593Smuzhiyun 
116*4882a593Smuzhiyun 	uint8_t name[16]; /* null terminated compiler name */
117*4882a593Smuzhiyun 	uint8_t optim[4]; /* null terminated compiler -O flag value */
118*4882a593Smuzhiyun 	uint8_t desc[32]; /* null terminated compiler description */
119*4882a593Smuzhiyun } __packed;
120*4882a593Smuzhiyun 
121*4882a593Smuzhiyun /* extended data: Probe setup */
122*4882a593Smuzhiyun struct sof_ipc_probe_support {
123*4882a593Smuzhiyun 	struct sof_ipc_ext_data_hdr ext_hdr;
124*4882a593Smuzhiyun 
125*4882a593Smuzhiyun 	uint32_t probe_points_max;
126*4882a593Smuzhiyun 	uint32_t injection_dmas_max;
127*4882a593Smuzhiyun 
128*4882a593Smuzhiyun 	/* reserved for future use */
129*4882a593Smuzhiyun 	uint32_t reserved[2];
130*4882a593Smuzhiyun } __packed;
131*4882a593Smuzhiyun 
132*4882a593Smuzhiyun /* extended data: user abi version(s) */
133*4882a593Smuzhiyun struct sof_ipc_user_abi_version {
134*4882a593Smuzhiyun 	struct sof_ipc_ext_data_hdr ext_hdr;
135*4882a593Smuzhiyun 
136*4882a593Smuzhiyun 	uint32_t abi_dbg_version;
137*4882a593Smuzhiyun }  __packed;
138*4882a593Smuzhiyun 
139*4882a593Smuzhiyun #endif
140