Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/include/kernel/ext_manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct ext_man_dbg_abi {
struct ext_man_config_data {
struct ext_man_elem_header hdr;

struct config_elem elems[EXT_MAN_CONFIG_LAST_ELEM];
struct config_elem elems[];
} __packed;

#endif /* __KERNEL_EXT_MANIFEST_H__ */
6 changes: 5 additions & 1 deletion src/init/ext_manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,14 @@ const struct ext_man_dbg_abi ext_man_dbg_info
},
};

/* increment this value after adding any element to ext_man_config dictionary */
#define CONFIG_ELEM_CNT (EXT_MAN_CONFIG_LAST_ELEM - 1)

const struct ext_man_config_data ext_man_config
__aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = {
.hdr.type = EXT_MAN_ELEM_CONFIG_DATA,
.hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_config_data),
.hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_config_data) +
sizeof(struct config_elem) * CONFIG_ELEM_CNT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering here if we can use a linker variable here for CONFIG_ELEM_COUNT as a way to automate this as it may be error prone for developers i.e. something cmake can pass into the linker pre-processor and have the linker set this based on the FW binary build ???

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktrzcinx agreed with Liam, we can try to use some trick with enum like

Suggested change
sizeof(struct config_elem) * CONFIG_ELEM_CNT,
sizeof(struct config_elem) * (EXT_MAN_CONFIG_LAST_ELEM - 1),

You do not need to update the EXT_MAN_CONFIG_LAST_ELEM or CONFIG_ELEM_CNT if we add a new type

EXT_MAN_ALIGN),
.elems = {
{EXT_MAN_CONFIG_IPC_MSG_SIZE, SOF_IPC_MSG_MAX_SIZE},
Expand Down
10 changes: 6 additions & 4 deletions src/platform/intel/cavs/ext_manifest.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@
#include <sof/common.h>
#include <sof/lib/memory.h>

/* Describes elements counter from ext_man_cavs_config dictionary */
#define CAVS_CONFIG_ELEM_CNT (EXT_MAN_CAVS_CONFIG_LAST_ELEM - 1)

const struct ext_man_cavs_config_data ext_man_cavs_config
__aligned(EXT_MAN_ALIGN) __section(".fw_metadata") = {
.hdr.type = EXT_MAN_ELEM_PLATFORM_CONFIG_DATA,
.hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cavs_config_data),
.hdr.elem_size = ALIGN_UP(sizeof(struct ext_man_cavs_config_data) +
sizeof(struct config_elem) * CAVS_CONFIG_ELEM_CNT,
EXT_MAN_ALIGN),
.elems = {
#if CONFIG_CAVS_LPRO_ONLY
{EXT_MAN_CAVS_CONFIG_LPRO, CONFIG_CAVS_LPRO_ONLY},
#endif
{EXT_MAN_CAVS_CONFIG_LPRO, IS_ENABLED(CONFIG_CAVS_LPRO_ONLY)},
{EXT_MAN_CAVS_CONFIG_OUTBOX_SIZE, SRAM_OUTBOX_SIZE},
{EXT_MAN_CAVS_CONFIG_INBOX_SIZE, SRAM_INBOX_SIZE},
},
Expand Down
2 changes: 1 addition & 1 deletion src/platform/intel/cavs/include/cavs/ext_manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum cavs_config_elem_type {
struct ext_man_cavs_config_data {
struct ext_man_elem_header hdr;

struct config_elem elems[EXT_MAN_CAVS_CONFIG_LAST_ELEM];
struct config_elem elems[];
} __packed;

#endif /* __KERNEL_EXT_MANIFEST_H__ */