From 0a3b13f2cbb8c05ad701795064792c7d00388a26 Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Mon, 11 May 2020 11:08:31 +0200 Subject: [PATCH 1/3] ext_manifest: Reference definition from rimage repo Such a split will allow to add dictionary elements with list of elements placed in particulary elf section - bacause of possibility to calculate sizeof of this section. Moreover whith such an approach, it is possible to define list of mandatory extended manifest elements, which will be checked after each build for each supported platform. Signed-off-by: Karol Trzcinski --- src/include/kernel/ext_manifest.h | 53 +------------------------------ 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/src/include/kernel/ext_manifest.h b/src/include/kernel/ext_manifest.h index 87b37b88e41a..8cb9c81b80a5 100644 --- a/src/include/kernel/ext_manifest.h +++ b/src/include/kernel/ext_manifest.h @@ -30,58 +30,7 @@ #include #include #include - -/* 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; +#include /* FW version */ struct ext_man_fw_version { From bdb5afe01f8a331e9b2df2d942ef343f00efe4e5 Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Tue, 12 May 2020 08:26:52 +0200 Subject: [PATCH 2/3] ext_manifest: Add UUID dictionary Such a dictionary will be used in kernel code to translate UUID value to memory address used in DSP in runtime. Translation will be used for the process component creation and runtime trace filtering. Signed-off-by: Karol Trzcinski --- src/include/kernel/ext_manifest.h | 12 ++++++++++++ src/include/sof/lib/uuid.h | 12 ++++++++++++ src/init/ext_manifest.c | 11 +++++++++++ src/platform/cannonlake/cannonlake.x.in | 5 +++++ 4 files changed, 40 insertions(+) diff --git a/src/include/kernel/ext_manifest.h b/src/include/kernel/ext_manifest.h index 8cb9c81b80a5..8abe042b1e8b 100644 --- a/src/include/kernel/ext_manifest.h +++ b/src/include/kernel/ext_manifest.h @@ -53,4 +53,16 @@ struct ext_man_probe_support { struct sof_ipc_probe_support probe; } __packed; +/* UUID dictionary */ +struct ext_man_uuid_dict_elem { + uint32_t addr; + uint8_t uuid[16]; +} __packed; + +struct ext_man_uuid_dict { + struct ext_man_elem_header hdr; + /* filled in rimage by uuid_section content */ + struct ext_man_uuid_dict_elem entries[]; +} __packed; + #endif /* __KERNEL_EXT_MANIFEST_H__ */ diff --git a/src/include/sof/lib/uuid.h b/src/include/sof/lib/uuid.h index 9393a45baee2..299f7c8c1e73 100644 --- a/src/include/sof/lib/uuid.h +++ b/src/include/sof/lib/uuid.h @@ -9,6 +9,7 @@ #define __SOF_LIB_UUID_H__ #include +#include /** \addtogroup uuid_api UUID API * UUID API specification. @@ -78,6 +79,17 @@ struct sof_uuid { .d = {vd0, vd1, vd2, vd3, vd4, vd5, vd6, vd7}}, \ sizeof(entity_name), \ entity_name \ + }; \ + __section(".fw_metadata_uuid_dict") \ + static const struct ext_man_uuid_dict_elem \ + ext_man_uuid_ ## uuid_name = { \ + .addr = (uint32_t)&uuid_name, \ + .uuid = { (va) & 0xFF, ((va) >> 8) & 0xFF, \ + ((va) >> 16) & 0xFF, ((va) >> 24) & 0xFF, \ + (vb) & 0xFF, ((vb) >> 8) & 0xFF, \ + (vc) & 0xFF, ((vc) >> 8) & 0xFF, \ + (vd0), (vd1), (vd2), (vd3), \ + (vd4), (vd5), (vd6), (vd7) } \ } /** \brief Creates local unique 32-bit representation of UUID structure. diff --git a/src/init/ext_manifest.c b/src/init/ext_manifest.c index 28a234a46090..257053c08075 100644 --- a/src/init/ext_manifest.c +++ b/src/init/ext_manifest.c @@ -70,3 +70,14 @@ const struct ext_man_probe_support ext_man_probe #endif }, }; + +/* + * this element size will be updated by rimage, + * so size shouldn't be aligned yet. + * List of entries will be fetched from `fw_metadata_uuid_dict` section. + */ +const struct ext_man_uuid_dict ext_man_uuid_header + __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = { + .hdr.type = EXT_MAN_ELEM_UUID_DICT, + .hdr.elem_size = sizeof(struct ext_man_uuid_dict), +}; diff --git a/src/platform/cannonlake/cannonlake.x.in b/src/platform/cannonlake/cannonlake.x.in index 3359a2575ec7..3c9d9bd46e1f 100644 --- a/src/platform/cannonlake/cannonlake.x.in +++ b/src/platform/cannonlake/cannonlake.x.in @@ -568,4 +568,9 @@ SECTIONS KEEP (*(.fw_metadata)) . = ALIGN(_EXT_MAN_ALIGN_); } >fw_metadata_seg :metadata_entries_phdr + + .fw_metadata_uuid_dict (COPY) : ALIGN(1024) + { + KEEP (*(.fw_metadata_uuid_dict)) + } >fw_metadata_seg :metadata_entries_phdr } From d85a757322a15dab8ab4e7605bc0d7a6acebe35c Mon Sep 17 00:00:00 2001 From: Karol Trzcinski Date: Thu, 14 May 2020 16:34:31 +0200 Subject: [PATCH 3/3] temporary: substitute of rimage PR #16 and #17 merge To delete after merge of listed PRs Signed-off-by: Karol Trzcinski --- .gitmodules | 2 +- CMakeLists.txt | 1 + src/include/kernel/ext_manifest.h | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 7bb66ada9c0f..5861064b98a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "rimage"] path = rimage url = https://github.com/thesofproject/rimage.git - branch = master + branch = ext-man-uuid diff --git a/CMakeLists.txt b/CMakeLists.txt index 96746a4d7c94..3bb836634968 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,7 @@ set(CMAKE_ASM_FLAGS -DASSEMBLY) add_library(sof_public_headers INTERFACE) target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/src/include) +target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/rimage/src/include) target_include_directories(sof_public_headers INTERFACE ${PROJECT_SOURCE_DIR}/rimage/src/include/sof) # interface library that is used only as container for sof binary options diff --git a/src/include/kernel/ext_manifest.h b/src/include/kernel/ext_manifest.h index 8abe042b1e8b..f6ea44a497ea 100644 --- a/src/include/kernel/ext_manifest.h +++ b/src/include/kernel/ext_manifest.h @@ -30,7 +30,7 @@ #include #include #include -#include +#include /* FW version */ struct ext_man_fw_version {