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