ipc: move compact message processing to handler logic.

IPC compact messages are ABI specific. Move to ABI handler.
No code changes.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This commit is contained in:
Liam Girdwood 2021-04-12 20:12:17 +01:00 committed by Liam Girdwood
parent be065e55a8
commit d1c6cf168a
3 changed files with 52 additions and 48 deletions

View File

@ -23,22 +23,11 @@
#include <sof/schedule/task.h>
#include <sof/spinlock.h>
#include <ipc/header.h>
#if CAVS_VERSION >= CAVS_VERSION_1_8
#include <ipc/header-intel-cavs.h>
#include <ipc/pm.h>
#include <cavs/drivers/sideband-ipc.h>
#endif
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#if CAVS_VERSION >= CAVS_VERSION_1_8
#define CAVS_IPC_TYPE_S(x) ((x) & CAVS_IPC_TYPE_MASK)
#endif
/* 8fa1d42f-bc6f-464b-867f-547af08834da */
DECLARE_SOF_UUID("ipc-task", ipc_task_uuid, 0x8fa1d42f, 0xbc6f, 0x464b,
0x86, 0x7f, 0x54, 0x7a, 0xf0, 0x88, 0x34, 0xda);
@ -139,43 +128,6 @@ static void ipc_irq_handler(void *arg)
}
}
#if CAVS_VERSION >= CAVS_VERSION_1_8
static struct sof_ipc_cmd_hdr *ipc_cavs_read_set_d0ix(uint32_t dr, uint32_t dd)
{
struct sof_ipc_pm_gate *cmd = ipc_get()->comp_data;
cmd->hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
cmd->hdr.size = sizeof(*cmd);
cmd->flags = dd & CAVS_IPC_MOD_SETD0IX_BIT_MASK;
return &cmd->hdr;
}
static struct sof_ipc_cmd_hdr *ipc_compact_read_msg(void)
{
struct sof_ipc_cmd_hdr *hdr;
uint32_t dr;
uint32_t dd;
dr = ipc_read(IPC_DIPCTDR);
dd = ipc_read(IPC_DIPCTDD);
/* if there is no cAVS module IPC in regs go the previous path */
if (!(dr & CAVS_IPC_MSG_TGT))
return mailbox_validate();
switch (CAVS_IPC_TYPE_S(dr)) {
case CAVS_IPC_MOD_SET_D0IX:
hdr = ipc_cavs_read_set_d0ix(dr, dd);
break;
default:
return NULL;
}
return hdr;
}
#endif
enum task_state ipc_platform_do_cmd(void *data)
{
#if !CONFIG_SUECREEK

View File

@ -61,6 +61,12 @@ int ipc_platform_send_msg(struct ipc_msg *msg);
*/
struct ipc_data_host_buffer *ipc_platform_get_host_buffer(struct ipc *ipc);
/**
* \brief Read a compact IPC message or return NULL for normal message.
* @return Pointer to the compact message data.
*/
struct sof_ipc_cmd_hdr *ipc_compact_read_msg(void);
/**
* \brief Initialise IPC hardware for polling mode.
* @return 0 if successful error code otherwise.

View File

@ -62,6 +62,12 @@
#include <stddef.h>
#include <stdint.h>
#if CONFIG_CAVS && CAVS_VERSION >= CAVS_VERSION_1_8
#include <ipc/header-intel-cavs.h>
#include <cavs/drivers/sideband-ipc.h>
#define CAVS_IPC_TYPE_S(x) ((x) & CAVS_IPC_TYPE_MASK)
#endif
#define iGS(x) ((x) & SOF_GLB_TYPE_MASK)
#define iCS(x) ((x) & SOF_CMD_TYPE_MASK)
@ -1376,6 +1382,46 @@ static int ipc_glb_test_message(uint32_t header)
}
#endif
#if CONFIG_CAVS && CAVS_VERSION >= CAVS_VERSION_1_8
static struct sof_ipc_cmd_hdr *ipc_cavs_read_set_d0ix(uint32_t dr, uint32_t dd)
{
struct sof_ipc_pm_gate *cmd = ipc_get()->comp_data;
cmd->hdr.cmd = SOF_IPC_GLB_PM_MSG | SOF_IPC_PM_GATE;
cmd->hdr.size = sizeof(*cmd);
cmd->flags = dd & CAVS_IPC_MOD_SETD0IX_BIT_MASK;
return &cmd->hdr;
}
/*
* Read a compact IPC message or return NULL for normal message.
*/
struct sof_ipc_cmd_hdr *ipc_compact_read_msg(void)
{
struct sof_ipc_cmd_hdr *hdr;
uint32_t dr;
uint32_t dd;
dr = ipc_read(IPC_DIPCTDR);
dd = ipc_read(IPC_DIPCTDD);
/* if there is no cAVS module IPC in regs go the previous path */
if (!(dr & CAVS_IPC_MSG_TGT))
return mailbox_validate();
switch (CAVS_IPC_TYPE_S(dr)) {
case CAVS_IPC_MOD_SET_D0IX:
hdr = ipc_cavs_read_set_d0ix(dr, dd);
break;
default:
return NULL;
}
return hdr;
}
#endif
/*
* Global IPC Operations.
*/