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
9 changes: 6 additions & 3 deletions src/ipc/apl-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,21 @@ static void irq_handler(void *arg)
{
uint32_t dipct;
uint32_t dipcie;
uint32_t dipcctl;
uint32_t msg = 0;

dipct = ipc_read(IPC_DIPCT);
dipcie = ipc_read(IPC_DIPCIE);
dipcctl = ipc_read(IPC_DIPCCTL);

tracev_ipc("ipc: irq dipct 0x%x dipcie 0x%x", dipct, dipcie);
tracev_ipc("ipc: irq dipct 0x%x dipcie 0x%x dipcctl 0x%x", dipct,
dipcie, dipcctl);

/* new message from host */
if (dipct & IPC_DIPCT_BUSY) {
if (dipct & IPC_DIPCT_BUSY && dipcctl & IPC_DIPCCTL_IPCTBIE) {

/* mask Busy interrupt */
ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCTBIE);
ipc_write(IPC_DIPCCTL, dipcctl & ~IPC_DIPCCTL_IPCTBIE);

msg = dipct & IPC_DIPCT_MSG_MASK;

Expand Down
25 changes: 14 additions & 11 deletions src/ipc/byt-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ static void do_notify(void)
uint32_t flags;
struct ipc_msg *msg;

tracev_ipc("Not");

spin_lock_irq(&_ipc->lock, flags);
msg = _ipc->shared_ctx->dsp_msg;
if (msg == NULL)
goto out;

trace_ipc("ipc: not rx -> 0x%x", msg->header);

Copy link
Member

Choose a reason for hiding this comment

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

for my education, have we stopped using the 3 letter code for errors? If yes, we might want to revisit all the drivers to provide more meaningful information that Sst or ssr for SSP start / resume

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, that's something we have todo - I'm hoping this can be the example to copy.

/* copy the data returned from DSP */
if (msg->rx_size && msg->rx_size < SOF_IPC_MSG_MAX_SIZE)
mailbox_dspbox_read(msg->rx_data, 0, msg->rx_size);
Expand All @@ -88,12 +88,13 @@ static void do_notify(void)
static void irq_handler(void *arg)
{
uint32_t isr;

tracev_ipc("IRQ");
uint32_t msg = 0;

/* Interrupt arrived, check src */
isr = shim_read(SHIM_ISRD);

tracev_ipc("ipc: irq isr 0x%x", isr);

if (isr & SHIM_ISRD_DONE) {

/* Mask Done interrupt before return */
Expand All @@ -108,12 +109,17 @@ static void irq_handler(void *arg)
shim_write(SHIM_IMRD, shim_read(SHIM_IMRD) | SHIM_IMRD_BUSY);
interrupt_clear(PLATFORM_IPC_INTERRUPT);

msg = shim_read(SHIM_IPCXL);

/* TODO: place message in Q and process later */
/* It's not Q ATM, may overwrite */
if (_ipc->host_pending) {
trace_ipc_error("Pen");
trace_ipc_error("ipc: dropping msg 0x%x", msg);
trace_ipc_error(" isr 0x%x imrd 0x%x ipcxh 0x%x",
isr, shim_read(SHIM_IMRD),
shim_read(SHIM_IPCXH));
} else {
_ipc->host_msg = shim_read(SHIM_IPCXL);
_ipc->host_msg = msg;
_ipc->host_pending = 1;
ipc_schedule_process(_ipc);
}
Expand All @@ -127,7 +133,7 @@ void ipc_platform_do_cmd(struct ipc *ipc)
uint32_t ipcxh;
int32_t err;

tracev_ipc("Cmd");
trace_ipc("ipc: msg rx -> 0x%x", ipc->host_msg);

/* perform command and return any error */
err = ipc_cmd();
Expand Down Expand Up @@ -159,12 +165,9 @@ void ipc_platform_do_cmd(struct ipc *ipc)
/* are we about to enter D3 ? */
if (iipc->pm_prepare_D3) {
while (1) {
trace_ipc("pme");
wait_for_interrupt(0);
}
}

tracev_ipc("CmD");
}

void ipc_platform_send_msg(struct ipc *ipc)
Expand All @@ -190,7 +193,7 @@ void ipc_platform_send_msg(struct ipc *ipc)
mailbox_dspbox_write(0, msg->tx_data, msg->tx_size);
list_item_del(&msg->list);
ipc->shared_ctx->dsp_msg = msg;
tracev_ipc("Msg");
tracev_ipc("ipc: msg tx -> 0x%x", msg->header);

/* now interrupt host to tell it we have message sent */
shim_write(SHIM_IPCDL, msg->header);
Expand Down
32 changes: 15 additions & 17 deletions src/ipc/cnl-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,41 +50,41 @@
#include <platform/platform.h>
#include <sof/audio/component.h>
#include <sof/audio/pipeline.h>
//<<<<<<< HEAD
#include <uapi/ipc/header.h>

//=======
//#include <uapi/ipc.h>
//#include <sof/intel-ipc.h>
#include <platform/pm_runtime.h>
//>>>>>>> Added SRAM power gating on D3 entry for cAVS 1.8 (i.e. Cannonlake).

extern struct ipc *_ipc;

/* test code to check working IRQ */
static void irq_handler(void *arg)
{
uint32_t dipctdr;
uint32_t dipcida;
uint32_t dipcctl;
uint32_t msg = 0;

tracev_ipc("IRQ");

dipctdr = ipc_read(IPC_DIPCTDR);
dipcida = ipc_read(IPC_DIPCIDA);
dipcctl = ipc_read(IPC_DIPCCTL);

tracev_ipc("ipc: irq dipct 0x%x dipcie 0x%x dipcctl 0x%x", dipct,
dipcie, dipcctl);

/* new message from host */
if (dipctdr & IPC_DIPCTDR_BUSY) {
tracev_ipc("Nms");
if (dipctdr & IPC_DIPCTDR_BUSY && dipcctl & IPC_DIPCCTL_IPCTBIE) {

/* mask Busy interrupt */
ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCTBIE);
ipc_write(IPC_DIPCCTL, dipcctl & ~IPC_DIPCCTL_IPCTBIE);

msg = dipctdr & IPC_DIPCTDR_MSG_MASK;

/* TODO: place message in Q and process later */
/* It's not Q ATM, may overwrite */
if (_ipc->host_pending) {
trace_ipc_error("Pen");
trace_ipc_error("ipc: dropping msg 0x%x", msg);
trace_ipc_error(" dipctdr 0x%x dipcida 0x%x dipcctl 0x%x",
dipctdr, dipcida,
ipc_read(IPC_DIPCCTL));
} else {
_ipc->host_msg = msg;
_ipc->host_pending = 1;
Expand All @@ -94,7 +94,7 @@ static void irq_handler(void *arg)

/* reply message(done) from host */
if (dipcida & IPC_DIPCIDA_DONE) {
tracev_ipc("Rpy");

/* mask Done interrupt */
ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCIDIE);

Expand All @@ -113,7 +113,7 @@ void ipc_platform_do_cmd(struct ipc *ipc)
struct sof_ipc_reply reply;
int32_t err;

trace_ipc("Cmd");
trace_ipc("ipc: msg rx -> 0x%x", ipc->host_msg);

/* perform command and return any error */
err = ipc_cmd();
Expand Down Expand Up @@ -154,8 +154,6 @@ void ipc_platform_do_cmd(struct ipc *ipc)
wait_for_interrupt(0);
#endif
}

tracev_ipc("CmD");
}

void ipc_platform_send_msg(struct ipc *ipc)
Expand All @@ -181,7 +179,7 @@ void ipc_platform_send_msg(struct ipc *ipc)
mailbox_dspbox_write(0, msg->tx_data, msg->tx_size);
list_item_del(&msg->list);
ipc->shared_ctx->dsp_msg = msg;
tracev_ipc("Msg");
tracev_ipc("ipc: msg tx -> 0x%x", msg->header);

/* now interrupt host to tell it we have message sent */
ipc_write(IPC_DIPCIDD, 0);
Expand Down
Loading