Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 1 | /* |
| 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. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
Patrick Georgi | b890a12 | 2015-03-26 15:17:45 +0100 | [diff] [blame] | 18 | * Foundation, Inc. |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 19 | */ |
| 20 | |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 21 | #include <console/console.h> |
| 22 | #include <console/uart.h> |
Kyösti Mälkki | 4076072 | 2014-02-27 19:30:18 +0200 | [diff] [blame] | 23 | #include <console/streams.h> |
Kyösti Mälkki | f9cdb48 | 2014-11-18 13:21:50 +0200 | [diff] [blame] | 24 | #include <device/pci.h> |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 25 | #include <option.h> |
Aaron Durbin | aab1326 | 2015-05-13 13:32:11 -0500 | [diff] [blame] | 26 | #include <rules.h> |
Kyösti Mälkki | c36af7b | 2014-11-18 12:41:16 +0200 | [diff] [blame] | 27 | #include <version.h> |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 28 | |
Kyösti Mälkki | 56ae139 | 2014-02-28 14:37:27 +0200 | [diff] [blame] | 29 | /* While in romstage, console loglevel is built-time constant. */ |
| 30 | static ROMSTAGE_CONST int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; |
| 31 | |
| 32 | int console_log_level(int msg_level) |
| 33 | { |
| 34 | return (console_loglevel >= msg_level); |
| 35 | } |
Kyösti Mälkki | b2d2596 | 2014-01-27 15:09:13 +0200 | [diff] [blame] | 36 | |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 37 | void console_init(void) |
| 38 | { |
| 39 | #if !defined(__PRE_RAM__) |
Varad Gautam | 06ef046 | 2015-03-11 09:54:41 +0530 | [diff] [blame] | 40 | console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL; |
| 41 | get_option(&console_loglevel, "debug_level"); |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 42 | #endif |
| 43 | |
Kyösti Mälkki | 4076072 | 2014-02-27 19:30:18 +0200 | [diff] [blame] | 44 | #if CONFIG_EARLY_PCI_BRIDGE && !defined(__SMM__) |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 45 | pci_early_bridge_init(); |
| 46 | #endif |
| 47 | |
| 48 | console_hw_init(); |
| 49 | |
Stefan Reinauer | 73307e0 | 2015-03-04 01:11:18 +0100 | [diff] [blame] | 50 | printk(BIOS_INFO, "\n\ncoreboot-%s%s %s %s starting...\n", |
| 51 | coreboot_version, coreboot_extra_version, coreboot_build, |
Aaron Durbin | aab1326 | 2015-05-13 13:32:11 -0500 | [diff] [blame] | 52 | #if ENV_BOOTBLOCK |
Stefan Reinauer | 73307e0 | 2015-03-04 01:11:18 +0100 | [diff] [blame] | 53 | "bootblock" |
Aaron Durbin | aab1326 | 2015-05-13 13:32:11 -0500 | [diff] [blame] | 54 | #elif ENV_ROMSTAGE |
Stefan Reinauer | 73307e0 | 2015-03-04 01:11:18 +0100 | [diff] [blame] | 55 | "romstage" |
Aaron Durbin | aab1326 | 2015-05-13 13:32:11 -0500 | [diff] [blame] | 56 | #elif ENV_RAMSTAGE |
Stefan Reinauer | 73307e0 | 2015-03-04 01:11:18 +0100 | [diff] [blame] | 57 | "ramstage" |
Aaron Durbin | aab1326 | 2015-05-13 13:32:11 -0500 | [diff] [blame] | 58 | #elif ENV_VERSTAGE |
| 59 | "verstage" |
| 60 | #elif ENV_SECMON |
| 61 | "secmon" |
| 62 | #else |
| 63 | "UNKNOWN" |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 64 | #endif |
Stefan Reinauer | 73307e0 | 2015-03-04 01:11:18 +0100 | [diff] [blame] | 65 | ); |
Kyösti Mälkki | 21333f9 | 2014-02-14 10:04:31 +0200 | [diff] [blame] | 66 | } |