ipc: Remove user_abi_version from mailbox

This information is already provided by extended manifest,
so there is no need to double it in runtime code.
It allows to save 16 bytes from .DATA and 128 bytes from .TEXT
for cnl platform.
`data_structs` library from src/ipc/CMakeLists.txt is no longer
needed. Moreover empty library may lead to cmake fail.
SMEX needs little update, to read DBG_ABI from .fw_metadata section
instead of .fw_ready.

Signed-off-by: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
This commit is contained in:
Karol Trzcinski 2020-10-06 13:19:30 +02:00 committed by Liam Girdwood
parent c037800d7a
commit f97e9f0de6
9 changed files with 20 additions and 80 deletions

View File

@ -5,6 +5,7 @@
// Author: Karol Trzcinski <karolx.trzcinski@linux.intel.com>
#include <kernel/abi.h>
#include <kernel/ext_manifest.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
@ -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;
}

View File

@ -10,6 +10,4 @@
#include <ipc/info.h>
extern const struct sof_ipc_user_abi_version user_abi_version;
#endif /* __IPC_FW_READY_METADATA_H__ */

View File

@ -21,22 +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
user_abi_version.c)
target_link_libraries(data_structs sof_options)
target_link_libraries(sof_static_libraries INTERFACE data_structs)

View File

@ -1,18 +0,0 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2020 Intel Corporation. All rights reserved.
//
// Author: Marcin Maka <marcin.maka@linux.intel.com>
#include <ipc/info.h>
#include <user/abi_dbg.h>
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,
};

View File

@ -151,14 +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, &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);

View File

@ -132,14 +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, &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);

View File

@ -131,13 +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, &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);

View File

@ -130,13 +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, &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);

View File

@ -292,18 +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);
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