diff options
-rw-r--r-- | zephyr/Kconfig.console | 11 | ||||
-rw-r--r-- | zephyr/shim/src/console.c | 10 |
2 files changed, 20 insertions, 1 deletions
diff --git a/zephyr/Kconfig.console b/zephyr/Kconfig.console index 602a2ea26a..c1edee71d5 100644 --- a/zephyr/Kconfig.console +++ b/zephyr/Kconfig.console @@ -51,3 +51,14 @@ config PLATFORM_EC_HOSTCMD_CONSOLE_BUF_SIZE modular arithmetic is used. endif # PLATFORM_EC_HOSTCMD_CONSOLE + +config PLATFORM_EC_CONSOLE_USES_PRINTK + bool "Console uses printk" + depends on CONSOLE + help + Implement zephyr_print using printk for all cases instead + of using shell_fprintf for non-ISR uses in + shim/common/console.c. + Some devices have not been able to output to the console + fast enough using shell_fprintf and end up timing out + unrelated functionality. diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c index ae3ae51deb..39176a45e0 100644 --- a/zephyr/shim/src/console.c +++ b/zephyr/shim/src/console.c @@ -274,7 +274,15 @@ static void zephyr_print(const char *buff, size_t size) if (k_is_in_isr() || shell_zephyr->ctx->state != SHELL_STATE_ACTIVE) printk("%s", buff); else { - shell_fprintf(shell_zephyr, SHELL_NORMAL, "%s", buff); + /* + * On some platforms, shell_* functions are not as fast + * as printk and they need the added speed to avoid + * timeouts. + */ + if (IS_ENABLED(CONFIG_PLATFORM_EC_CONSOLE_USES_PRINTK)) + printk("%s", buff); + else + shell_fprintf(shell_zephyr, SHELL_NORMAL, "%s", buff); if (IS_ENABLED(CONFIG_PLATFORM_EC_HOSTCMD_CONSOLE)) console_buf_notify_chars(buff, size); } |