Skip to content
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

Add support for SOF_IPC_FW_READY message initiated by host #7463

Merged
merged 2 commits into from
May 2, 2023
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
32 changes: 32 additions & 0 deletions src/ipc/ipc3/handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,6 +1603,35 @@ void ipc_boot_complete_msg(struct ipc_cmd_hdr *header, uint32_t data)
header->dat[1] = data;
}

LaurentiuM1234 marked this conversation as resolved.
Show resolved Hide resolved
static int ipc_fw_ready(void)
{
#ifdef CONFIG_IMX93_A55
/* VERY IMPORTANT:
* * due to how the FW is started, i.MX93 has the
* following flow (please note that the host driver
* is blacklisted and inserted later on):
*
* 1) Linux kernel boots and user space becomes
* available.
* 2) FW is started (through Jailhouse) => SOF is running
* 4) Host driver module is inserted.
* 5) Host platform driver sends SOF_IPC_FW_READY and
* expects SOF to send the SOF_IPC_FW_READY
* message, the window regions and the reply
* header in the following order:
* 1) reply structure
* 2) sof_ipc_fw_ready structure
* 3) windows structure
* (all of the above information is written
* contiguously in the hostbox)
*/
return platform_boot_complete(0);
#else
/* any other platform should not receive SOF_IPC_FW_READY from host */
return -EINVAL;
#endif /* CONFIG_IMX93_A55 */
}

/*
* Global IPC Operations.
*/
Expand Down Expand Up @@ -1663,6 +1692,9 @@ void ipc_cmd(struct ipc_cmd_hdr *_hdr)
case SOF_IPC_GLB_DEBUG:
ret = ipc_glb_debug_message(hdr->cmd);
break;
case SOF_IPC_FW_READY:
ret = ipc_fw_ready();
break;
#if CONFIG_DEBUG
case SOF_IPC_GLB_TEST:
ret = ipc_glb_test_message(hdr->cmd);
Expand Down
18 changes: 15 additions & 3 deletions zephyr/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,20 @@ int task_main_start(struct sof *sof)
return 0;
}

static int boot_complete(void)
{
#ifdef CONFIG_IMX93_A55
/* in the case of i.MX93, SOF_IPC_FW_READY
* sequence will be initiated by the host
* so we shouldn't do anything here.
*/
return 0;
#else
/* let host know DSP boot is complete */
return platform_boot_complete(0);
#endif /* CONFIG_IMX93_A55 */
}

int start_complete(void)
{
#if defined(CONFIG_IMX)
Expand All @@ -215,9 +229,7 @@ int start_complete(void)
pm_policy_state_lock_get(PM_STATE_RUNTIME_IDLE, PM_ALL_SUBSTATES);
pm_policy_state_lock_get(PM_STATE_SOFT_OFF, PM_ALL_SUBSTATES);
#endif

/* let host know DSP boot is complete */
return platform_boot_complete(0);
LaurentiuM1234 marked this conversation as resolved.
Show resolved Hide resolved
return boot_complete();
}

/*
Expand Down