Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
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_UAPI_SOUND_SOF_USER_MANIFEST_H__
10#define __INCLUDE_UAPI_SOUND_SOF_USER_MANIFEST_H__
11
12/* start offset for base FW module */
13#define SOF_MAN_ELF_TEXT_OFFSET 0x2000
14
15/* FW Extended Manifest Header id = $AE1 */
16#define SOF_MAN_EXT_HEADER_MAGIC 0x31454124
17
18/* module type load type */
19#define SOF_MAN_MOD_TYPE_BUILTIN 0
20#define SOF_MAN_MOD_TYPE_MODULE 1
21
22struct sof_man_module_type {
23 uint32_t load_type:4; /* SOF_MAN_MOD_TYPE_ */
24 uint32_t auto_start:1;
25 uint32_t domain_ll:1;
26 uint32_t domain_dp:1;
27 uint32_t rsvd_:25;
28};
29
30/* segment flags.type */
31#define SOF_MAN_SEGMENT_TEXT 0
32#define SOF_MAN_SEGMENT_RODATA 1
33#define SOF_MAN_SEGMENT_DATA 1
34#define SOF_MAN_SEGMENT_BSS 2
35#define SOF_MAN_SEGMENT_EMPTY 15
36
37union sof_man_segment_flags {
38 uint32_t ul;
39 struct {
40 uint32_t contents:1;
41 uint32_t alloc:1;
42 uint32_t load:1;
43 uint32_t readonly:1;
44 uint32_t code:1;
45 uint32_t data:1;
46 uint32_t _rsvd0:2;
47 uint32_t type:4; /* MAN_SEGMENT_ */
48 uint32_t _rsvd1:4;
49 uint32_t length:16; /* of segment in pages */
50 } r;
51} __packed;
52
53/*
54 * Module segment descriptor. Used by ROM - Immutable.
55 */
56struct sof_man_segment_desc {
57 union sof_man_segment_flags flags;
58 uint32_t v_base_addr;
59 uint32_t file_offset;
60} __packed;
61
62/*
63 * The firmware binary can be split into several modules.
64 */
65
66#define SOF_MAN_MOD_ID_LEN 4
67#define SOF_MAN_MOD_NAME_LEN 8
68#define SOF_MAN_MOD_SHA256_LEN 32
69#define SOF_MAN_MOD_ID {'$', 'A', 'M', 'E'}
70
71/*
72 * Each module has an entry in the FW header. Used by ROM - Immutable.
73 */
74struct sof_man_module {
75 uint8_t struct_id[SOF_MAN_MOD_ID_LEN]; /* SOF_MAN_MOD_ID */
76 uint8_t name[SOF_MAN_MOD_NAME_LEN];
77 uint8_t uuid[16];
78 struct sof_man_module_type type;
79 uint8_t hash[SOF_MAN_MOD_SHA256_LEN];
80 uint32_t entry_point;
81 uint16_t cfg_offset;
82 uint16_t cfg_count;
83 uint32_t affinity_mask;
84 uint16_t instance_max_count; /* max number of instances */
85 uint16_t instance_bss_size; /* instance (pages) */
86 struct sof_man_segment_desc segment[3];
87} __packed;
88
89/*
90 * Each module has a configuration in the FW header. Used by ROM - Immutable.
91 */
92struct sof_man_mod_config {
93 uint32_t par[4]; /* module parameters */
94 uint32_t is_pages; /* actual size of instance .bss (pages) */
95 uint32_t cps; /* cycles per second */
96 uint32_t ibs; /* input buffer size (bytes) */
97 uint32_t obs; /* output buffer size (bytes) */
98 uint32_t module_flags; /* flags, reserved for future use */
99 uint32_t cpc; /* cycles per single run */
100 uint32_t obls; /* output block size, reserved for future use */
101} __packed;
102
103/*
104 * FW Manifest Header
105 */
106
107#define SOF_MAN_FW_HDR_FW_NAME_LEN 8
108#define SOF_MAN_FW_HDR_ID {'$', 'A', 'M', '1'}
109#define SOF_MAN_FW_HDR_NAME "ADSPFW"
110#define SOF_MAN_FW_HDR_FLAGS 0x0
111#define SOF_MAN_FW_HDR_FEATURES 0xff
112
113/*
114 * The firmware has a standard header that is checked by the ROM on firmware
115 * loading. preload_page_count is used by DMA code loader and is entire
116 * image size on CNL. i.e. CNL: total size of the binary’s .text and .rodata
117 * Used by ROM - Immutable.
118 */
119struct sof_man_fw_header {
120 uint8_t header_id[4];
121 uint32_t header_len;
122 uint8_t name[SOF_MAN_FW_HDR_FW_NAME_LEN];
123 /* number of pages of preloaded image loaded by driver */
124 uint32_t preload_page_count;
125 uint32_t fw_image_flags;
126 uint32_t feature_mask;
127 uint16_t major_version;
128 uint16_t minor_version;
129 uint16_t hotfix_version;
130 uint16_t build_version;
131 uint32_t num_module_entries;
132 uint32_t hw_buf_base_addr;
133 uint32_t hw_buf_length;
134 /* target address for binary loading as offset in IMR - must be == base offset */
135 uint32_t load_offset;
136} __packed;
137
138/*
139 * Firmware manifest descriptor. This can contain N modules and N module
140 * configs. Used by ROM - Immutable.
141 */
142struct sof_man_fw_desc {
143 struct sof_man_fw_header header;
144
145 /* Warning - hack for module arrays. For some unknown reason the we
146 * have a variable size array of struct man_module followed by a
147 * variable size array of struct mod_config. These should have been
148 * merged into a variable array of a parent structure. We have to hack
149 * around this in many places....
150 *
151 * struct sof_man_module man_module[];
152 * struct sof_man_mod_config mod_config[];
153 */
154
155} __packed;
156
157/*
158 * Component Descriptor. Used by ROM - Immutable.
159 */
160struct sof_man_component_desc {
161 uint32_t reserved[2]; /* all 0 */
162 uint32_t version;
163 uint8_t hash[SOF_MAN_MOD_SHA256_LEN];
164 uint32_t base_offset;
165 uint32_t limit_offset;
166 uint32_t attributes[4];
167} __packed;
168
169/*
170 * Audio DSP extended metadata. Used by ROM - Immutable.
171 */
172struct sof_man_adsp_meta_file_ext {
173 uint32_t ext_type; /* always 17 for ADSP extension */
174 uint32_t ext_len;
175 uint32_t imr_type;
176 uint8_t reserved[16]; /* all 0 */
177 struct sof_man_component_desc comp_desc[1];
178} __packed;
179
180/*
181 * Module Manifest for rimage module metadata. Not used by ROM.
182 */
183struct sof_man_module_manifest {
184 struct sof_man_module module;
185 uint32_t text_size;
186} __packed;
187
188#endif