diff --git a/CODEOWNERS b/CODEOWNERS index 734218b9cc28..7d442e34cbe0 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -14,6 +14,7 @@ src/include/sof/dmic.h @singalsu src/include/host/* @ranj063 src/include/uapi/* @bardliao src/include/uapi/ipc/* @xiulipan @bardliao +src/include/gdb/* @mrajwa # audio component src/audio/src* @singalsu @@ -36,6 +37,7 @@ src/host/* @ranj063 src/math/* @singalsu src/ipc/* @xiulipan @bardliao src/lib/* @libinyang +src/gdb/* @mrajwa # other helpers test/* @jajanusz diff --git a/src/include/sof/ipc.h b/src/include/sof/ipc.h index ad5ba282916f..c4890cdfd556 100644 --- a/src/include/sof/ipc.h +++ b/src/include/sof/ipc.h @@ -123,7 +123,7 @@ struct ipc { #define ipc_set_drvdata(ipc, data) \ (ipc)->private = data #define ipc_get_drvdata(ipc) \ - (ipc)->private; + (ipc)->private int ipc_init(struct sof *sof); diff --git a/src/include/uapi/ipc/header.h b/src/include/uapi/ipc/header.h index e2a1f7a3f3b2..2e1bf073aa11 100644 --- a/src/include/uapi/ipc/header.h +++ b/src/include/uapi/ipc/header.h @@ -78,6 +78,7 @@ #define SOF_IPC_FW_READY SOF_GLB_TYPE(0x7U) #define SOF_IPC_GLB_DAI_MSG SOF_GLB_TYPE(0x8U) #define SOF_IPC_GLB_TRACE_MSG SOF_GLB_TYPE(0x9U) +#define SOF_IPC_GLB_GDB_DEBUG SOF_GLB_TYPE(0xAU) /* * DSP Command Message Types diff --git a/src/include/uapi/ipc/info.h b/src/include/uapi/ipc/info.h index 24b0e2cec11f..1efe454f935e 100644 --- a/src/include/uapi/ipc/info.h +++ b/src/include/uapi/ipc/info.h @@ -86,6 +86,8 @@ struct sof_ipc_fw_ready { uint64_t locks_verbose:1; } debug; + uint32_t gdb_enabled; + /* reserved for future use */ uint32_t reserved[4]; } __attribute__((packed)); diff --git a/src/ipc/handler.c b/src/ipc/handler.c index c53e7911b4a9..bd72416358af 100644 --- a/src/ipc/handler.c +++ b/src/ipc/handler.c @@ -651,7 +651,6 @@ static int ipc_dma_trace_config(uint32_t header) struct sof_ipc_dma_trace_params *params = _ipc->comp_data; int err; - /* sanity check size */ if (IPC_INVALID_SIZE(params)) { trace_ipc_error("ipc:_invalid IPC size 0x%x got 0x%x", @@ -743,6 +742,21 @@ static int ipc_glb_debug_message(uint32_t header) } } +static int ipc_glb_gdb_debug(uint32_t header) +{ + /* no furher information needs to be extracted form header */ + (void) header; + +#ifdef CONFIG_GDB_DEBUG + /* trigger debug exception */ + asm volatile("_break 0, 0"); + return 0; +#else + return -EINVAL; +#endif + +} + /* * Topology IPC Operations. */ @@ -1018,6 +1032,8 @@ int ipc_cmd(void) return ipc_glb_dai_message(hdr->cmd); case iGS(SOF_IPC_GLB_TRACE_MSG): return ipc_glb_debug_message(hdr->cmd); + case iGS(SOF_IPC_GLB_GDB_DEBUG): + return ipc_glb_gdb_debug(hdr->cmd); default: trace_ipc_error("ipc: unknown command type %u", type); return -EINVAL; diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index c8e6c095eb38..e6cbf64fccc2 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -77,7 +77,7 @@ static const struct sof_ipc_fw_ready ready .tag = SOF_TAG, .abi_version = SOF_ABI_VERSION, }, - .debug = DEBUG_SET_FW_READY_FLAGS, + .debug = DEBUG_SET_FW_READY_FLAGS }; #define NUM_BYT_WINDOWS 6 diff --git a/src/platform/intel/cavs/platform.c b/src/platform/intel/cavs/platform.c index 2cca8045eaf8..c8e7091a29e2 100644 --- a/src/platform/intel/cavs/platform.c +++ b/src/platform/intel/cavs/platform.c @@ -78,6 +78,11 @@ static const struct sof_ipc_fw_ready ready .abi_version = SOF_ABI_VERSION, }, .debug = DEBUG_SET_FW_READY_FLAGS, + +#ifdef CONFIG_GDB_DEBUG + .gdb_enabled = CONFIG_GDB_DEBUG +#endif + }; #if defined(CONFIG_MEM_WND)