blob: 8f40abbe3725c7d78970f3d8246ea30c0e396a36 [file] [log] [blame]
Kyösti Mälkki21333f92014-02-14 10:04:31 +02001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2003 Eric Biederman
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
9 * the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Kyösti Mälkki21333f92014-02-14 10:04:31 +020015 */
16
Kyösti Mälkki21333f92014-02-14 10:04:31 +020017#include <console/console.h>
18#include <console/uart.h>
Kyösti Mälkki40760722014-02-27 19:30:18 +020019#include <console/streams.h>
Kyösti Mälkkif9cdb482014-11-18 13:21:50 +020020#include <device/pci.h>
Kyösti Mälkki21333f92014-02-14 10:04:31 +020021#include <option.h>
Aaron Durbinaab13262015-05-13 13:32:11 -050022#include <rules.h>
Kyösti Mälkkic36af7b2014-11-18 12:41:16 +020023#include <version.h>
Kyösti Mälkki21333f92014-02-14 10:04:31 +020024
Kyösti Mälkki56ae1392014-02-28 14:37:27 +020025/* While in romstage, console loglevel is built-time constant. */
26static ROMSTAGE_CONST int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
27
28int console_log_level(int msg_level)
29{
30 return (console_loglevel >= msg_level);
31}
Kyösti Mälkkib2d25962014-01-27 15:09:13 +020032
Kyösti Mälkki21333f92014-02-14 10:04:31 +020033void console_init(void)
34{
35#if !defined(__PRE_RAM__)
Varad Gautam06ef0462015-03-11 09:54:41 +053036 console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
37 get_option(&console_loglevel, "debug_level");
Kyösti Mälkki21333f92014-02-14 10:04:31 +020038#endif
39
Kyösti Mälkki40760722014-02-27 19:30:18 +020040#if CONFIG_EARLY_PCI_BRIDGE && !defined(__SMM__)
Kyösti Mälkki21333f92014-02-14 10:04:31 +020041 pci_early_bridge_init();
42#endif
43
44 console_hw_init();
45
Ben Gardneraa5f5b12015-11-19 10:48:47 -060046 printk(BIOS_INFO, "\n\ncoreboot-%s%s %s " ENV_STRING " starting...\n",
47 coreboot_version, coreboot_extra_version, coreboot_build);
Kyösti Mälkki21333f92014-02-14 10:04:31 +020048}