diff --git a/smex/ldc.c b/smex/ldc.c index b9fdf888c01b..fc98f7073402 100644 --- a/smex/ldc.c +++ b/smex/ldc.c @@ -5,6 +5,7 @@ // Author: Karol Trzcinski #include +#include #include #include #include @@ -16,7 +17,7 @@ static int fw_version_copy(const struct elf_module *src, struct snd_sof_logs_header *header) { - struct sof_ipc_ext_data_hdr *ext_hdr = NULL; + struct ext_man_elem_header *ext_hdr = NULL; void *buffer = NULL; int section_size; @@ -28,6 +29,7 @@ static int fw_version_copy(const struct elf_module *src, memcpy(&header->version, &((struct sof_ipc_fw_ready *)buffer)->version, sizeof(header->version)); + free(buffer); /* fw_ready structure contains main (primarily kernel) * ABI version. @@ -42,25 +44,30 @@ static int fw_version_copy(const struct elf_module *src, * * skip the base fw-ready record and begin from the first extension. */ - ext_hdr = buffer + ((struct sof_ipc_fw_ready *)buffer)->hdr.size; + section_size = elf_read_section(src, ".fw_metadata", NULL, &buffer); + + if (section_size < 0) + return section_size; + + ext_hdr = (struct ext_man_elem_header *)buffer; while ((uintptr_t)ext_hdr < (uintptr_t)buffer + section_size) { - if (ext_hdr->type == SOF_IPC_EXT_USER_ABI_INFO) { + if (ext_hdr->type == EXT_MAN_ELEM_DBG_ABI) { header->version.abi_version = - ((struct sof_ipc_user_abi_version *) - ext_hdr)->abi_dbg_version; + ((struct ext_man_dbg_abi *) + ext_hdr)->dbg_abi.abi_dbg_version; break; } //move to the next entry - ext_hdr = (struct sof_ipc_ext_data_hdr *) - ((uint8_t *)ext_hdr + ext_hdr->hdr.size); + ext_hdr = (struct ext_man_elem_header *) + ((uint8_t *)ext_hdr + ext_hdr->elem_size); } + free(buffer); fprintf(stdout, "fw abi dbg version:\t%d:%d:%d\n", SOF_ABI_VERSION_MAJOR(header->version.abi_version), SOF_ABI_VERSION_MINOR(header->version.abi_version), SOF_ABI_VERSION_PATCH(header->version.abi_version)); - free(buffer); return 0; } diff --git a/src/include/kernel/ext_manifest.h b/src/include/kernel/ext_manifest.h index 70cb14dd5587..4963428733ae 100644 --- a/src/include/kernel/ext_manifest.h +++ b/src/include/kernel/ext_manifest.h @@ -32,16 +32,6 @@ #include #include -/* Macro used to creeate copy of some structure in extended manifest */ -#define EXT_MAN_PORT(XENUM, XSIZE, IPC_ELEM, XNAME, IPC_NAME, CONTENT) \ - XNAME __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") \ - __attribute__ ((unused)) = { \ - .hdr.type = XENUM, \ - .hdr.elem_size = ALIGN_UP(XSIZE, EXT_MAN_ALIGN), \ - .IPC_ELEM = { CONTENT } \ - }; \ - IPC_NAME = { CONTENT } - /* Now define extended manifest elements */ /* Extended manifest elements identificators */ diff --git a/src/include/sof/compiler_attributes.h b/src/include/sof/compiler_attributes.h index d600831a911f..3533856c2bc4 100644 --- a/src/include/sof/compiler_attributes.h +++ b/src/include/sof/compiler_attributes.h @@ -14,3 +14,5 @@ #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((section(x))) + +#define __unused __attribute__((unused)) diff --git a/src/include/sof/fw-ready-metadata.h b/src/include/sof/fw-ready-metadata.h index 87888c148b57..ff7c6929c60f 100644 --- a/src/include/sof/fw-ready-metadata.h +++ b/src/include/sof/fw-ready-metadata.h @@ -10,8 +10,4 @@ #include -extern const struct sof_ipc_cc_version cc_version; -extern const struct sof_ipc_probe_support probe_support; -extern const struct sof_ipc_user_abi_version user_abi_version; - #endif /* __IPC_FW_READY_METADATA_H__ */ diff --git a/src/ipc/CMakeLists.txt b/src/ipc/CMakeLists.txt index af027dad42f2..2eadf98e8a15 100644 --- a/src/ipc/CMakeLists.txt +++ b/src/ipc/CMakeLists.txt @@ -21,24 +21,3 @@ if (CONFIG_HOST_PTABLE) add_local_sources(sof ipc-host-ptable.c) endif() - -add_library(data_structs STATIC "") - -# define compiler version -set_property(TARGET data_structs APPEND - PROPERTY COMPILE_DEFINITIONS - XCC_TOOLS_VERSION="${XCC_TOOLS_VERSION}") - -# and optimization settings -get_optimization_flag(optimization_flag) -set_property(TARGET data_structs APPEND - PROPERTY COMPILE_DEFINITIONS - CC_OPTIMIZE_FLAGS="-${optimization_flag}") - -add_local_sources(data_structs - cc_version.c - probe_support.c - user_abi_version.c) - -target_link_libraries(data_structs sof_options) -target_link_libraries(sof_static_libraries INTERFACE data_structs) diff --git a/src/ipc/cc_version.c b/src/ipc/cc_version.c deleted file mode 100644 index cdb40c80dfca..000000000000 --- a/src/ipc/cc_version.c +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// -// Copyright(c) 2019 Intel Corporation. All rights reserved. -// -// Author: Karol Trzcinski - -#include -#include -#include -#include - -/* copy CC_NAME to const arrays during compilation time */ -#define CC_NAME_COPY(field) \ - field = CC_NAME "\0" - -/* copy CC_OPTIM to const arrays during compilation time */ -#define CC_OPTIM_COPY(field) \ - field = CC_OPTIMIZE_FLAGS "\0" - -/* copy CC_DESC to arrays during compilation time */ -#define CC_DESC_COPY(field) \ - field = CC_DESC "\0" - -const struct sof_ipc_cc_version cc_version - __section(".fw_ready_metadata") = { - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_cc_version), - .type = SOF_IPC_EXT_CC_INFO, - }, - .micro = CC_MICRO, - .minor = CC_MINOR, - .major = CC_MAJOR, - CC_NAME_COPY(.name), - CC_OPTIM_COPY(.optim), - CC_DESC_COPY(.desc), -}; diff --git a/src/ipc/probe_support.c b/src/ipc/probe_support.c deleted file mode 100644 index 2f27015d4cec..000000000000 --- a/src/ipc/probe_support.c +++ /dev/null @@ -1,23 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// -// Copyright(c) 2020 Intel Corporation. All rights reserved. -// -// Author: Artur Kloniecki - -#include -#include -#include - - -const struct sof_ipc_probe_support probe_support - __section(".fw_ready_metadata") = { - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_probe_support), - .type = SOF_IPC_EXT_PROBE_INFO, - }, -#if CONFIG_PROBE - .probe_points_max = CONFIG_PROBE_POINTS_MAX, - .injection_dmas_max = CONFIG_PROBE_DMA_MAX -#endif -}; diff --git a/src/ipc/user_abi_version.c b/src/ipc/user_abi_version.c deleted file mode 100644 index b63c1ea66c37..000000000000 --- a/src/ipc/user_abi_version.c +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// -// Copyright(c) 2020 Intel Corporation. All rights reserved. -// -// Author: Marcin Maka - -#include -#include - -const struct sof_ipc_user_abi_version user_abi_version - __attribute__((section(".fw_ready_metadata"))) = { - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_user_abi_version), - .type = SOF_IPC_EXT_USER_ABI_INFO, - }, - .abi_dbg_version = SOF_ABI_DBG_VERSION, -}; diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index 2fe97f7f5e1e..e04888fbb433 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -79,65 +79,65 @@ static const struct sof_ipc_fw_ready ready #define NUM_BYT_WINDOWS 6 -EXT_MAN_PORT( - EXT_MAN_ELEM_WINDOW, - sizeof(struct ext_man_windows), - window, - static const struct ext_man_windows xsram_window, - static const struct sof_ipc_window sram_window - __section(".fw_ready_metadata"), - _META_EXPAND( - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_window), - .type = SOF_IPC_EXT_WINDOW, +const struct ext_man_windows xsram_window + __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { + .hdr = { + .type = EXT_MAN_ELEM_WINDOW, + .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, - .num_windows = NUM_BYT_WINDOWS, - .window = { - { - .type = SOF_IPC_REGION_UPBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DSPBOX_SIZE, - .offset = MAILBOX_DSPBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DOWNBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_HOSTBOX_SIZE, - .offset = MAILBOX_HOSTBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DEBUG, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DEBUG_SIZE, - .offset = MAILBOX_DEBUG_OFFSET, - }, - { - .type = SOF_IPC_REGION_TRACE, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_TRACE_SIZE, - .offset = MAILBOX_TRACE_OFFSET, - }, - { - .type = SOF_IPC_REGION_STREAM, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_STREAM_SIZE, - .offset = MAILBOX_STREAM_OFFSET, + .window = { + .ext_hdr = { + .hdr.cmd = SOF_IPC_FW_READY, + .hdr.size = sizeof(struct sof_ipc_window), + .type = SOF_IPC_EXT_WINDOW, }, - { - .type = SOF_IPC_REGION_EXCEPTION, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_EXCEPTION_SIZE, - .offset = MAILBOX_EXCEPTION_OFFSET, + .num_windows = NUM_BYT_WINDOWS, + .window = { + { + .type = SOF_IPC_REGION_UPBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DSPBOX_SIZE, + .offset = MAILBOX_DSPBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DOWNBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_HOSTBOX_SIZE, + .offset = MAILBOX_HOSTBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DEBUG, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DEBUG_SIZE, + .offset = MAILBOX_DEBUG_OFFSET, + }, + { + .type = SOF_IPC_REGION_TRACE, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_TRACE_SIZE, + .offset = MAILBOX_TRACE_OFFSET, + }, + { + .type = SOF_IPC_REGION_STREAM, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_STREAM_SIZE, + .offset = MAILBOX_STREAM_OFFSET, + }, + { + .type = SOF_IPC_REGION_EXCEPTION, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_EXCEPTION_SIZE, + .offset = MAILBOX_EXCEPTION_OFFSET, + }, }, }, -)); +}; static SHARED_DATA struct timer timer = { .id = TIMER3, /* external timer */ @@ -151,27 +151,9 @@ static SHARED_DATA struct timer arch_timer = { int platform_boot_complete(uint32_t boot_message) { - uint32_t mb_offset = 0; uint64_t outbox = MAILBOX_HOST_OFFSET >> 3; - mailbox_dspbox_write(mb_offset, &ready, sizeof(ready)); - mb_offset = mb_offset + sizeof(ready); - - mailbox_dspbox_write(mb_offset, &sram_window, - sram_window.ext_hdr.hdr.size); - mb_offset = mb_offset + sram_window.ext_hdr.hdr.size; - - /* variable length compiler description is a last field of cc_version */ - mailbox_dspbox_write(mb_offset, &cc_version, - cc_version.ext_hdr.hdr.size); - mb_offset = mb_offset + cc_version.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &probe_support, - probe_support.ext_hdr.hdr.size); - mb_offset = mb_offset + probe_support.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &user_abi_version, - user_abi_version.ext_hdr.hdr.size); + mailbox_dspbox_write(0, &ready, sizeof(ready)); /* now interrupt host to tell it we are done booting */ shim_write(SHIM_IPCDL, SOF_IPC_FW_READY | outbox); diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index b1135285796c..47f43a5c32b9 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -65,65 +65,65 @@ static const struct sof_ipc_fw_ready ready #define NUM_HSW_WINDOWS 6 -EXT_MAN_PORT( - EXT_MAN_ELEM_WINDOW, - sizeof(struct ext_man_windows), - window, - static const struct ext_man_windows xsram_window, - static const struct sof_ipc_window sram_window - __section(".fw_ready_metadata"), - _META_EXPAND( - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_window), - .type = SOF_IPC_EXT_WINDOW, +const struct ext_man_windows xsram_window + __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { + .hdr = { + .type = EXT_MAN_ELEM_WINDOW, + .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, - .num_windows = NUM_HSW_WINDOWS, - .window = { - { - .type = SOF_IPC_REGION_UPBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DSPBOX_SIZE, - .offset = MAILBOX_DSPBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DOWNBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_HOSTBOX_SIZE, - .offset = MAILBOX_HOSTBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DEBUG, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DEBUG_SIZE, - .offset = MAILBOX_DEBUG_OFFSET, - }, - { - .type = SOF_IPC_REGION_TRACE, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_TRACE_SIZE, - .offset = MAILBOX_TRACE_OFFSET, - }, - { - .type = SOF_IPC_REGION_STREAM, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_STREAM_SIZE, - .offset = MAILBOX_STREAM_OFFSET, + .window = { + .ext_hdr = { + .hdr.cmd = SOF_IPC_FW_READY, + .hdr.size = sizeof(struct sof_ipc_window), + .type = SOF_IPC_EXT_WINDOW, }, - { - .type = SOF_IPC_REGION_EXCEPTION, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_EXCEPTION_SIZE, - .offset = MAILBOX_EXCEPTION_OFFSET, + .num_windows = NUM_HSW_WINDOWS, + .window = { + { + .type = SOF_IPC_REGION_UPBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DSPBOX_SIZE, + .offset = MAILBOX_DSPBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DOWNBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_HOSTBOX_SIZE, + .offset = MAILBOX_HOSTBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DEBUG, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DEBUG_SIZE, + .offset = MAILBOX_DEBUG_OFFSET, + }, + { + .type = SOF_IPC_REGION_TRACE, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_TRACE_SIZE, + .offset = MAILBOX_TRACE_OFFSET, + }, + { + .type = SOF_IPC_REGION_STREAM, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_STREAM_SIZE, + .offset = MAILBOX_STREAM_OFFSET, + }, + { + .type = SOF_IPC_REGION_EXCEPTION, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_EXCEPTION_SIZE, + .offset = MAILBOX_EXCEPTION_OFFSET, + }, }, }, -)); +}; SHARED_DATA struct timer timer = { .id = TIMER1, /* internal timer */ @@ -132,27 +132,9 @@ SHARED_DATA struct timer timer = { int platform_boot_complete(uint32_t boot_message) { - uint32_t mb_offset = 0; uint32_t outbox = MAILBOX_HOST_OFFSET >> 3; - mailbox_dspbox_write(mb_offset, &ready, sizeof(ready)); - mb_offset = mb_offset + sizeof(ready); - - mailbox_dspbox_write(mb_offset, &sram_window, - sram_window.ext_hdr.hdr.size); - mb_offset = mb_offset + sram_window.ext_hdr.hdr.size; - - /* variable length compiler description is a last field of cc_version */ - mailbox_dspbox_write(mb_offset, &cc_version, - cc_version.ext_hdr.hdr.size); - mb_offset = mb_offset + cc_version.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &probe_support, - probe_support.ext_hdr.hdr.size); - mb_offset = mb_offset + probe_support.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &user_abi_version, - user_abi_version.ext_hdr.hdr.size); + mailbox_dspbox_write(0, &ready, sizeof(ready)); /* now interrupt host to tell it we are done booting */ shim_write(SHIM_IPCD, outbox | SHIM_IPCD_BUSY); diff --git a/src/platform/imx8/platform.c b/src/platform/imx8/platform.c index 7bc372a0f3e2..67f4f0ef8834 100644 --- a/src/platform/imx8/platform.c +++ b/src/platform/imx8/platform.c @@ -64,65 +64,65 @@ static const struct sof_ipc_fw_ready ready #define NUM_IMX_WINDOWS 6 -EXT_MAN_PORT( - EXT_MAN_ELEM_WINDOW, - sizeof(struct ext_man_windows), - window, - static const struct ext_man_windows xsram_window, - static const struct sof_ipc_window sram_window - __section(".fw_ready_metadata"), - _META_EXPAND( - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_window), - .type = SOF_IPC_EXT_WINDOW, +const struct ext_man_windows xsram_window + __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { + .hdr = { + .type = EXT_MAN_ELEM_WINDOW, + .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, - .num_windows = NUM_IMX_WINDOWS, - .window = { - { - .type = SOF_IPC_REGION_UPBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DSPBOX_SIZE, - .offset = MAILBOX_DSPBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DOWNBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_HOSTBOX_SIZE, - .offset = MAILBOX_HOSTBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DEBUG, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DEBUG_SIZE, - .offset = MAILBOX_DEBUG_OFFSET, + .window = { + .ext_hdr = { + .hdr.cmd = SOF_IPC_FW_READY, + .hdr.size = sizeof(struct sof_ipc_window), + .type = SOF_IPC_EXT_WINDOW, }, - { - .type = SOF_IPC_REGION_TRACE, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_TRACE_SIZE, - .offset = MAILBOX_TRACE_OFFSET, + .num_windows = NUM_IMX_WINDOWS, + .window = { + { + .type = SOF_IPC_REGION_UPBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DSPBOX_SIZE, + .offset = MAILBOX_DSPBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DOWNBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_HOSTBOX_SIZE, + .offset = MAILBOX_HOSTBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DEBUG, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DEBUG_SIZE, + .offset = MAILBOX_DEBUG_OFFSET, + }, + { + .type = SOF_IPC_REGION_TRACE, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_TRACE_SIZE, + .offset = MAILBOX_TRACE_OFFSET, + }, + { + .type = SOF_IPC_REGION_STREAM, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_STREAM_SIZE, + .offset = MAILBOX_STREAM_OFFSET, + }, + { + .type = SOF_IPC_REGION_EXCEPTION, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_EXCEPTION_SIZE, + .offset = MAILBOX_EXCEPTION_OFFSET, + }, }, - { - .type = SOF_IPC_REGION_STREAM, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_STREAM_SIZE, - .offset = MAILBOX_STREAM_OFFSET, - }, - { - .type = SOF_IPC_REGION_EXCEPTION, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_EXCEPTION_SIZE, - .offset = MAILBOX_EXCEPTION_OFFSET, - }, - }, -)); + } +}; SHARED_DATA struct timer timer = { .id = TIMER0, /* internal timer */ @@ -131,26 +131,7 @@ SHARED_DATA struct timer timer = { int platform_boot_complete(uint32_t boot_message) { - uint32_t mb_offset = 0; - - mailbox_dspbox_write(mb_offset, &ready, sizeof(ready)); - mb_offset = mb_offset + sizeof(ready); - - mailbox_dspbox_write(mb_offset, &sram_window, - sram_window.ext_hdr.hdr.size); - mb_offset = mb_offset + sram_window.ext_hdr.hdr.size; - - /* variable length compiler description is a last field of cc_version */ - mailbox_dspbox_write(mb_offset, &cc_version, - cc_version.ext_hdr.hdr.size); - mb_offset = mb_offset + cc_version.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &probe_support, - probe_support.ext_hdr.hdr.size); - mb_offset = mb_offset + probe_support.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &user_abi_version, - user_abi_version.ext_hdr.hdr.size); + mailbox_dspbox_write(0, &ready, sizeof(ready)); /* now interrupt host to tell it we are done booting */ imx_mu_xcr_rmw(IMX_MU_xCR_GIRn(1), 0); diff --git a/src/platform/imx8m/platform.c b/src/platform/imx8m/platform.c index d9ad3cdf351c..349baabedb72 100644 --- a/src/platform/imx8m/platform.c +++ b/src/platform/imx8m/platform.c @@ -63,65 +63,65 @@ static const struct sof_ipc_fw_ready ready #define NUM_IMX_WINDOWS 6 -EXT_MAN_PORT( - EXT_MAN_ELEM_WINDOW, - sizeof(struct ext_man_windows), - window, - static const struct ext_man_windows xsram_window, - static const struct sof_ipc_window sram_window - __section(".fw_ready_metadata"), - _META_EXPAND( - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_window), - .type = SOF_IPC_EXT_WINDOW, +const struct ext_man_windows xsram_window + __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { + .hdr = { + .type = EXT_MAN_ELEM_WINDOW, + .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, - .num_windows = NUM_IMX_WINDOWS, - .window = { - { - .type = SOF_IPC_REGION_UPBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DSPBOX_SIZE, - .offset = MAILBOX_DSPBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DOWNBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_HOSTBOX_SIZE, - .offset = MAILBOX_HOSTBOX_OFFSET, - }, - { - .type = SOF_IPC_REGION_DEBUG, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DEBUG_SIZE, - .offset = MAILBOX_DEBUG_OFFSET, + .window = { + .ext_hdr = { + .hdr.cmd = SOF_IPC_FW_READY, + .hdr.size = sizeof(struct sof_ipc_window), + .type = SOF_IPC_EXT_WINDOW, }, - { - .type = SOF_IPC_REGION_TRACE, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_TRACE_SIZE, - .offset = MAILBOX_TRACE_OFFSET, - }, - { - .type = SOF_IPC_REGION_STREAM, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_STREAM_SIZE, - .offset = MAILBOX_STREAM_OFFSET, - }, - { - .type = SOF_IPC_REGION_EXCEPTION, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_EXCEPTION_SIZE, - .offset = MAILBOX_EXCEPTION_OFFSET, + .num_windows = NUM_IMX_WINDOWS, + .window = { + { + .type = SOF_IPC_REGION_UPBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DSPBOX_SIZE, + .offset = MAILBOX_DSPBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DOWNBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_HOSTBOX_SIZE, + .offset = MAILBOX_HOSTBOX_OFFSET, + }, + { + .type = SOF_IPC_REGION_DEBUG, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DEBUG_SIZE, + .offset = MAILBOX_DEBUG_OFFSET, + }, + { + .type = SOF_IPC_REGION_TRACE, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_TRACE_SIZE, + .offset = MAILBOX_TRACE_OFFSET, + }, + { + .type = SOF_IPC_REGION_STREAM, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_STREAM_SIZE, + .offset = MAILBOX_STREAM_OFFSET, + }, + { + .type = SOF_IPC_REGION_EXCEPTION, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_EXCEPTION_SIZE, + .offset = MAILBOX_EXCEPTION_OFFSET, + }, }, }, -)); +}; SHARED_DATA struct timer timer = { .id = TIMER0, /* internal timer */ @@ -130,26 +130,7 @@ SHARED_DATA struct timer timer = { int platform_boot_complete(uint32_t boot_message) { - uint32_t mb_offset = 0; - - mailbox_dspbox_write(mb_offset, &ready, sizeof(ready)); - mb_offset = mb_offset + sizeof(ready); - - mailbox_dspbox_write(mb_offset, &sram_window, - sram_window.ext_hdr.hdr.size); - mb_offset = mb_offset + sram_window.ext_hdr.hdr.size; - - /* variable length compiler description is a last field of cc_version */ - mailbox_dspbox_write(mb_offset, &cc_version, - cc_version.ext_hdr.hdr.size); - mb_offset = mb_offset + cc_version.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &probe_support, - probe_support.ext_hdr.hdr.size); - mb_offset = mb_offset + probe_support.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &user_abi_version, - user_abi_version.ext_hdr.hdr.size); + mailbox_dspbox_write(0, &ready, sizeof(ready)); /* now interrupt host to tell it we are done booting */ imx_mu_xcr_rmw(IMX_MU_xCR_GIRn(1), 0); diff --git a/src/platform/intel/cavs/platform.c b/src/platform/intel/cavs/platform.c index 651d82bc1e6c..29cf850e3b6c 100644 --- a/src/platform/intel/cavs/platform.c +++ b/src/platform/intel/cavs/platform.c @@ -78,72 +78,72 @@ static const struct sof_ipc_fw_ready ready #define NUM_WINDOWS 7 -EXT_MAN_PORT( - EXT_MAN_ELEM_WINDOW, - sizeof(struct ext_man_windows), - window, - static const struct ext_man_windows xsram_window, - static const struct sof_ipc_window sram_window - __section(".fw_ready_metadata"), - _META_EXPAND( - .ext_hdr = { - .hdr.cmd = SOF_IPC_FW_READY, - .hdr.size = sizeof(struct sof_ipc_window), - .type = SOF_IPC_EXT_WINDOW, +const struct ext_man_windows xsram_window + __aligned(EXT_MAN_ALIGN) __section(".fw_metadata") __unused = { + .hdr = { + .type = EXT_MAN_ELEM_WINDOW, + .elem_size = ALIGN_UP(sizeof(struct ext_man_windows), EXT_MAN_ALIGN), }, - .num_windows = NUM_WINDOWS, - .window = { - { - .type = SOF_IPC_REGION_REGS, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_SW_REG_SIZE, - .offset = 0, - }, - { - .type = SOF_IPC_REGION_UPBOX, - .id = 0, /* map to host window 0 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DSPBOX_SIZE, - .offset = MAILBOX_SW_REG_SIZE, - }, - { - .type = SOF_IPC_REGION_DOWNBOX, - .id = 1, /* map to host window 1 */ - .flags = 0, // TODO: set later - .size = MAILBOX_HOSTBOX_SIZE, - .offset = 0, - }, - { - .type = SOF_IPC_REGION_DEBUG, - .id = 2, /* map to host window 2 */ - .flags = 0, // TODO: set later - .size = MAILBOX_DEBUG_SIZE, - .offset = 0, + .window = { + .ext_hdr = { + .hdr.cmd = SOF_IPC_FW_READY, + .hdr.size = sizeof(struct sof_ipc_window), + .type = SOF_IPC_EXT_WINDOW, }, - { - .type = SOF_IPC_REGION_EXCEPTION, - .id = 2, /* map to host window 2 */ - .flags = 0, // TODO: set later - .size = MAILBOX_EXCEPTION_SIZE, - .offset = MAILBOX_EXCEPTION_OFFSET, - }, - { - .type = SOF_IPC_REGION_STREAM, - .id = 2, /* map to host window 2 */ - .flags = 0, // TODO: set later - .size = MAILBOX_STREAM_SIZE, - .offset = MAILBOX_STREAM_OFFSET, - }, - { - .type = SOF_IPC_REGION_TRACE, - .id = 3, /* map to host window 3 */ - .flags = 0, // TODO: set later - .size = MAILBOX_TRACE_SIZE, - .offset = 0, + .num_windows = NUM_WINDOWS, + .window = { + { + .type = SOF_IPC_REGION_REGS, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_SW_REG_SIZE, + .offset = 0, + }, + { + .type = SOF_IPC_REGION_UPBOX, + .id = 0, /* map to host window 0 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DSPBOX_SIZE, + .offset = MAILBOX_SW_REG_SIZE, + }, + { + .type = SOF_IPC_REGION_DOWNBOX, + .id = 1, /* map to host window 1 */ + .flags = 0, // TODO: set later + .size = MAILBOX_HOSTBOX_SIZE, + .offset = 0, + }, + { + .type = SOF_IPC_REGION_DEBUG, + .id = 2, /* map to host window 2 */ + .flags = 0, // TODO: set later + .size = MAILBOX_DEBUG_SIZE, + .offset = 0, + }, + { + .type = SOF_IPC_REGION_EXCEPTION, + .id = 2, /* map to host window 2 */ + .flags = 0, // TODO: set later + .size = MAILBOX_EXCEPTION_SIZE, + .offset = MAILBOX_EXCEPTION_OFFSET, + }, + { + .type = SOF_IPC_REGION_STREAM, + .id = 2, /* map to host window 2 */ + .flags = 0, // TODO: set later + .size = MAILBOX_STREAM_SIZE, + .offset = MAILBOX_STREAM_OFFSET, + }, + { + .type = SOF_IPC_REGION_TRACE, + .id = 3, /* map to host window 3 */ + .flags = 0, // TODO: set later + .size = MAILBOX_TRACE_SIZE, + .offset = 0, + }, }, }, -)); +}; #endif #if CONFIG_CANNONLAKE || CONFIG_ICELAKE || CONFIG_TIGERLAKE @@ -292,33 +292,12 @@ int platform_boot_complete(uint32_t boot_message) int platform_boot_complete(uint32_t boot_message) { - uint32_t mb_offset = 0; - #if CONFIG_TIGERLAKE && !CONFIG_CAVS_LPRO_ONLY /* TGL specific HW recommended flow */ pm_runtime_get(PM_RUNTIME_DSP, PWRD_BY_HPRO | (PLATFORM_CORE_COUNT - 1)); #endif - mailbox_dspbox_write(mb_offset, &ready, sizeof(ready)); - mb_offset = mb_offset + sizeof(ready); - -#if CONFIG_MEM_WND - mailbox_dspbox_write(mb_offset, &sram_window, - sram_window.ext_hdr.hdr.size); - mb_offset = mb_offset + sram_window.ext_hdr.hdr.size; -#endif - - /* variable length compiler description is a last field of cc_version */ - mailbox_dspbox_write(mb_offset, &cc_version, - cc_version.ext_hdr.hdr.size); - mb_offset = mb_offset + cc_version.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &probe_support, - probe_support.ext_hdr.hdr.size); - mb_offset = mb_offset + probe_support.ext_hdr.hdr.size; - - mailbox_dspbox_write(mb_offset, &user_abi_version, - user_abi_version.ext_hdr.hdr.size); + mailbox_dspbox_write(0, &ready, sizeof(ready)); /* tell host we are ready */ #if CAVS_VERSION == CAVS_VERSION_1_5 diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index ef3c6fc9d8c5..0fb771d25810 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -339,10 +339,7 @@ zephyr_library_sources( ${SOF_IPC_PATH}/dma-copy.c ${SOF_IPC_PATH}/ipc.c ${SOF_IPC_PATH}/handler.c - ${SOF_IPC_PATH}/probe_support.c - ${SOF_IPC_PATH}/user_abi_version.c ${SOF_IPC_PATH}/ipc-host-ptable.c - ${SOF_IPC_PATH}/cc_version.c ${SOF_SRC_PATH}/spinlock.c # SOF math utilities