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