Skip to content

Commit 229d832

Browse files
committed
adsp: ipc: Emergency ipc message send
Added intel_adsp_ipc_send_message_emergency function that allows to send an ipc message notifying about emergency event, such as watchdog timeout. Signed-off-by: Adrian Warecki <[email protected]>
1 parent ba27d17 commit 229d832

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

soc/xtensa/intel_adsp/common/include/intel_adsp_ipc.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,17 @@ bool intel_adsp_ipc_send_message(const struct device *dev,
161161
bool intel_adsp_ipc_send_message_sync(const struct device *dev,
162162
uint32_t data, uint32_t ext_data, k_timeout_t timeout);
163163

164+
165+
/** @brief Send an emergency IPC message.
166+
*
167+
* Sends a message to the other side of an IPC link. The data and ext_data parameters are passed
168+
* using the IDR/IDD registers. Waits in a loop until it is possible to send a message.
169+
*
170+
* @param dev IPC device.
171+
* @param data 30 bits value to transmit with the message (IDR register).
172+
* @param ext_data Extended value to transmit with the message (IDD register).
173+
*/
174+
void intel_adsp_ipc_send_message_emergency(const struct device *dev, uint32_t data,
175+
uint32_t ext_data);
176+
164177
#endif /* ZEPHYR_INCLUDE_INTEL_ADSP_IPC_H */

soc/xtensa/intel_adsp/common/ipc.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,37 @@ bool intel_adsp_ipc_send_message_sync(const struct device *dev,
166166
return ret;
167167
}
168168

169+
void intel_adsp_ipc_send_message_emergency(const struct device *dev, uint32_t data,
170+
uint32_t ext_data)
171+
{
172+
const struct intel_adsp_ipc_config * const config = dev->config;
173+
174+
volatile struct intel_adsp_ipc * const regs = config->regs;
175+
bool done;
176+
177+
/* check if host is processing message. */
178+
while (regs->idr & INTEL_ADSP_IPC_BUSY) {
179+
k_busy_wait(1);
180+
}
181+
182+
/* check if host has pending acknowledge msg
183+
* Same signal, but on different bits in 1.5
184+
*/
185+
done = IS_ENABLED(CONFIG_SOC_INTEL_CAVS_V15) ? (regs->idd & INTEL_ADSP_IPC_DONE)
186+
: (regs->ida & INTEL_ADSP_IPC_DONE);
187+
if (done) {
188+
/* IPC completion */
189+
if (IS_ENABLED(CONFIG_SOC_INTEL_CAVS_V15)) {
190+
regs->idd = INTEL_ADSP_IPC_DONE;
191+
} else {
192+
regs->ida = INTEL_ADSP_IPC_DONE;
193+
}
194+
}
195+
196+
regs->idd = ext_data;
197+
regs->idr = data | INTEL_ADSP_IPC_BUSY;
198+
}
199+
169200
#if DT_NODE_EXISTS(INTEL_ADSP_IPC_HOST_DTNODE)
170201

171202
#if defined(CONFIG_SOC_SERIES_INTEL_ACE)

0 commit comments

Comments
 (0)