blob: 8f7fcb262f756e3650b919edc6af6de7dc5ef9e4 [file] [log] [blame]
Vadim Bendebury32da8be2011-09-29 17:27:15 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 The ChromiumOS Authors. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
18 */
19#ifndef _CONSOLE_CBMEM_CONSOLE_H_
20#define _CONSOLE_CBMEM_CONSOLE_H_
21
Kyösti Mälkkif3390862014-02-26 15:19:04 +020022#include <rules.h>
23#include <stdint.h>
24
Vadim Bendebury32da8be2011-09-29 17:27:15 -070025void cbmemc_init(void);
Vadim Bendebury32da8be2011-09-29 17:27:15 -070026void cbmemc_tx_byte(unsigned char data);
Kyösti Mälkkif3390862014-02-26 15:19:04 +020027
28#if CONFIG_CONSOLE_CBMEM
29void cbmemc_reinit(void);
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030030#else
Kyösti Mälkkif3390862014-02-26 15:19:04 +020031static inline void cbmemc_reinit(void) {}
32#endif
33
34#define __CBMEM_CONSOLE_ENABLE__ CONFIG_CONSOLE_CBMEM && \
Aaron Durbind70bf7c2015-04-20 15:24:19 -050035 (ENV_RAMSTAGE || (IS_ENABLED(CONFIG_EARLY_CBMEM_INIT) && \
36 (ENV_ROMSTAGE || (ENV_BOOTBLOCK && CONFIG_BOOTBLOCK_CONSOLE))))
Kyösti Mälkkif3390862014-02-26 15:19:04 +020037
38#if __CBMEM_CONSOLE_ENABLE__
39static inline void __cbmemc_init(void) { cbmemc_init(); }
40static inline void __cbmemc_tx_byte(u8 data) { cbmemc_tx_byte(data); }
41#else
42static inline void __cbmemc_init(void) {}
43static inline void __cbmemc_tx_byte(u8 data) {}
Kyösti Mälkkia2f6af32013-09-10 13:50:32 +030044#endif
Vadim Bendebury32da8be2011-09-29 17:27:15 -070045
Vadim Bendebury6e20e2f2015-04-10 18:04:04 -070046void cbmem_dump_console(void);
Vadim Bendebury32da8be2011-09-29 17:27:15 -070047#endif