-
Notifications
You must be signed in to change notification settings - Fork 349
Create extended manifest #2427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Create extended manifest #2427
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
48e929a
sof: Add fw_metadata section
ktrzcinx ca8b48e
ext_manifest: Define extended manifest structures in firmware
ktrzcinx dbe7ae5
ext_manifest: Include firmware version
ktrzcinx 5da5c9b
ext_manifest: Include compiler description information
ktrzcinx 0064c57
ext_manifest: Include probe support information
ktrzcinx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| /* SPDX-License-Identifier: BSD-3-Clause | ||
| * | ||
| * Copyright(c) 2020 Intel Corporation. All rights reserved. | ||
| * | ||
| * Author: Karol Trzcinski <karolx.trzcinski@linux.intel.com> | ||
| */ | ||
|
|
||
| /* | ||
| * Extended manifest is a place to store metadata about firmware, known during | ||
| * compilation time - for example firmware version or used compiler. | ||
| * Given information are read on host side before firmware startup. | ||
| * This part of output binary is not signed. | ||
| * | ||
| * To add new content to ext_man, in firmware code define struct which starts | ||
| * with ext_man_elem_head followed by usage dependent content and place whole | ||
| * struct in "fw_metadata" section. Moreover kernel code should be modified to | ||
| * properly read new packet. | ||
| * | ||
| * Extended manifest is designed to be extensible. In header there is a field | ||
| * which describe header length, so after appending some data to header then it | ||
| * can be easily skipped by device with older version of this header. | ||
| * Unknown ext_man elements should be just skipped by host, | ||
| * to be backward compatible. Field `ext_man_elem_header.elem_size` should be | ||
| * used in such a situation. | ||
| */ | ||
|
|
||
| #ifndef __KERNEL_EXT_MANIFEST_H__ | ||
| #define __KERNEL_EXT_MANIFEST_H__ | ||
|
|
||
| #include <ipc/info.h> | ||
| #include <sof/compiler_attributes.h> | ||
| #include <stdint.h> | ||
|
|
||
| /* In ASCII `XMan` */ | ||
| #define EXT_MAN_MAGIC_NUMBER 0x6e614d58 | ||
|
|
||
| /* Build u32 number in format MMmmmppp */ | ||
| #define EXT_MAN_BUILD_VERSION(MAJOR, MINOR, PATH) ( \ | ||
| ((uint32_t)(MAJOR) << 24) | \ | ||
| ((uint32_t)(MINOR) << 12) | \ | ||
| (uint32_t)(PATH)) | ||
|
|
||
| /* check extended manifest version consistency */ | ||
| #define EXT_MAN_VERSION_INCOMPATIBLE(host_ver, cli_ver) ( \ | ||
| ((host_ver) & GENMASK(31, 24)) != \ | ||
| ((cli_ver) & GENMASK(31, 24))) | ||
|
|
||
| /* used extended manifest header version */ | ||
| #define EXT_MAN_VERSION EXT_MAN_BUILD_VERSION(1, 0, 0) | ||
|
|
||
| /* struct size alignment for ext_man elements */ | ||
| #define EXT_MAN_ALIGN 16 | ||
|
|
||
| /* extended manifest header, deleting any field breaks backward compatibility */ | ||
| struct ext_man_header { | ||
| uint32_t magic; /**< identification number, */ | ||
| /**< EXT_MAN_MAGIC_NUMBER */ | ||
| uint32_t full_size; /**< [bytes] full size of ext_man, */ | ||
| /**< (header + content + padding) */ | ||
| uint32_t header_size; /**< [bytes] makes header extensionable, */ | ||
| /**< after append new field to ext_man header */ | ||
| /**< then backward compatible won't be lost */ | ||
| uint32_t header_version; /**< value of EXT_MAN_VERSION */ | ||
| /**< not related with following content */ | ||
|
|
||
| /* just after this header should be list of ext_man_elem_* elements */ | ||
| } __packed; | ||
|
|
||
| /* Now define extended manifest elements */ | ||
|
|
||
| /* Extended manifest elements identificators */ | ||
| enum ext_man_elem_type { | ||
| EXT_MAN_ELEM_FW_VERSION = 0, | ||
| EXT_MAN_ELEM_CC_VERSION = SOF_IPC_EXT_CC_INFO, | ||
| EXT_MAN_ELEM_PROBE_INFO = SOF_IPC_EXT_PROBE_INFO, | ||
| }; | ||
|
|
||
| /* extended manifest element header */ | ||
| struct ext_man_elem_header { | ||
| uint32_t type; /**< EXT_MAN_ELEM_* */ | ||
| uint32_t elem_size; /**< in bytes, including header size */ | ||
|
|
||
| /* just after this header should be type dependent content */ | ||
| } __packed; | ||
|
|
||
| /* FW version */ | ||
| struct ext_man_fw_version { | ||
| struct ext_man_elem_header hdr; | ||
| /* use sof_ipc struct because of code re-use */ | ||
| struct sof_ipc_fw_version version; | ||
| uint32_t flags; | ||
| } __packed; | ||
|
|
||
| /* Used C compiler description */ | ||
| struct ext_man_cc_version { | ||
| struct ext_man_elem_header hdr; | ||
| /* use sof_ipc struct because of code re-use */ | ||
| struct sof_ipc_cc_version cc_version; | ||
| } __packed; | ||
|
|
||
| struct ext_man_probe_support { | ||
| struct ext_man_elem_header hdr; | ||
| /* use sof_ipc struct because of code re-use */ | ||
| struct sof_ipc_probe_support probe; | ||
| } __packed; | ||
|
|
||
| #endif /* __KERNEL_EXT_MANIFEST_H__ */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,23 @@ | ||
| # SPDX-License-Identifier: BSD-3-Clause | ||
|
|
||
| add_local_sources(sof init.c) | ||
|
|
||
| add_library(ext_manifest STATIC "") | ||
|
|
||
| # define compiler version | ||
| set_property(TARGET ext_manifest APPEND | ||
| PROPERTY COMPILE_DEFINITIONS | ||
| XCC_TOOLS_VERSION="${XCC_TOOLS_VERSION}") | ||
|
|
||
| # and optimization settings | ||
| get_optimization_flag(optimization_flag) | ||
| set_property(TARGET ext_manifest APPEND | ||
| PROPERTY COMPILE_DEFINITIONS | ||
| CC_OPTIMIZE_FLAGS="${optimization_flag}") | ||
|
|
||
| add_local_sources(ext_manifest | ||
| ext_manifest.c) | ||
| sof_append_relative_path_definitions(ext_manifest) | ||
|
|
||
| target_link_libraries(ext_manifest sof_options) | ||
| target_link_libraries(sof_static_libraries INTERFACE ext_manifest) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| // SPDX-License-Identifier: BSD-3-Clause | ||
| // | ||
| // Copyright(c) 2020 Intel Corporation. All rights reserved. | ||
| // | ||
| // Author: Karol Trzcinski <karolx.trzcinski@linux.intel.com> | ||
| // | ||
|
|
||
| #include <sof/bit.h> | ||
| #include <sof/common.h> | ||
| #include <sof/compiler_info.h> | ||
| #include <sof/debug/debug.h> | ||
| #include <kernel/abi.h> | ||
| #include <kernel/ext_manifest.h> | ||
| #include <config.h> | ||
| #include <version.h> | ||
|
|
||
| const struct ext_man_fw_version ext_man_fw_ver | ||
| __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { | ||
| .hdr.type = EXT_MAN_ELEM_FW_VERSION, | ||
| .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_fw_version), | ||
| EXT_MAN_ALIGN), | ||
| .version = { | ||
| .hdr.size = sizeof(struct sof_ipc_fw_version), | ||
| .micro = SOF_MICRO, | ||
| .minor = SOF_MINOR, | ||
| .major = SOF_MAJOR, | ||
| #if CONFIG_DEBUG | ||
| /* only added in debug for reproducibility in releases */ | ||
| .build = SOF_BUILD, | ||
| .date = __DATE__, | ||
| .time = __TIME__, | ||
| #endif | ||
| .tag = SOF_TAG, | ||
| .abi_version = SOF_ABI_VERSION, | ||
| }, | ||
| .flags = DEBUG_SET_FW_READY_FLAGS, | ||
| }; | ||
|
|
||
| const struct ext_man_cc_version ext_man_cc_ver | ||
| __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { | ||
| .hdr.type = EXT_MAN_ELEM_CC_VERSION, | ||
| .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cc_version), | ||
| EXT_MAN_ALIGN), | ||
| .cc_version = { | ||
| .ext_hdr.hdr.size = sizeof(struct sof_ipc_cc_version), | ||
| .ext_hdr.hdr.cmd = SOF_IPC_FW_READY, | ||
| .ext_hdr.type = SOF_IPC_EXT_CC_INFO, | ||
| .micro = CC_MICRO, | ||
| .minor = CC_MINOR, | ||
| .major = CC_MAJOR, | ||
| .name = CC_NAME "\0", ///< eg. "XCC", "\0" is needed when | ||
| ///< sizeof(CC_NAME)-1 == sizeof(.name) | ||
| .optim = CC_OPTIMIZE_FLAGS "\0", ///< eg. "O2" | ||
| .desc = CC_DESC "\0", ///< eg. " RG-2017.8-linux" | ||
| }, | ||
| }; | ||
|
|
||
| const struct ext_man_probe_support ext_man_probe | ||
| __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { | ||
| .hdr.type = EXT_MAN_ELEM_PROBE_INFO, | ||
| .hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_probe_support), | ||
| EXT_MAN_ALIGN), | ||
| .probe = { | ||
| .ext_hdr.hdr.size = sizeof(struct sof_ipc_probe_support), | ||
| .ext_hdr.hdr.cmd = SOF_IPC_FW_READY, | ||
| .ext_hdr.type = SOF_IPC_EXT_PROBE_INFO, | ||
| #if CONFIG_PROBE | ||
| .probe_points_max = CONFIG_PROBE_POINTS_MAX, | ||
| .injection_dmas_max = CONFIG_PROBE_DMA_MAX | ||
| #endif | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.