2003-04-22 21:02:15 +02:00
|
|
|
/*
|
2013-07-09 00:22:54 +02:00
|
|
|
* blatantly copied from linux/kernel/printk.c
|
2003-04-22 21:02:15 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2014-01-27 14:09:13 +01:00
|
|
|
#include <smp/node.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
#include <smp/spinlock.h>
|
2009-10-24 15:06:04 +02:00
|
|
|
#include <console/vtxprintf.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
#include <console/console.h>
|
2011-09-02 23:23:41 +02:00
|
|
|
#include <trace.h>
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2009-11-12 17:38:03 +01:00
|
|
|
DECLARE_SPIN_LOCK(console_lock)
|
2003-04-22 21:02:15 +02:00
|
|
|
|
|
|
|
int do_printk(int msg_level, const char *fmt, ...)
|
|
|
|
{
|
|
|
|
va_list args;
|
|
|
|
int i;
|
|
|
|
|
2014-02-28 13:37:27 +01:00
|
|
|
if (!console_log_level(msg_level))
|
2003-04-22 21:02:15 +02:00
|
|
|
return 0;
|
|
|
|
|
2014-01-27 14:09:13 +01:00
|
|
|
#if CONFIG_SQUELCH_EARLY_SMP && defined(__PRE_RAM__)
|
|
|
|
if (!boot_cpu())
|
|
|
|
return 0;
|
|
|
|
#endif
|
|
|
|
|
2011-09-02 23:23:41 +02:00
|
|
|
DISABLE_TRACE;
|
2003-04-22 21:02:15 +02:00
|
|
|
spin_lock(&console_lock);
|
|
|
|
|
|
|
|
va_start(args, fmt);
|
|
|
|
i = vtxprintf(console_tx_byte, fmt, args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
console_tx_flush();
|
|
|
|
|
|
|
|
spin_unlock(&console_lock);
|
2011-09-02 23:23:41 +02:00
|
|
|
ENABLE_TRACE;
|
2003-04-22 21:02:15 +02:00
|
|
|
|
|
|
|
return i;
|
|
|
|
}
|