Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
0002 /*
0003  * This file is provided under a dual BSD/GPLv2 license.  When using or
0004  * redistributing this file, you may do so under either license.
0005  *
0006  * Copyright(c) 2020 Intel Corporation. All rights reserved.
0007  */
0008 
0009 /*
0010  * Extended manifest is a place to store metadata about firmware, known during
0011  * compilation time - for example firmware version or used compiler.
0012  * Given information are read on host side before firmware startup.
0013  * This part of output binary is not signed.
0014  */
0015 
0016 #ifndef __SOF_FIRMWARE_EXT_MANIFEST_H__
0017 #define __SOF_FIRMWARE_EXT_MANIFEST_H__
0018 
0019 #include <linux/bits.h>
0020 #include <linux/compiler.h>
0021 #include <linux/types.h>
0022 #include <sound/sof/info.h>
0023 
0024 /* In ASCII `XMan` */
0025 #define SOF_EXT_MAN_MAGIC_NUMBER    0x6e614d58
0026 
0027 /* Build u32 number in format MMmmmppp */
0028 #define SOF_EXT_MAN_BUILD_VERSION(MAJOR, MINOR, PATH) ((uint32_t)( \
0029     ((MAJOR) << 24) | \
0030     ((MINOR) << 12) | \
0031     (PATH)))
0032 
0033 /* check extended manifest version consistency */
0034 #define SOF_EXT_MAN_VERSION_INCOMPATIBLE(host_ver, cli_ver) ( \
0035     ((host_ver) & GENMASK(31, 24)) != \
0036     ((cli_ver) & GENMASK(31, 24)))
0037 
0038 /* used extended manifest header version */
0039 #define SOF_EXT_MAN_VERSION     SOF_EXT_MAN_BUILD_VERSION(1, 0, 0)
0040 
0041 /* extended manifest header, deleting any field breaks backward compatibility */
0042 struct sof_ext_man_header {
0043     uint32_t magic;     /*< identification number, */
0044                 /*< EXT_MAN_MAGIC_NUMBER */
0045     uint32_t full_size; /*< [bytes] full size of ext_man, */
0046                 /*< (header + content + padding) */
0047     uint32_t header_size;   /*< [bytes] makes header extensionable, */
0048                 /*< after append new field to ext_man header */
0049                 /*< then backward compatible won't be lost */
0050     uint32_t header_version; /*< value of EXT_MAN_VERSION */
0051                 /*< not related with following content */
0052 
0053     /* just after this header should be list of ext_man_elem_* elements */
0054 } __packed;
0055 
0056 /* Now define extended manifest elements */
0057 
0058 /* Extended manifest elements types */
0059 enum sof_ext_man_elem_type {
0060     SOF_EXT_MAN_ELEM_FW_VERSION     = 0,
0061     SOF_EXT_MAN_ELEM_WINDOW         = 1,
0062     SOF_EXT_MAN_ELEM_CC_VERSION     = 2,
0063     SOF_EXT_MAN_ELEM_DBG_ABI        = 4,
0064     SOF_EXT_MAN_ELEM_CONFIG_DATA        = 5, /**< ABI3.17 */
0065     SOF_EXT_MAN_ELEM_PLATFORM_CONFIG_DATA   = 6,
0066 };
0067 
0068 /* extended manifest element header */
0069 struct sof_ext_man_elem_header {
0070     uint32_t type;      /*< SOF_EXT_MAN_ELEM_ */
0071     uint32_t size;      /*< in bytes, including header size */
0072 
0073     /* just after this header should be type dependent content */
0074 } __packed;
0075 
0076 /* FW version */
0077 struct sof_ext_man_fw_version {
0078     struct sof_ext_man_elem_header hdr;
0079     /* use sof_ipc struct because of code re-use */
0080     struct sof_ipc_fw_version version;
0081     uint32_t flags;
0082 } __packed;
0083 
0084 /* extended data memory windows for IPC, trace and debug */
0085 struct sof_ext_man_window {
0086     struct sof_ext_man_elem_header hdr;
0087     /* use sof_ipc struct because of code re-use */
0088     struct sof_ipc_window ipc_window;
0089 } __packed;
0090 
0091 /* Used C compiler description */
0092 struct sof_ext_man_cc_version {
0093     struct sof_ext_man_elem_header hdr;
0094     /* use sof_ipc struct because of code re-use */
0095     struct sof_ipc_cc_version cc_version;
0096 } __packed;
0097 
0098 struct ext_man_dbg_abi {
0099     struct sof_ext_man_elem_header hdr;
0100     /* use sof_ipc struct because of code re-use */
0101     struct sof_ipc_user_abi_version dbg_abi;
0102 } __packed;
0103 
0104 /* EXT_MAN_ELEM_CONFIG_DATA elements identificators, ABI3.17 */
0105 enum config_elem_type {
0106     SOF_EXT_MAN_CONFIG_EMPTY        = 0,
0107     SOF_EXT_MAN_CONFIG_IPC_MSG_SIZE     = 1,
0108     SOF_EXT_MAN_CONFIG_MEMORY_USAGE_SCAN    = 2, /**< ABI 3.18 */
0109 };
0110 
0111 struct sof_config_elem {
0112     uint32_t token;
0113     uint32_t value;
0114 } __packed;
0115 
0116 /* firmware configuration information */
0117 struct sof_ext_man_config_data {
0118     struct sof_ext_man_elem_header hdr;
0119 
0120     struct sof_config_elem elems[];
0121 } __packed;
0122 
0123 #endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */