File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838void gdb_handle_exception (void );
3939void gdb_debug_info (unsigned char * str );
4040void gdb_init_debug_exception (void );
41- void gdb_init (void );
4241
4342#endif /* CONFIG_GDB_DEBUG */
4443
44+ void gdb_init (void );
45+
4546#endif /* __SOF_DEBUG_GDB_GDB_H__ */
Original file line number Diff line number Diff line change @@ -247,4 +247,7 @@ void ipc_msg_reply(struct sof_ipc_reply *reply);
247247 */
248248void ipc_complete_cmd (struct ipc * ipc );
249249
250+ /* GDB stub: should enter GDB after completing the IPC processing */
251+ extern bool ipc_enter_gdb ;
252+
250253#endif /* __SOF_DRIVERS_IPC_H__ */
Original file line number Diff line number Diff line change @@ -112,4 +112,9 @@ int ipc_platform_poll_is_host_ready(void);
112112 */
113113int ipc_platform_poll_tx_host_msg (struct ipc_msg * msg );
114114
115+ /**
116+ * \brief wait for host acknowledgment to an IPC message
117+ */
118+ void ipc_platform_wait_ack (struct ipc * ipc );
119+
115120#endif
Original file line number Diff line number Diff line change 99#include <sof/audio/component_ext.h>
1010#include <sof/audio/pipeline.h>
1111#include <sof/common.h>
12+ #include <sof/debug/gdb/gdb.h>
1213#include <rtos/idc.h>
1314#include <rtos/symbol.h>
1415#include <sof/ipc/topology.h>
@@ -361,6 +362,13 @@ void ipc_complete_cmd(struct ipc *ipc)
361362 ipc_platform_complete_cmd (ipc );
362363}
363364
365+ bool ipc_enter_gdb ;
366+
367+ __attribute__((weak )) void ipc_platform_wait_ack (struct ipc * ipc )
368+ {
369+ k_msleep (1 );
370+ }
371+
364372static void ipc_complete_task (void * data )
365373{
366374 struct ipc * ipc = data ;
@@ -370,6 +378,13 @@ static void ipc_complete_task(void *data)
370378 ipc -> task_mask &= ~IPC_TASK_INLINE ;
371379 ipc_complete_cmd (ipc );
372380 k_spin_unlock (& ipc -> lock , key );
381+ #if CONFIG_GDBSTUB
382+ if (ipc_enter_gdb ) {
383+ ipc_enter_gdb = false;
384+ ipc_platform_wait_ack (ipc );
385+ gdb_init ();
386+ }
387+ #endif
373388}
374389
375390static enum task_state ipc_do_cmd (void * data )
Original file line number Diff line number Diff line change 1111
1212#include <autoconf.h>
1313
14+ #include <zephyr/kernel.h>
15+
1416#include <intel_adsp_ipc.h>
1517#include <sof/ipc/common.h>
1618
@@ -309,3 +311,23 @@ int platform_ipc_init(struct ipc *ipc)
309311
310312 return 0 ;
311313}
314+
315+ static bool ipc_wait_complete (const struct device * dev , void * arg )
316+ {
317+ k_sem_give (arg );
318+ return false;
319+ }
320+
321+ void ipc_platform_wait_ack (struct ipc * ipc )
322+ {
323+ static struct k_sem ipc_wait_sem ;
324+
325+ k_sem_init (& ipc_wait_sem , 0 , 1 );
326+
327+ intel_adsp_ipc_set_done_handler (INTEL_ADSP_IPC_HOST_DEV , ipc_wait_complete , & ipc_wait_sem );
328+
329+ if (k_sem_take (& ipc_wait_sem , Z_TIMEOUT_MS (10 )) == - EAGAIN )
330+ tr_err (& ipc_tr , "Timeout waiting for host ack!" );
331+
332+ intel_adsp_ipc_set_done_handler (INTEL_ADSP_IPC_HOST_DEV , NULL , NULL );
333+ }
Original file line number Diff line number Diff line change @@ -973,7 +973,7 @@ static int ipc_glb_gdb_debug(uint32_t header)
973973 (void ) header ;
974974
975975#if CONFIG_GDBSTUB
976- gdb_init () ;
976+ ipc_enter_gdb = true ;
977977 return 0 ;
978978// TODO: remove old GDB stub?
979979#elif CONFIG_GDB_DEBUG
You can’t perform that action at this time.
0 commit comments