Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/31491
Change subject: [WIP] console: Refactor printk() varargs prototypes ......................................................................
[WIP] console: Refactor printk() varargs prototypes
Change-Id: I816641c2223c3079ad9c95c1380d4b250898ef93 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M src/console/printk.c M src/include/console/console.h 2 files changed, 16 insertions(+), 25 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/91/31491/1
diff --git a/src/console/printk.c b/src/console/printk.c index 735876e..c53f030 100644 --- a/src/console/printk.c +++ b/src/console/printk.c @@ -39,9 +39,8 @@ do_putchar(byte); }
-int do_printk(int msg_level, const char *fmt, ...) +int do_printk_va_list(int msg_level, const char *fmt, va_list args) { - va_list args; int i;
if (IS_ENABLED(CONFIG_SQUELCH_EARLY_SMP) && ENV_CACHE_AS_RAM && @@ -60,9 +59,7 @@ spin_lock(&console_lock); #endif
- va_start(args, fmt); i = vtxprintf(wrap_putchar, fmt, args, NULL); - va_end(args);
console_tx_flush();
@@ -77,13 +74,3 @@
return i; } - -#if IS_ENABLED(CONFIG_VBOOT) -void do_printk_va_list(int msg_level, const char *fmt, va_list args) -{ - if (!console_log_level(msg_level)) - return; - vtxprintf(wrap_putchar, fmt, args, NULL); - console_tx_flush(); -} -#endif /* CONFIG_VBOOT */ diff --git a/src/include/console/console.h b/src/include/console/console.h index 7ab61ea..bdddc98 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -19,6 +19,7 @@ #include <stdint.h> #include <arch/cpu.h> #include <console/post_codes.h> +#include <console/vtxprintf.h> #include <commonlib/loglevel.h>
#define RAM_DEBUG (IS_ENABLED(CONFIG_DEBUG_RAM_SETUP) ? BIOS_DEBUG : BIOS_NEVER) @@ -56,8 +57,6 @@ #if __CONSOLE_ENABLE__ asmlinkage void console_init(void); int console_log_level(int msg_level); -int do_printk(int msg_level, const char *fmt, ...) - __attribute__((format(printf, 2, 3))); void do_putchar(unsigned char byte);
#define printk(LEVEL, fmt, args...) \ @@ -82,15 +81,20 @@ static inline void do_putchar(unsigned char byte) {} #endif
-#if IS_ENABLED(CONFIG_VBOOT) -/* FIXME: Collision of varargs with AMD headers without guard. */ -#include <console/vtxprintf.h> -#if __CONSOLE_ENABLE__ -void do_printk_va_list(int msg_level, const char *fmt, va_list args); -#else -static inline void do_printk_va_list(int l, const char *fmt, va_list args) {} -#endif -#endif +int do_printk_va_list(int msg_level, const char *fmt, va_list args); + +static inline __attribute__((format(printf, 2, 3))) +int do_printk(int msg_level, const char *fmt, ...) +{ + va_list args; + int i; + + va_start(args, fmt); + i = do_printk_va_list(msg_level, fmt, args); + va_end(args); + + return i; +}
#endif /* !__ROMCC__ */