--- zzzz-none-000/linux-5.15.111/kernel/printk/printk.c 2023-05-11 14:00:40.000000000 +0000 +++ puma7-arm-6670-761/linux-5.15.111/kernel/printk/printk.c 2024-02-07 09:28:08.000000000 +0000 @@ -2293,6 +2293,40 @@ } EXPORT_SYMBOL(_printk); +#ifdef CONFIG_AVM_DEBUG +static int force_printk_avm = 0; +static bool no_avm_printk = false; +core_param(no_avm_printk, no_avm_printk, bool, 0644); + +#define FORCE_PRINTK_LINUX_FACILITIES_VALUE 0x100 +asmlinkage int printk_linux(const char *fmt, ...) { + va_list args; + int r; + + va_start(args, fmt); + r = vprintk_emit(FORCE_PRINTK_LINUX_FACILITIES_VALUE, -1, NULL, fmt, args); + va_end(args); + return r; +} +EXPORT_SYMBOL(printk_linux); + +/*--------------------------------------------------------------------------------*\ + * ret: old-mode: 1 bended, 0: std.printk +\*--------------------------------------------------------------------------------*/ +int printk_avm_console_bend(unsigned int activate) { + int ret = 0; + ret = force_printk_avm; + if (activate && no_avm_printk) + pr_notice_once("AVM printk disabled by cmdline (no_avm_printk)\n"); + else + force_printk_avm = activate ? 1 : 0; + return ret; +} +EXPORT_SYMBOL(printk_avm_console_bend); + +#endif /* CONFIG_AVM_DEBUG */ + + #else /* CONFIG_PRINTK */ #define CONSOLE_LOG_MAX 0 @@ -3357,6 +3391,18 @@ static DEFINE_SPINLOCK(dump_list_lock); static LIST_HEAD(dump_list); +#if defined(CONFIG_AVM_DEBUG) +/* AVM/TLG: TODO: Better use the function from avm_sammel */ +bool kmsg_dump_get_buffer_nocontext(bool syslog, char *buf, size_t size, + size_t *len) +{ + struct kmsg_dump_iter iter; + + kmsg_dump_rewind(&iter); + + return kmsg_dump_get_buffer(&iter, 0, buf, size, len); +} +#endif/*--- #if defined(CONFIG_AVM_DEBUG) ---*/ /** * kmsg_dump_register - register a kernel log dumper. * @dumper: pointer to the kmsg_dumper structure