Skip to content

Commit 977fdd5

Browse files
authored
Merge pull request #585 from thesofproject/topic/ipc-updates
IPC updates to improve logging and support ABI changes
2 parents 98f0b36 + 2183aed commit 977fdd5

File tree

7 files changed

+154
-171
lines changed

7 files changed

+154
-171
lines changed

src/ipc/apl-ipc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,21 @@ static void irq_handler(void *arg)
5959
{
6060
uint32_t dipct;
6161
uint32_t dipcie;
62+
uint32_t dipcctl;
6263
uint32_t msg = 0;
6364

6465
dipct = ipc_read(IPC_DIPCT);
6566
dipcie = ipc_read(IPC_DIPCIE);
67+
dipcctl = ipc_read(IPC_DIPCCTL);
6668

67-
tracev_ipc("ipc: irq dipct 0x%x dipcie 0x%x", dipct, dipcie);
69+
tracev_ipc("ipc: irq dipct 0x%x dipcie 0x%x dipcctl 0x%x", dipct,
70+
dipcie, dipcctl);
6871

6972
/* new message from host */
70-
if (dipct & IPC_DIPCT_BUSY) {
73+
if (dipct & IPC_DIPCT_BUSY && dipcctl & IPC_DIPCCTL_IPCTBIE) {
7174

7275
/* mask Busy interrupt */
73-
ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCTBIE);
76+
ipc_write(IPC_DIPCCTL, dipcctl & ~IPC_DIPCCTL_IPCTBIE);
7477

7578
msg = dipct & IPC_DIPCT_MSG_MASK;
7679

src/ipc/byt-ipc.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ static void do_notify(void)
5858
uint32_t flags;
5959
struct ipc_msg *msg;
6060

61-
tracev_ipc("Not");
62-
6361
spin_lock_irq(&_ipc->lock, flags);
6462
msg = _ipc->shared_ctx->dsp_msg;
6563
if (msg == NULL)
6664
goto out;
6765

66+
trace_ipc("ipc: not rx -> 0x%x", msg->header);
67+
6868
/* copy the data returned from DSP */
6969
if (msg->rx_size && msg->rx_size < SOF_IPC_MSG_MAX_SIZE)
7070
mailbox_dspbox_read(msg->rx_data, 0, msg->rx_size);
@@ -88,12 +88,13 @@ static void do_notify(void)
8888
static void irq_handler(void *arg)
8989
{
9090
uint32_t isr;
91-
92-
tracev_ipc("IRQ");
91+
uint32_t msg = 0;
9392

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

96+
tracev_ipc("ipc: irq isr 0x%x", isr);
97+
9798
if (isr & SHIM_ISRD_DONE) {
9899

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

112+
msg = shim_read(SHIM_IPCXL);
113+
111114
/* TODO: place message in Q and process later */
112115
/* It's not Q ATM, may overwrite */
113116
if (_ipc->host_pending) {
114-
trace_ipc_error("Pen");
117+
trace_ipc_error("ipc: dropping msg 0x%x", msg);
118+
trace_ipc_error(" isr 0x%x imrd 0x%x ipcxh 0x%x",
119+
isr, shim_read(SHIM_IMRD),
120+
shim_read(SHIM_IPCXH));
115121
} else {
116-
_ipc->host_msg = shim_read(SHIM_IPCXL);
122+
_ipc->host_msg = msg;
117123
_ipc->host_pending = 1;
118124
ipc_schedule_process(_ipc);
119125
}
@@ -127,7 +133,7 @@ void ipc_platform_do_cmd(struct ipc *ipc)
127133
uint32_t ipcxh;
128134
int32_t err;
129135

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

132138
/* perform command and return any error */
133139
err = ipc_cmd();
@@ -159,12 +165,9 @@ void ipc_platform_do_cmd(struct ipc *ipc)
159165
/* are we about to enter D3 ? */
160166
if (iipc->pm_prepare_D3) {
161167
while (1) {
162-
trace_ipc("pme");
163168
wait_for_interrupt(0);
164169
}
165170
}
166-
167-
tracev_ipc("CmD");
168171
}
169172

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

195198
/* now interrupt host to tell it we have message sent */
196199
shim_write(SHIM_IPCDL, msg->header);

src/ipc/cnl-ipc.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -50,41 +50,41 @@
5050
#include <platform/platform.h>
5151
#include <sof/audio/component.h>
5252
#include <sof/audio/pipeline.h>
53-
//<<<<<<< HEAD
5453
#include <uapi/ipc/header.h>
55-
56-
//=======
57-
//#include <uapi/ipc.h>
58-
//#include <sof/intel-ipc.h>
5954
#include <platform/pm_runtime.h>
60-
//>>>>>>> Added SRAM power gating on D3 entry for cAVS 1.8 (i.e. Cannonlake).
55+
6156
extern struct ipc *_ipc;
6257

6358
/* test code to check working IRQ */
6459
static void irq_handler(void *arg)
6560
{
6661
uint32_t dipctdr;
6762
uint32_t dipcida;
63+
uint32_t dipcctl;
6864
uint32_t msg = 0;
6965

70-
tracev_ipc("IRQ");
71-
7266
dipctdr = ipc_read(IPC_DIPCTDR);
7367
dipcida = ipc_read(IPC_DIPCIDA);
68+
dipcctl = ipc_read(IPC_DIPCCTL);
69+
70+
tracev_ipc("ipc: irq dipct 0x%x dipcie 0x%x dipcctl 0x%x", dipct,
71+
dipcie, dipcctl);
7472

7573
/* new message from host */
76-
if (dipctdr & IPC_DIPCTDR_BUSY) {
77-
tracev_ipc("Nms");
74+
if (dipctdr & IPC_DIPCTDR_BUSY && dipcctl & IPC_DIPCCTL_IPCTBIE) {
7875

7976
/* mask Busy interrupt */
80-
ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCTBIE);
77+
ipc_write(IPC_DIPCCTL, dipcctl & ~IPC_DIPCCTL_IPCTBIE);
8178

8279
msg = dipctdr & IPC_DIPCTDR_MSG_MASK;
8380

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

9595
/* reply message(done) from host */
9696
if (dipcida & IPC_DIPCIDA_DONE) {
97-
tracev_ipc("Rpy");
97+
9898
/* mask Done interrupt */
9999
ipc_write(IPC_DIPCCTL, ipc_read(IPC_DIPCCTL) & ~IPC_DIPCCTL_IPCIDIE);
100100

@@ -113,7 +113,7 @@ void ipc_platform_do_cmd(struct ipc *ipc)
113113
struct sof_ipc_reply reply;
114114
int32_t err;
115115

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

118118
/* perform command and return any error */
119119
err = ipc_cmd();
@@ -154,8 +154,6 @@ void ipc_platform_do_cmd(struct ipc *ipc)
154154
wait_for_interrupt(0);
155155
#endif
156156
}
157-
158-
tracev_ipc("CmD");
159157
}
160158

161159
void ipc_platform_send_msg(struct ipc *ipc)
@@ -181,7 +179,7 @@ void ipc_platform_send_msg(struct ipc *ipc)
181179
mailbox_dspbox_write(0, msg->tx_data, msg->tx_size);
182180
list_item_del(&msg->list);
183181
ipc->shared_ctx->dsp_msg = msg;
184-
tracev_ipc("Msg");
182+
tracev_ipc("ipc: msg tx -> 0x%x", msg->header);
185183

186184
/* now interrupt host to tell it we have message sent */
187185
ipc_write(IPC_DIPCIDD, 0);

0 commit comments

Comments
 (0)