source: trunk/src/console/printk.c

Last change on this file was 5215, checked in by stepan, 5 years ago

This patch is what I needed to compile coreboot with LLVM.

  • call va_* directly if coreboot is running on GCC so we don't need to maintain hacks to get to stdarg.h
  • only define LIBGCC_FILE_NAME if it's an absolute path. GCC and LLVM just print "libgcc.a" if the file is not there.

Signed-off-by: Stefan Reinauer <stepan@…>
Acked-by: Ronald G. Minnich <rminnich@…>

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 654 bytes
Line 
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}
Note: See TracBrowser for help on using the repository browser.