Files
system76-coreboot/src/console/printk.c
Kyösti Mälkki 657e0be464 console: Move newline translation outside console_tx_byte
This gives us completely transparent low-level function to transmit
data.

Change-Id: I706791ff43d80a36a7252a4da0e6f3af92520db7
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/5336
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
2014-04-09 13:21:25 +02:00

59 lines
933 B
C

/*
* blatantly copied from linux/kernel/printk.c
*
* Copyright (C) 1991, 1992 Linus Torvalds
*
*/
#include <smp/node.h>
#include <smp/spinlock.h>
#include <console/vtxprintf.h>
#include <console/console.h>
#include <trace.h>
DECLARE_SPIN_LOCK(console_lock)
void do_putchar(unsigned char byte)
{
if (byte == '\n')
console_tx_byte('\r');
console_tx_byte(byte);
}
int do_printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
if (!console_log_level(msg_level))
return 0;
#if CONFIG_SQUELCH_EARLY_SMP && defined(__PRE_RAM__)
if (!boot_cpu())
return 0;
#endif
DISABLE_TRACE;
spin_lock(&console_lock);
va_start(args, fmt);
i = vtxprintf(do_putchar, fmt, args);
va_end(args);
console_tx_flush();
spin_unlock(&console_lock);
ENABLE_TRACE;
return i;
}
#if CONFIG_CHROMEOS
void do_vtxprintf(const char *fmt, va_list args)
{
vtxprintf(do_putchar, fmt, args);
console_tx_flush();
}
#endif