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