2003-04-22 21:02:15 +02:00
|
|
|
/*
|
|
|
|
* blantantly copied from linux/kernel/printk.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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-06-30 17:17:49 +02:00
|
|
|
int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
|
|
|
|
int default_console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
|
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;
|
|
|
|
|
2009-10-16 21:29:45 +02:00
|
|
|
if (msg_level > console_loglevel) {
|
2003-04-22 21:02:15 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
}
|