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) 2020 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_MANIFEST_H__ 17 #define __SOF_FIRMWARE_EXT_MANIFEST_H__ 18 19 #include <linux/bits.h> 20 #include <linux/compiler.h> 21 #include <linux/types.h> 22 #include <sound/sof/info.h> 23 24 /* In ASCII `XMan` */ 25 #define SOF_EXT_MAN_MAGIC_NUMBER 0x6e614d58 26 27 /* Build u32 number in format MMmmmppp */ 28 #define SOF_EXT_MAN_BUILD_VERSION(MAJOR, MINOR, PATH) ((uint32_t)( \ 29 ((MAJOR) << 24) | \ 30 ((MINOR) << 12) | \ 31 (PATH))) 32 33 /* check extended manifest version consistency */ 34 #define SOF_EXT_MAN_VERSION_INCOMPATIBLE(host_ver, cli_ver) ( \ 35 ((host_ver) & GENMASK(31, 24)) != \ 36 ((cli_ver) & GENMASK(31, 24))) 37 38 /* used extended manifest header version */ 39 #define SOF_EXT_MAN_VERSION SOF_EXT_MAN_BUILD_VERSION(1, 0, 0) 40 41 /* extended manifest header, deleting any field breaks backward compatibility */ 42 struct sof_ext_man_header { 43 uint32_t magic; /*< identification number, */ 44 /*< EXT_MAN_MAGIC_NUMBER */ 45 uint32_t full_size; /*< [bytes] full size of ext_man, */ 46 /*< (header + content + padding) */ 47 uint32_t header_size; /*< [bytes] makes header extensionable, */ 48 /*< after append new field to ext_man header */ 49 /*< then backward compatible won't be lost */ 50 uint32_t header_version; /*< value of EXT_MAN_VERSION */ 51 /*< not related with following content */ 52 53 /* just after this header should be list of ext_man_elem_* elements */ 54 } __packed; 55 56 /* Now define extended manifest elements */ 57 58 /* Extended manifest elements types */ 59 enum sof_ext_man_elem_type { 60 SOF_EXT_MAN_ELEM_FW_VERSION = 0, 61 SOF_EXT_MAN_ELEM_WINDOW = 1, 62 SOF_EXT_MAN_ELEM_CC_VERSION = 2, 63 SOF_EXT_MAN_ELEM_DBG_ABI = 4, 64 SOF_EXT_MAN_ELEM_CONFIG_DATA = 5, /**< ABI3.17 */ 65 SOF_EXT_MAN_ELEM_PLATFORM_CONFIG_DATA = 6, 66 }; 67 68 /* extended manifest element header */ 69 struct sof_ext_man_elem_header { 70 uint32_t type; /*< SOF_EXT_MAN_ELEM_ */ 71 uint32_t size; /*< in bytes, including header size */ 72 73 /* just after this header should be type dependent content */ 74 } __packed; 75 76 /* FW version */ 77 struct sof_ext_man_fw_version { 78 struct sof_ext_man_elem_header hdr; 79 /* use sof_ipc struct because of code re-use */ 80 struct sof_ipc_fw_version version; 81 uint32_t flags; 82 } __packed; 83 84 /* extended data memory windows for IPC, trace and debug */ 85 struct sof_ext_man_window { 86 struct sof_ext_man_elem_header hdr; 87 /* use sof_ipc struct because of code re-use */ 88 struct sof_ipc_window ipc_window; 89 } __packed; 90 91 /* Used C compiler description */ 92 struct sof_ext_man_cc_version { 93 struct sof_ext_man_elem_header hdr; 94 /* use sof_ipc struct because of code re-use */ 95 struct sof_ipc_cc_version cc_version; 96 } __packed; 97 98 struct ext_man_dbg_abi { 99 struct sof_ext_man_elem_header hdr; 100 /* use sof_ipc struct because of code re-use */ 101 struct sof_ipc_user_abi_version dbg_abi; 102 } __packed; 103 104 /* EXT_MAN_ELEM_CONFIG_DATA elements identificators, ABI3.17 */ 105 enum config_elem_type { 106 SOF_EXT_MAN_CONFIG_EMPTY = 0, 107 SOF_EXT_MAN_CONFIG_IPC_MSG_SIZE = 1, 108 SOF_EXT_MAN_CONFIG_MEMORY_USAGE_SCAN = 2, /**< ABI 3.18 */ 109 }; 110 111 struct sof_config_elem { 112 uint32_t token; 113 uint32_t value; 114 } __packed; 115 116 /* firmware configuration information */ 117 struct sof_ext_man_config_data { 118 struct sof_ext_man_elem_header hdr; 119 120 struct sof_config_elem elems[]; 121 } __packed; 122 123 #endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */ 124