xref: /linux/include/sound/sof/ext_manifest4.h (revision 33e02dc69afbd8f1b85a51d74d72f139ba4ca623)
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) 2022 Intel Corporation
7  */
8 
9 /*
10  * Extended manifest is a place to store metadata about firmware, known during
11  * compilation time - for example firmware version or used compiler.
12  * Given information are read on host side before firmware startup.
13  * This part of output binary is not signed.
14  */
15 
16 #ifndef __SOF_FIRMWARE_EXT_MANIFEST4_H__
17 #define __SOF_FIRMWARE_EXT_MANIFEST4_H__
18 
19 #include <linux/uuid.h>
20 
21 /* In ASCII  $AE1 */
22 #define SOF_EXT_MAN4_MAGIC_NUMBER	0x31454124
23 
24 #define MAX_MODULE_NAME_LEN		8
25 #define MAX_FW_BINARY_NAME		8
26 #define DEFAULT_HASH_SHA256_LEN		32
27 #define SOF_MAN4_FW_HDR_OFFSET		0x2000
28 #define SOF_MAN4_FW_HDR_OFFSET_CAVS_1_5	0x284
29 
30 /*********************************************************************
31  *	extended manifest		(struct sof_ext_manifest4_hdr)
32  *-------------------
33  *	css_manifest hdr
34  *-------------------
35  *	offset reserved for future
36  *-------------------
37  *	fw_hdr				(struct sof_man4_fw_binary_header)
38  *-------------------
39  *	module_entry[0]			(struct sof_man4_module)
40  *-------------------
41  *	module_entry[1]
42  *-------------------
43  *	...
44  *-------------------
45  *	module_entry[n]
46  *-------------------
47  *	module_config[0]		(struct sof_man4_module_config)
48  *-------------------
49  *	module_config[1]
50  *-------------------
51  *	...
52  *-------------------
53  *	module_config[m]
54  *-------------------
55  *	FW content
56  *-------------------
57  *********************************************************************/
58 
59 struct sof_ext_manifest4_hdr {
60 	uint32_t id;
61 	uint32_t len; /* length of extension manifest */
62 	uint16_t version_major; /* header version */
63 	uint16_t version_minor;
64 	uint32_t num_module_entries;
65 } __packed;
66 
67 struct sof_man4_fw_binary_header {
68 	/* This part must be unchanged to be backward compatible with SPT-LP ROM */
69 	uint32_t id;
70 	uint32_t len; /* sizeof(sof_man4_fw_binary_header) in bytes */
71 	uint8_t name[MAX_FW_BINARY_NAME];
72 	uint32_t preload_page_count; /* number of pages of preloaded image */
73 	uint32_t fw_image_flags;
74 	uint32_t feature_mask;
75 	uint16_t major_version; /* Firmware version */
76 	uint16_t minor_version;
77 	uint16_t hotfix_version;
78 	uint16_t build_version;
79 	uint32_t num_module_entries;
80 
81 	/* This part may change to contain any additional data for BaseFw that is skipped by ROM */
82 	uint32_t hw_buf_base_addr;
83 	uint32_t hw_buf_length;
84 	uint32_t load_offset; /* This value is used by ROM */
85 } __packed;
86 
87 struct sof_man4_segment_desc {
88 	uint32_t flags;
89 	uint32_t v_base_addr;
90 	uint32_t file_offset;
91 } __packed;
92 
93 struct sof_man4_module {
94 	uint32_t id;
95 	uint8_t name[MAX_MODULE_NAME_LEN];
96 	guid_t uuid;
97 	uint32_t type;
98 	uint8_t hash[DEFAULT_HASH_SHA256_LEN];
99 	uint32_t entry_point;
100 	uint16_t cfg_offset;
101 	uint16_t cfg_count;
102 	uint32_t affinity_mask;
103 	uint16_t instance_max_count;
104 	uint16_t instance_stack_size;
105 	struct sof_man4_segment_desc	segments[3];
106 } __packed;
107 
108 struct sof_man4_module_config {
109 	uint32_t par[4];	/* module parameters */
110 	uint32_t is_bytes;	/* actual size of instance .bss (bytes) */
111 	uint32_t cps;		/* cycles per second */
112 	uint32_t ibs;		/* input buffer size (bytes) */
113 	uint32_t obs;		/* output buffer size (bytes) */
114 	uint32_t module_flags;	/* flags, reserved for future use */
115 	uint32_t cpc;		/* cycles per single run */
116 	uint32_t obls;		/* output block size, reserved for future use */
117 } __packed;
118 
119 #endif /* __SOF_FIRMWARE_EXT_MANIFEST4_H__ */
120