summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2014-02-28 14:37:27 +0200
committerPatrick Georgi <patrick@georgi-clan.de>2014-04-09 11:38:12 +0200
commit56ae13983bae2ba4214dd635c46afad7e7bc50c1 (patch)
tree99f8aa55ebc7929e9599c033d925a4247e4fe257 /src/arch
parentb2d25967142437a82da150d0134923e3fd783dbf (diff)
downloadcoreboot-56ae13983bae2ba4214dd635c46afad7e7bc50c1.tar.xz
console: Hide global console_loglevel
Change-Id: I7bdc468bc3f74516abb2c583bdb5b6d7555d987c Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Reviewed-on: http://review.coreboot.org/5333 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <patrick@georgi-clan.de>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/x86/lib/romcc_console.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/arch/x86/lib/romcc_console.c b/src/arch/x86/lib/romcc_console.c
index 3f8f62fa48..a6e8ecc1f9 100644
--- a/src/arch/x86/lib/romcc_console.c
+++ b/src/arch/x86/lib/romcc_console.c
@@ -17,18 +17,11 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <stdint.h>
-#include <console/loglevel.h>
-#include <console/post_codes.h>
#include <console/uart.h>
#include <console/ne2k.h>
-/* __PRE_RAM__ */
-/* Using a global varible can cause problems when we reset the stack
- * from cache as ram to ram. If we make this a define USE_SHARED_STACK
- * we could use the same code on all architectures.
- */
-#define console_loglevel CONFIG_DEFAULT_CONSOLE_LOGLEVEL
+/* While in romstage, console loglevel is built-time constant. */
+#define console_log_level(msg_level) (CONFIG_DEFAULT_CONSOLE_LOGLEVEL >= msg_level)
#if CONFIG_CONSOLE_SERIAL && CONFIG_DRIVERS_UART_8250IO
#include "drivers/uart/util.c"
@@ -60,7 +53,7 @@ static void __console_tx_nibble(unsigned nibble)
static void __console_tx_char(int loglevel, unsigned char byte)
{
- if (console_loglevel >= loglevel) {
+ if (console_log_level(loglevel)) {
#if CONFIG_CONSOLE_SERIAL
uart_tx_byte(byte);
#endif
@@ -73,7 +66,7 @@ static void __console_tx_char(int loglevel, unsigned char byte)
static void __console_tx_hex8(int loglevel, unsigned char value)
{
- if (console_loglevel >= loglevel) {
+ if (console_log_level(loglevel)) {
__console_tx_nibble((value >> 4U) & 0x0fU);
__console_tx_nibble(value & 0x0fU);
}
@@ -84,7 +77,7 @@ static void __console_tx_hex8(int loglevel, unsigned char value)
static void __console_tx_hex16(int loglevel, unsigned short value)
{
- if (console_loglevel >= loglevel) {
+ if (console_log_level(loglevel)) {
__console_tx_nibble((value >> 12U) & 0x0fU);
__console_tx_nibble((value >> 8U) & 0x0fU);
__console_tx_nibble((value >> 4U) & 0x0fU);
@@ -97,7 +90,7 @@ static void __console_tx_hex16(int loglevel, unsigned short value)
static void __console_tx_hex32(int loglevel, unsigned int value)
{
- if (console_loglevel >= loglevel) {
+ if (console_log_level(loglevel)) {
__console_tx_nibble((value >> 28U) & 0x0fU);
__console_tx_nibble((value >> 24U) & 0x0fU);
__console_tx_nibble((value >> 20U) & 0x0fU);
@@ -114,7 +107,7 @@ static void __console_tx_hex32(int loglevel, unsigned int value)
static void __console_tx_string(int loglevel, const char *str)
{
- if (console_loglevel >= loglevel) {
+ if (console_log_level(loglevel)) {
unsigned char ch;
while((ch = *str++) != '\0') {
if (ch == '\n')