1/* 2 * blantantly copied from linux/kernel/printk.c 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 * 6 */ 7 8#include <smp/spinlock.h> 9#include <console/vtxprintf.h> 10#include <console/console.h> 11 12int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; 13int default_console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; 14 15DECLARE_SPIN_LOCK(console_lock) 16 17int do_printk(int msg_level, const char *fmt, ...) 18{ 19 va_list args; 20 int i; 21 22 if (msg_level > console_loglevel) { 23 return 0; 24 } 25 26 spin_lock(&console_lock); 27 28 va_start(args, fmt); 29 i = vtxprintf(console_tx_byte, fmt, args); 30 va_end(args); 31 32 console_tx_flush(); 33 34 spin_unlock(&console_lock); 35 36 return i; 37} 38

