xref: /linux/include/sound/sof/info.h (revision f86fd32d)
1 /* SPDX-License-Identifier: (GPL-2.0 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 
29 /* extended data types that can be appended onto end of sof_ipc_fw_ready */
30 enum sof_ipc_ext_data {
31 	SOF_IPC_EXT_DMA_BUFFER = 0,
32 	SOF_IPC_EXT_WINDOW,
33 	SOF_IPC_EXT_CC_INFO,
34 };
35 
36 /* FW version - SOF_IPC_GLB_VERSION */
37 struct sof_ipc_fw_version {
38 	struct sof_ipc_hdr hdr;
39 	uint16_t major;
40 	uint16_t minor;
41 	uint16_t micro;
42 	uint16_t build;
43 	uint8_t date[12];
44 	uint8_t time[10];
45 	uint8_t tag[6];
46 	uint32_t abi_version;
47 
48 	/* reserved for future use */
49 	uint32_t reserved[4];
50 } __packed;
51 
52 /* FW ready Message - sent by firmware when boot has completed */
53 struct sof_ipc_fw_ready {
54 	struct sof_ipc_cmd_hdr hdr;
55 	uint32_t dspbox_offset;	 /* dsp initiated IPC mailbox */
56 	uint32_t hostbox_offset; /* host initiated IPC mailbox */
57 	uint32_t dspbox_size;
58 	uint32_t hostbox_size;
59 	struct sof_ipc_fw_version version;
60 
61 	/* Miscellaneous flags */
62 	uint64_t flags;
63 
64 	/* reserved for future use */
65 	uint32_t reserved[4];
66 } __packed;
67 
68 /*
69  * Extended Firmware data. All optional, depends on platform/arch.
70  */
71 enum sof_ipc_region {
72 	SOF_IPC_REGION_DOWNBOX	= 0,
73 	SOF_IPC_REGION_UPBOX,
74 	SOF_IPC_REGION_TRACE,
75 	SOF_IPC_REGION_DEBUG,
76 	SOF_IPC_REGION_STREAM,
77 	SOF_IPC_REGION_REGS,
78 	SOF_IPC_REGION_EXCEPTION,
79 };
80 
81 struct sof_ipc_ext_data_hdr {
82 	struct sof_ipc_cmd_hdr hdr;
83 	uint32_t type;		/**< SOF_IPC_EXT_ */
84 } __packed;
85 
86 struct sof_ipc_dma_buffer_elem {
87 	struct sof_ipc_hdr hdr;
88 	uint32_t type;		/**< SOF_IPC_REGION_ */
89 	uint32_t id;		/**< platform specific - used to map to host memory */
90 	struct sof_ipc_host_buffer buffer;
91 } __packed;
92 
93 /* extended data DMA buffers for IPC, trace and debug */
94 struct sof_ipc_dma_buffer_data {
95 	struct sof_ipc_ext_data_hdr ext_hdr;
96 	uint32_t num_buffers;
97 
98 	/* host files in buffer[n].buffer */
99 	struct sof_ipc_dma_buffer_elem buffer[];
100 }  __packed;
101 
102 struct sof_ipc_window_elem {
103 	struct sof_ipc_hdr hdr;
104 	uint32_t type;		/**< SOF_IPC_REGION_ */
105 	uint32_t id;		/**< platform specific - used to map to host memory */
106 	uint32_t flags;		/**< R, W, RW, etc - to define */
107 	uint32_t size;		/**< size of region in bytes */
108 	/* offset in window region as windows can be partitioned */
109 	uint32_t offset;
110 } __packed;
111 
112 /* extended data memory windows for IPC, trace and debug */
113 struct sof_ipc_window {
114 	struct sof_ipc_ext_data_hdr ext_hdr;
115 	uint32_t num_windows;
116 	struct sof_ipc_window_elem window[];
117 }  __packed;
118 
119 struct sof_ipc_cc_version {
120 	struct sof_ipc_ext_data_hdr ext_hdr;
121 	uint32_t major;
122 	uint32_t minor;
123 	uint32_t micro;
124 
125 	/* reserved for future use */
126 	uint32_t reserved[4];
127 
128 	char name[16]; /* null terminated compiler name */
129 	char optim[4]; /* null terminated compiler -O flag value */
130 	char desc[]; /* null terminated compiler description */
131 } __packed;
132 
133 #endif
134