-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Logging with probes was not implemented. This implements ipc that enables logging with probe configuration. Signed-off-by: Jakub Dabek <[email protected]>
- Loading branch information
1 parent
d964b7b
commit 84c2126
Showing
5 changed files
with
65 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,26 @@ | |
// | ||
// Author: Kai Vehmanen <[email protected]> | ||
|
||
#if CONFIG_LOG_BACKEND_SOF_PROBE && CONFIG_LOG_BACKEND_ADSP_MTRACE | ||
#error Cannot have both backends enabled | ||
#endif | ||
|
||
#include <stdint.h> | ||
#include <sof/lib/uuid.h> | ||
#include <sof/ipc/common.h> | ||
#include <ipc4/base_fw.h> | ||
#include <ipc4/error_status.h> | ||
#include <ipc4/logging.h> | ||
#include <zephyr/logging/log_backend.h> | ||
#include <zephyr/logging/log.h> | ||
|
||
#ifdef CONFIG_LOG_BACKEND_SOF_PROBE | ||
#include <sof/probe/probe.h> | ||
#endif | ||
|
||
#ifdef CONFIG_LOG_BACKEND_ADSP_MTRACE | ||
|
||
#include <zephyr/logging/log_backend.h> | ||
#include <zephyr/logging/log_backend_adsp_mtrace.h> | ||
#include <zephyr/logging/log.h> | ||
|
||
#include <sof/schedule/edf_schedule.h> | ||
#include <sof/schedule/schedule.h> | ||
|
@@ -150,27 +158,49 @@ int ipc4_logging_enable_logs(bool first_block, | |
return 0; | ||
} | ||
|
||
int ipc4_logging_shutdown(void) | ||
{ | ||
struct ipc4_log_state_info log_state = { 0 }; | ||
|
||
/* log_state.enable set to 0 above */ | ||
|
||
return ipc4_logging_enable_logs(true, true, sizeof(log_state), (char *)&log_state); | ||
} | ||
#endif | ||
|
||
#else | ||
#ifdef CONFIG_LOG_BACKEND_SOF_PROBE | ||
int ipc4_logging_enable_logs(bool first_block, | ||
bool last_block, | ||
uint32_t data_offset_or_size, | ||
const char *data) | ||
{ | ||
return IPC4_UNKNOWN_MESSAGE_TYPE; | ||
} | ||
const struct log_backend *log_backend = log_backend_probe_get(); | ||
const struct ipc4_log_state_info *log_state; | ||
|
||
if (!(first_block && last_block)) | ||
return -EINVAL; | ||
|
||
if (data_offset_or_size < sizeof(struct ipc4_log_state_info)) | ||
return -EINVAL; | ||
|
||
/* Make sure we work on correct ipc data by invalidating cache */ | ||
dcache_invalidate_region((__sparse_force void __sparse_cache *)data, data_offset_or_size); | ||
|
||
log_state = (const struct ipc4_log_state_info *)data; | ||
|
||
if (log_state->enable) { | ||
if (!probe_is_backend_configured()) | ||
return -EINVAL; | ||
|
||
log_backend_activate(log_backend, probe_logging_hook); | ||
|
||
} else { | ||
probe_logging_init(NULL); | ||
log_backend_deactivate(log_backend); | ||
} | ||
|
||
int ipc4_logging_shutdown(void) | ||
{ | ||
return 0; | ||
} | ||
|
||
#endif | ||
|
||
int ipc4_logging_shutdown(void) | ||
{ | ||
struct ipc4_log_state_info log_state = { 0 }; | ||
|
||
/* log_state.enable set to 0 above */ | ||
|
||
return ipc4_logging_enable_logs(true, true, sizeof(log_state), (char *)&log_state); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters