arm, arm64, x86: add vprintk to early console

vprintk is created out of do_printk for all the archs.

BUG=none
TEST=Built Nyans, Falco, and Ryu. Verified serial output on Blaze and Falco.
BRANCH=none
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

Change-Id: Idf708359f0e9e9a9f32a601a5a117e469d5025ba
Reviewed-on: https://chromium-review.googlesource.com/214566
Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
This commit is contained in:
Daisuke Nojiri 2014-08-27 10:39:05 -07:00 committed by chrome-internal-fetch
commit 75a0e78b5d
7 changed files with 66 additions and 63 deletions

View file

@ -61,21 +61,3 @@ void console_tx_flush(void)
usbdebug_tx_flush(0);
#endif
}
int do_printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
if (msg_level > console_loglevel) {
return 0;
}
va_start(args, fmt);
i = vtxprintf(console_tx_byte, fmt, args);
va_end(args);
console_tx_flush();
return i;
}

View file

@ -55,21 +55,3 @@ void console_tx_flush(void)
usbdebug_tx_flush(0);
#endif
}
int do_printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
if (msg_level > console_loglevel) {
return 0;
}
va_start(args, fmt);
i = vtxprintf(console_tx_byte, fmt, args);
va_end(args);
console_tx_flush();
return i;
}

View file

@ -69,21 +69,3 @@ void console_tx_flush(void)
usbdebug_tx_flush(0);
#endif
}
int do_printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
if (msg_level > console_loglevel) {
return 0;
}
va_start(args, fmt);
i = vtxprintf(console_tx_byte, fmt, args);
va_end(args);
console_tx_flush();
return i;
}

View file

@ -9,16 +9,16 @@ smm-y += printk.c
smm-y += vtxprintf.c
smm-$(CONFIG_SMM_TSEG) += die.c
verstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c
verstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c early_console.c
verstage-y += console.c
verstage-y += die.c
romstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c
romstage-$(CONFIG_EARLY_CONSOLE) += vtxprintf.c early_console.c
romstage-y += console.c
romstage-y += post.c
romstage-y += die.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += vtxprintf.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += vtxprintf.c early_console.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += console.c
bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += die.c

View file

@ -0,0 +1,47 @@
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2014 Google, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <console/console.h>
#include <console/vtxprintf.h>
int vprintk(int msg_level, const char *fmt, va_list args)
{
int i;
if (msg_level > console_loglevel)
return 0;
i = vtxprintf(console_tx_byte, fmt, args);
console_tx_flush();
return i;
}
int do_printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i = vprintk(msg_level, fmt, args);
va_end(args);
return i;
}

View file

@ -15,21 +15,17 @@ int default_console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
DECLARE_SPIN_LOCK(console_lock)
int do_printk(int msg_level, const char *fmt, ...)
int vprintk(int msg_level, const char *fmt, va_list args)
{
va_list args;
int i;
if (msg_level > console_loglevel) {
if (msg_level > console_loglevel)
return 0;
}
DISABLE_TRACE;
spin_lock(&console_lock);
va_start(args, fmt);
i = vtxprintf(console_tx_byte, fmt, args);
va_end(args);
console_tx_flush();
@ -38,3 +34,15 @@ int do_printk(int msg_level, const char *fmt, ...)
return i;
}
int do_printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i = vprintk(msg_level, fmt, args);
va_end(args);
return i;
}

View file

@ -23,6 +23,7 @@
#include <stdint.h>
#include <console/loglevel.h>
#include <console/post_codes.h>
#include <console/vtxprintf.h>
#if CONFIG_CONSOLE_SERIAL
#include <uart.h>
@ -81,6 +82,7 @@ void post_log_clear(void);
void mainboard_post(u8 value);
void __attribute__ ((noreturn)) die(const char *msg);
int do_printk(int msg_level, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
int vprintk(int msg_level, const char *fmt, va_list args);
#if defined(__BOOT_BLOCK__) && !CONFIG_BOOTBLOCK_CONSOLE || \
(defined(__PRE_RAM__) && !defined(__BOOT_BLOCK__)) && !CONFIG_EARLY_CONSOLE