^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * This file is provided under a dual BSD/GPLv2 license. When using or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * redistributing this file, you may do so under either license.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright(c) 2020 Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * Extended manifest is a place to store metadata about firmware, known during
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * compilation time - for example firmware version or used compiler.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * Given information are read on host side before firmware startup.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * This part of output binary is not signed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #ifndef __SOF_FIRMWARE_EXT_MANIFEST_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define __SOF_FIRMWARE_EXT_MANIFEST_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/bits.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <sound/sof/info.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /* In ASCII `XMan` */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define SOF_EXT_MAN_MAGIC_NUMBER 0x6e614d58
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) /* Build u32 number in format MMmmmppp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define SOF_EXT_MAN_BUILD_VERSION(MAJOR, MINOR, PATH) ((uint32_t)( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) ((MAJOR) << 24) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) ((MINOR) << 12) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) (PATH)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* check extended manifest version consistency */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define SOF_EXT_MAN_VERSION_INCOMPATIBLE(host_ver, cli_ver) ( \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) ((host_ver) & GENMASK(31, 24)) != \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) ((cli_ver) & GENMASK(31, 24)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* used extended manifest header version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define SOF_EXT_MAN_VERSION SOF_EXT_MAN_BUILD_VERSION(1, 0, 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) /* extended manifest header, deleting any field breaks backward compatibility */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct sof_ext_man_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) uint32_t magic; /*< identification number, */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /*< EXT_MAN_MAGIC_NUMBER */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) uint32_t full_size; /*< [bytes] full size of ext_man, */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) /*< (header + content + padding) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) uint32_t header_size; /*< [bytes] makes header extensionable, */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) /*< after append new field to ext_man header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /*< then backward compatible won't be lost */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) uint32_t header_version; /*< value of EXT_MAN_VERSION */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) /*< not related with following content */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) /* just after this header should be list of ext_man_elem_* elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) /* Now define extended manifest elements */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) /* Extended manifest elements types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) enum sof_ext_man_elem_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) SOF_EXT_MAN_ELEM_FW_VERSION = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) SOF_EXT_MAN_ELEM_WINDOW = SOF_IPC_EXT_WINDOW,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) SOF_EXT_MAN_ELEM_CC_VERSION = SOF_IPC_EXT_CC_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) SOF_EXT_MAN_ELEM_DBG_ABI = SOF_IPC_EXT_USER_ABI_INFO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /* extended manifest element header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct sof_ext_man_elem_header {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) uint32_t type; /*< SOF_EXT_MAN_ELEM_ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) uint32_t size; /*< in bytes, including header size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) /* just after this header should be type dependent content */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) /* FW version */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) struct sof_ext_man_fw_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct sof_ext_man_elem_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) /* use sof_ipc struct because of code re-use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) struct sof_ipc_fw_version version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) uint32_t flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) /* extended data memory windows for IPC, trace and debug */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) struct sof_ext_man_window {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) struct sof_ext_man_elem_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /* use sof_ipc struct because of code re-use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct sof_ipc_window ipc_window;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) /* Used C compiler description */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) struct sof_ext_man_cc_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) struct sof_ext_man_elem_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /* use sof_ipc struct because of code re-use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) struct sof_ipc_cc_version cc_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) struct ext_man_dbg_abi {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) struct sof_ext_man_elem_header hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) /* use sof_ipc struct because of code re-use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) struct sof_ipc_user_abi_version dbg_abi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #endif /* __SOF_FIRMWARE_EXT_MANIFEST_H__ */