2010-09-27 20:49:46 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the coreboot project.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2003 Eric Biederman
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
#ifndef CONSOLE_CONSOLE_H_
|
|
|
|
#define CONSOLE_CONSOLE_H_
|
|
|
|
|
2010-09-27 22:51:33 +02:00
|
|
|
#include <stdint.h>
|
2014-02-26 14:19:04 +01:00
|
|
|
#include <rules.h>
|
2016-07-31 20:53:28 +02:00
|
|
|
#include <arch/cpu.h>
|
2011-04-11 22:17:22 +02:00
|
|
|
#include <console/post_codes.h>
|
2015-09-08 20:34:43 +02:00
|
|
|
#include <commonlib/loglevel.h>
|
2011-05-10 19:46:41 +02:00
|
|
|
|
2010-03-31 16:34:40 +02:00
|
|
|
#ifndef __ROMCC__
|
2014-04-23 22:11:40 +02:00
|
|
|
|
2010-04-03 00:11:20 +02:00
|
|
|
void post_code(u8 value);
|
2013-06-10 19:21:41 +02:00
|
|
|
#if CONFIG_CMOS_POST_EXTRA
|
|
|
|
void post_log_extra(u32 value);
|
2013-06-10 19:34:20 +02:00
|
|
|
struct device;
|
|
|
|
void post_log_path(struct device *dev);
|
|
|
|
void post_log_clear(void);
|
2013-06-10 19:21:41 +02:00
|
|
|
#else
|
|
|
|
#define post_log_extra(x) do {} while (0)
|
2013-06-10 19:34:20 +02:00
|
|
|
#define post_log_path(x) do {} while (0)
|
|
|
|
#define post_log_clear() do {} while (0)
|
2013-06-10 19:21:41 +02:00
|
|
|
#endif
|
2012-08-03 20:20:57 +02:00
|
|
|
/* this function is weak and can be overridden by a mainboard function. */
|
|
|
|
void mainboard_post(u8 value);
|
2010-04-03 00:11:20 +02:00
|
|
|
void __attribute__ ((noreturn)) die(const char *msg);
|
2003-04-22 21:02:15 +02:00
|
|
|
|
2014-02-26 14:19:04 +01:00
|
|
|
#define __CONSOLE_ENABLE__ \
|
2016-09-16 23:20:24 +02:00
|
|
|
((ENV_BOOTBLOCK && IS_ENABLED(CONFIG_BOOTBLOCK_CONSOLE)) || \
|
|
|
|
(ENV_POSTCAR && IS_ENABLED(CONFIG_POSTCAR_CONSOLE)) || \
|
2017-03-02 11:29:59 +01:00
|
|
|
ENV_VERSTAGE || ENV_ROMSTAGE || ENV_RAMSTAGE || ENV_LIBAGESA || \
|
2015-10-14 17:08:10 +02:00
|
|
|
(ENV_SMM && CONFIG_DEBUG_SMI))
|
2014-02-04 18:03:57 +01:00
|
|
|
|
2014-02-26 14:19:04 +01:00
|
|
|
#if __CONSOLE_ENABLE__
|
2016-07-31 20:53:28 +02:00
|
|
|
asmlinkage void console_init(void);
|
2014-02-26 14:19:04 +01:00
|
|
|
int console_log_level(int msg_level);
|
2017-03-08 02:45:12 +01:00
|
|
|
int do_printk(int msg_level, const char *fmt, ...)
|
|
|
|
__attribute__((format(printf, 2, 3)));
|
2014-02-04 18:03:57 +01:00
|
|
|
void do_putchar(unsigned char byte);
|
2013-02-06 14:51:15 +01:00
|
|
|
|
2016-09-01 19:01:41 +02:00
|
|
|
#define printk(LEVEL, fmt, args...) \
|
|
|
|
do { do_printk(LEVEL, fmt, ##args); } while (0)
|
2010-03-23 14:23:40 +01:00
|
|
|
|
2014-02-26 14:19:04 +01:00
|
|
|
#else
|
|
|
|
static inline void console_init(void) {}
|
|
|
|
static inline int console_log_level(int msg_level) { return 0; }
|
|
|
|
static inline void printk(int LEVEL, const char *fmt, ...) {}
|
|
|
|
static inline void do_putchar(unsigned char byte) {}
|
2014-02-04 18:03:57 +01:00
|
|
|
#endif
|
2013-02-06 14:51:15 +01:00
|
|
|
|
2016-08-16 01:14:15 +02:00
|
|
|
#if IS_ENABLED(CONFIG_VBOOT)
|
2014-03-06 15:55:05 +01:00
|
|
|
/* FIXME: Collision of varargs with AMD headers without guard. */
|
|
|
|
#include <console/vtxprintf.h>
|
2014-02-26 14:19:04 +01:00
|
|
|
#if __CONSOLE_ENABLE__
|
2015-05-01 23:48:54 +02:00
|
|
|
void do_printk_va_list(int msg_level, const char *fmt, va_list args);
|
2014-03-06 15:55:05 +01:00
|
|
|
#else
|
2015-05-01 23:48:54 +02:00
|
|
|
static inline void do_printk_va_list(int l, const char *fmt, va_list args) {}
|
2014-03-06 15:55:05 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2015-01-05 22:12:38 +01:00
|
|
|
#endif /* !__ROMCC__ */
|
2010-05-08 11:14:51 +02:00
|
|
|
|
2003-04-22 21:02:15 +02:00
|
|
|
#endif /* CONSOLE_CONSOLE_H_ */
|