ext_manifest.h 3.7 KB

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