diff options
-rw-r--r-- | src/arch/x86/lib/romcc_console.c | 7 | ||||
-rw-r--r-- | src/console/die.c | 6 | ||||
-rw-r--r-- | src/console/post.c | 4 | ||||
-rw-r--r-- | src/include/assert.h | 27 | ||||
-rw-r--r-- | src/include/console/console.h | 12 | ||||
-rw-r--r-- | src/include/console/early_print.h | 54 | ||||
-rw-r--r-- | src/include/console/streams.h | 7 | ||||
-rw-r--r-- | src/lib/debug.c | 44 | ||||
-rw-r--r-- | src/lib/generic_dump_spd.c | 40 | ||||
-rw-r--r-- | src/lib/generic_sdram.c | 17 | ||||
-rw-r--r-- | src/lib/loaders/load_and_run_ramstage.c | 2 | ||||
-rw-r--r-- | src/lib/ramtest.c | 69 | ||||
-rw-r--r-- | src/mainboard/bifferos/bifferboard/romstage.c | 1 | ||||
-rw-r--r-- | src/mainboard/dmp/vortex86ex/romstage.c | 1 |
14 files changed, 48 insertions, 243 deletions
diff --git a/src/arch/x86/lib/romcc_console.c b/src/arch/x86/lib/romcc_console.c index 9e0c3c93fc..a6424ddeee 100644 --- a/src/arch/x86/lib/romcc_console.c +++ b/src/arch/x86/lib/romcc_console.c @@ -20,6 +20,7 @@ #include <build.h> #include <console/streams.h> #include <console/early_print.h> +#include <console/loglevel.h> /* Include the sources. */ #if CONFIG_CONSOLE_SERIAL && CONFIG_DRIVERS_UART_8250IO @@ -78,3 +79,9 @@ void console_init(void) print_info(console_test); } + +void die(const char *msg) +{ + print_emerg(msg); + halt(); +} diff --git a/src/console/die.c b/src/console/die.c index e6e968a5b3..b0e04a4903 100644 --- a/src/console/die.c +++ b/src/console/die.c @@ -25,13 +25,11 @@ #ifndef __ROMCC__ #define NORETURN __attribute__((noreturn)) -#else -#define NORETURN -#endif /* Report a fatal error */ void NORETURN die(const char *msg) { - print_emerg(msg); + printk(BIOS_EMERG, "%s", msg); halt(); } +#endif diff --git a/src/console/post.c b/src/console/post.c index 4f2a87c93e..df71a62d90 100644 --- a/src/console/post.c +++ b/src/console/post.c @@ -150,9 +150,7 @@ void post_code(uint8_t value) { #if !CONFIG_NO_POST #if CONFIG_CONSOLE_POST - print_emerg("POST: 0x"); - print_emerg_hex8(value); - print_emerg("\n"); + printk(BIOS_EMERG, "POST: 0x%02x\n", value); #endif #if CONFIG_CMOS_POST cmos_post_code(value); diff --git a/src/include/assert.h b/src/include/assert.h index 9f624a931f..966449b286 100644 --- a/src/include/assert.h +++ b/src/include/assert.h @@ -22,31 +22,6 @@ #include <console/console.h> -#if defined(__PRE_RAM__) && !CONFIG_CACHE_AS_RAM - -/* ROMCC versions */ -#define ASSERT(x) { \ - if(!(x)) { \ - print_emerg("ASSERTION FAILED: file '"); \ - print_emerg(__FILE__); \ - print_emerg("', line 0x"); \ - print_debug_hex32(__LINE__); \ - print_emerg("\n"); \ - /* die(""); */ \ - } \ -} - -#define BUG() { \ - print_emerg("BUG ENCOUNTERED: SYSTEM HALTED at file '");\ - print_emerg(__FILE__); \ - print_emerg("', line 0x"); \ - print_debug_hex32(__LINE__); \ - print_emerg("\n"); \ - /* die(""); */ \ -} - -#else - /* GCC and CAR versions */ #define ASSERT(x) { \ if (!(x)) { \ @@ -61,8 +36,6 @@ /* die(""); */ \ } -#endif /* defined(__PRE_RAM__) && !CONFIG_CACHE_AS_RAM */ - #define assert(statement) ASSERT(statement) #endif // __ASSERT_H__ diff --git a/src/include/console/console.h b/src/include/console/console.h index 9e98bfc59c..38e05b3fb1 100644 --- a/src/include/console/console.h +++ b/src/include/console/console.h @@ -23,6 +23,7 @@ #include <stdint.h> #include <rules.h> #include <console/post_codes.h> +#include <console/loglevel.h> #ifndef __ROMCC__ void post_code(u8 value); @@ -70,15 +71,6 @@ static inline void do_vtxprintf(const char *fmt, va_list args) {}; #endif #endif -/* A lot of code still uses print_debug() et al. while use of printk() - * would be preferred. - */ -#include <console/early_print.h> - -#else /* __ROMCC__ */ - -#include "arch/x86/lib/romcc_console.c" - -#endif /* __ROMCC__ */ +#endif /* !__ROMCC__ */ #endif /* CONSOLE_CONSOLE_H_ */ diff --git a/src/include/console/early_print.h b/src/include/console/early_print.h index 8bc1489dd4..cbc9b4616a 100644 --- a/src/include/console/early_print.h +++ b/src/include/console/early_print.h @@ -92,58 +92,4 @@ #define print_debug_hex32(HEX) __console_tx_hex32(BIOS_DEBUG, HEX) #define print_spew_hex32(HEX) __console_tx_hex32(BIOS_SPEW, HEX) -#else - -#define print_emerg(STR) printk(BIOS_EMERG, "%s", (STR)) -#define print_alert(STR) printk(BIOS_ALERT, "%s", (STR)) -#define print_crit(STR) printk(BIOS_CRIT, "%s", (STR)) -#define print_err(STR) printk(BIOS_ERR, "%s", (STR)) -#define print_warning(STR) printk(BIOS_WARNING,"%s", (STR)) -#define print_notice(STR) printk(BIOS_NOTICE, "%s", (STR)) -#define print_info(STR) printk(BIOS_INFO, "%s", (STR)) -#define print_debug(STR) printk(BIOS_DEBUG, "%s", (STR)) -#define print_spew(STR) printk(BIOS_SPEW, "%s", (STR)) - -#define print_emerg_char(CH) printk(BIOS_EMERG, "%c", (CH)) -#define print_alert_char(CH) printk(BIOS_ALERT, "%c", (CH)) -#define print_crit_char(CH) printk(BIOS_CRIT, "%c", (CH)) -#define print_err_char(CH) printk(BIOS_ERR, "%c", (CH)) -#define print_warning_char(CH) printk(BIOS_WARNING,"%c", (CH)) -#define print_notice_char(CH) printk(BIOS_NOTICE, "%c", (CH)) -#define print_info_char(CH) printk(BIOS_INFO, "%c", (CH)) -#define print_debug_char(CH) printk(BIOS_DEBUG, "%c", (CH)) -#define print_spew_char(CH) printk(BIOS_SPEW, "%c", (CH)) - -#define print_emerg_hex8(HEX) printk(BIOS_EMERG, "%02x", (HEX)) -#define print_alert_hex8(HEX) printk(BIOS_ALERT, "%02x", (HEX)) -#define print_crit_hex8(HEX) printk(BIOS_CRIT, "%02x", (HEX)) -#define print_err_hex8(HEX) printk(BIOS_ERR, "%02x", (HEX)) -#define print_warning_hex8(HEX) printk(BIOS_WARNING,"%02x", (HEX)) -#define print_notice_hex8(HEX) printk(BIOS_NOTICE, "%02x", (HEX)) -#define print_info_hex8(HEX) printk(BIOS_INFO, "%02x", (HEX)) -#define print_debug_hex8(HEX) printk(BIOS_DEBUG, "%02x", (HEX)) -#define print_spew_hex8(HEX) printk(BIOS_SPEW, "%02x", (HEX)) - -#define print_emerg_hex16(HEX) printk(BIOS_EMERG, "%04x", (HEX)) -#define print_alert_hex16(HEX) printk(BIOS_ALERT, "%04x", (HEX)) -#define print_crit_hex16(HEX) printk(BIOS_CRIT, "%04x", (HEX)) -#define print_err_hex16(HEX) printk(BIOS_ERR, "%04x", (HEX)) -#define print_warning_hex16(HEX) printk(BIOS_WARNING,"%04x", (HEX)) -#define print_notice_hex16(HEX) printk(BIOS_NOTICE, "%04x", (HEX)) -#define print_info_hex16(HEX) printk(BIOS_INFO, "%04x", (HEX)) -#define print_debug_hex16(HEX) printk(BIOS_DEBUG, "%04x", (HEX)) -#define print_spew_hex16(HEX) printk(BIOS_SPEW, "%04x", (HEX)) - -#define print_emerg_hex32(HEX) printk(BIOS_EMERG, "%08x", (HEX)) -#define print_alert_hex32(HEX) printk(BIOS_ALERT, "%08x", (HEX)) -#define print_crit_hex32(HEX) printk(BIOS_CRIT, "%08x", (HEX)) -#define print_err_hex32(HEX) printk(BIOS_ERR, "%08x", (HEX)) -#define print_warning_hex32(HEX) printk(BIOS_WARNING,"%08x", (HEX)) -#define print_notice_hex32(HEX) printk(BIOS_NOTICE, "%08x", (HEX)) -#define print_info_hex32(HEX) printk(BIOS_INFO, "%08x", (HEX)) -#define print_debug_hex32(HEX) printk(BIOS_DEBUG, "%08x", (HEX)) -#define print_spew_hex32(HEX) printk(BIOS_SPEW, "%08x", (HEX)) - -#endif - #endif /* __CONSOLE_EARLY_PRINT_H_ */ diff --git a/src/include/console/streams.h b/src/include/console/streams.h index fb168da905..892ae40f1c 100644 --- a/src/include/console/streams.h +++ b/src/include/console/streams.h @@ -28,11 +28,4 @@ void gdb_tx_byte(unsigned char byte); void gdb_tx_flush(void); unsigned char gdb_rx_byte(void); -/* Helpers for ROMCC console. */ -void console_tx_nibble(unsigned nibble); -void console_tx_hex8(unsigned char value); -void console_tx_hex16(unsigned short value); -void console_tx_hex32(unsigned int value); -void console_tx_string(const char *str); - #endif /* _CONSOLE_STREAMS_H_ */ diff --git a/src/lib/debug.c b/src/lib/debug.c index a2c323c93b..8d629c2019 100644 --- a/src/lib/debug.c +++ b/src/lib/debug.c @@ -21,12 +21,8 @@ static void print_debug_pci_dev(unsigned dev) { - print_debug("PCI: "); - print_debug_hex8((dev >> 16) & 0xff); - print_debug_char(':'); - print_debug_hex8((dev >> 11) & 0x1f); - print_debug_char('.'); - print_debug_hex8((dev >> 8) & 7); + printk(BIOS_DEBUG, "PCI: %02x:%02x.%x", + (dev >> 16) & 0xff, (dev >> 11) & 0x1f, (dev >> 8) & 7); } static inline void print_pci_devices(void) @@ -42,7 +38,7 @@ static inline void print_pci_devices(void) continue; } print_debug_pci_dev(dev); - print_debug("\n"); + printk(BIOS_DEBUG, "\n"); } } @@ -50,20 +46,16 @@ static void dump_pci_device(unsigned dev) { int i; print_debug_pci_dev(dev); - print_debug("\n"); + printk(BIOS_DEBUG, "\n"); for (i = 0; i <= 255; i++) { unsigned char val; - if ((i & 0x0f) == 0) { - print_debug_hex8(i); - print_debug_char(':'); - } + if ((i & 0x0f) == 0) + printk(BIOS_DEBUG, "%02x:", i); val = pci_read_config8(dev, i); - print_debug_char(' '); - print_debug_hex8(val); - if ((i & 0x0f) == 0x0f) { - print_debug("\n"); - } + printk(BIOS_DEBUG, " %02x", val); + if ((i & 0x0f) == 0x0f) + printk(BIOS_DEBUG, "\n"); } } @@ -86,22 +78,16 @@ static inline void dump_pci_devices(void) static inline void dump_io_resources(unsigned port) { - int i; - print_debug_hex16(port); - print_debug(":\n"); + printk(BIOS_DEBUG, "%04x:\n", port); for (i = 0; i < 256; i++) { u8 val; - if ((i & 0x0f) == 0) { - print_debug_hex8(i); - print_debug_char(':'); - } + if ((i & 0x0f) == 0) + printk(BIOS_DEBUG, "%02x:", i); val = inb(port); - print_debug_char(' '); - print_debug_hex8(val); - if ((i & 0x0f) == 0x0f) { - print_debug("\n"); - } + printk(BIOS_DEBUG, " %02x", val); + if ((i & 0x0f) == 0x0f) + printk(BIOS_DEBUG, "\n"); port++; } } diff --git a/src/lib/generic_dump_spd.c b/src/lib/generic_dump_spd.c index 32a572e44c..d61ce1ea3c 100644 --- a/src/lib/generic_dump_spd.c +++ b/src/lib/generic_dump_spd.c @@ -6,60 +6,46 @@ static void dump_spd_registers(const struct mem_controller *ctrl) { int i; - print_debug("\n"); + printk(BIOS_DEBUG, "\n"); for(i = 0; i < 4; i++) { unsigned device; device = ctrl->channel0[i]; if (device) { int j; - print_debug("dimm: "); - print_debug_hex8(i); - print_debug(".0: "); - print_debug_hex8(device); + printk(BIOS_DEBUG, "dimm: %02x.0: %02x", i, device); for(j = 0; j < 256; j++) { int status; unsigned char byte; - if ((j & 0xf) == 0) { - print_debug("\n"); - print_debug_hex8(j); - print_debug(": "); - } + if ((j & 0xf) == 0) + printk(BIOS_DEBUG, "\n%02x: ", j); status = spd_read_byte(device, j); if (status < 0) { - print_debug("bad device\n"); + printk(BIOS_DEBUG, "bad device\n"); break; } byte = status & 0xff; - print_debug_hex8(byte); - print_debug_char(' '); + printk(BIOS_DEBUG, "%02x ", byte); } - print_debug("\n"); + printk(BIOS_DEBUG, "\n"); } device = ctrl->channel1[i]; if (device) { int j; - print_debug("dimm: "); - print_debug_hex8(i); - print_debug(".1: "); - print_debug_hex8(device); + printk(BIOS_DEBUG, "dimm: %02x.1: %02x", i, device); for(j = 0; j < 256; j++) { int status; unsigned char byte; - if ((j & 0xf) == 0) { - print_debug("\n"); - print_debug_hex8(j); - print_debug(": "); - } + if ((j & 0xf) == 0) + printk(BIOS_DEBUG, "\n%02x: "); status = spd_read_byte(device, j); if (status < 0) { - print_debug("bad device\n"); + printk(BIOS_DEBUG, "bad device\n"); break; } byte = status & 0xff; - print_debug_hex8(byte); - print_debug_char(' '); + printk(BIOS_DEBUG, "%02x ", byte); } - print_debug("\n"); + printk(BIOS_DEBUG, "\n"); } } } diff --git a/src/lib/generic_sdram.c b/src/lib/generic_sdram.c index efb61dbf7a..a79d822a52 100644 --- a/src/lib/generic_sdram.c +++ b/src/lib/generic_sdram.c @@ -1,14 +1,5 @@ #include <lib.h> /* Prototypes */ -static inline void print_debug_sdram_8(const char *strval, uint32_t val) -{ -#if CONFIG_CACHE_AS_RAM - printk(BIOS_DEBUG, "%s%02x\n", strval, val); -#else - print_debug(strval); print_debug_hex8(val); print_debug("\n"); -#endif -} - /* Setup SDRAM */ #if CONFIG_RAMINIT_SYSINFO void sdram_initialize(int controllers, const struct mem_controller *ctrl, void *sysinfo) @@ -19,7 +10,7 @@ void sdram_initialize(int controllers, const struct mem_controller *ctrl) int i; /* Set the registers we can set once to reasonable values */ for(i = 0; i < controllers; i++) { - print_debug_sdram_8("Ram1.", i); + printk(BIOS_DEBUG, "Ram1.%02x\n", i); #if CONFIG_RAMINIT_SYSINFO sdram_set_registers(ctrl + i, sysinfo); @@ -30,7 +21,7 @@ void sdram_initialize(int controllers, const struct mem_controller *ctrl) /* Now setup those things we can auto detect */ for(i = 0; i < controllers; i++) { - print_debug_sdram_8("Ram2.", i); + printk(BIOS_DEBUG, "Ram2.%02x\n", i); #if CONFIG_RAMINIT_SYSINFO sdram_set_spd_registers(ctrl + i, sysinfo); @@ -44,7 +35,7 @@ void sdram_initialize(int controllers, const struct mem_controller *ctrl) * Some chipsets do the work for us while on others * we need to it by hand. */ - print_debug("Ram3\n"); + printk(BIOS_DEBUG, "Ram3\n"); #if CONFIG_RAMINIT_SYSINFO sdram_enable(controllers, ctrl, sysinfo); @@ -52,5 +43,5 @@ void sdram_initialize(int controllers, const struct mem_controller *ctrl) sdram_enable(controllers, ctrl); #endif - print_debug("Ram4\n"); + printk(BIOS_DEBUG, "Ram4\n"); } diff --git a/src/lib/loaders/load_and_run_ramstage.c b/src/lib/loaders/load_and_run_ramstage.c index 71eb22cef7..5237e20db7 100644 --- a/src/lib/loaders/load_and_run_ramstage.c +++ b/src/lib/loaders/load_and_run_ramstage.c @@ -74,7 +74,7 @@ static void run_ramstage_from_resume(struct romstage_handoff *handoff) entry = load_cached_ramstage(handoff, cbmem_entry); if (entry != NULL) { - print_debug("Jumping to image.\n"); + printk(BIOS_DEBUG, "Jumping to image.\n"); stage_exit(entry); } } diff --git a/src/lib/ramtest.c b/src/lib/ramtest.c index 03c4aa7d78..a29fa25ece 100644 --- a/src/lib/ramtest.c +++ b/src/lib/ramtest.c @@ -83,13 +83,7 @@ static int ram_bitset_nodie(unsigned long start) unsigned char failed, failures; uint8_t verbose = 0; -#if !defined(__ROMCC__) printk(BIOS_DEBUG, "DRAM bitset write: 0x%08lx\n", start); -#else - print_debug("DRAM bitset write: 0x"); - print_debug_hex32(start); - print_debug("\n"); -#endif for (idx=0; idx<0x400; idx+=4) { test_pattern(idx, &addr, &value); write_phys(start + addr, value); @@ -98,13 +92,7 @@ static int ram_bitset_nodie(unsigned long start) /* Make sure we don't read before we wrote */ phys_memory_barrier(); -#if !defined(__ROMCC__) printk(BIOS_DEBUG, "DRAM bitset verify: 0x%08lx\n", start); -#else - print_debug("DRAM bitset verify: 0x"); - print_debug_hex32(start); - print_debug("\n"); -#endif failures = 0; for (idx=0; idx<0x400; idx+=4) { test_pattern(idx, &addr, &value); @@ -113,20 +101,10 @@ static int ram_bitset_nodie(unsigned long start) failed = (value2 != value); failures |= failed; if (failed && !verbose) { -#if !defined(__ROMCC__) printk(BIOS_ERR, "0x%08lx wr: 0x%08lx rd: 0x%08lx FAIL\n", start + addr, value, value2); -#else - print_err_hex32(start + addr); - print_err(" wr: 0x"); - print_err_hex32(value); - print_err(" rd: 0x"); - print_err_hex32(value2); - print_err(" FAIL\n"); -#endif } if (verbose) { -#if !defined(__ROMCC__) if ((addr & 0x0f) == 0) printk(BIOS_DEBUG, "%08lx wr: %08lx rd:", start + addr, value); @@ -136,39 +114,14 @@ static int ram_bitset_nodie(unsigned long start) printk(BIOS_DEBUG, " %08lx ", value2); if ((addr & 0x0f) == 0xc) printk(BIOS_DEBUG, "\n"); -#else - if ((addr & 0x0f) == 0) { - print_dbg_hex32(start + addr); - print_dbg(" wr: "); - print_dbg_hex32(value); - print_dbg(" rd: "); - } - print_dbg_hex32(value2); - if (failed) - print_dbg("! "); - else - print_dbg(" "); - if ((addr & 0x0f) == 0xc) - print_dbg("\n"); -#endif } } if (failures) { post_code(0xea); -#if !defined(__ROMCC__) printk(BIOS_DEBUG, "\nDRAM did _NOT_ verify!\n"); -#else - print_debug("\nDRAM did _NOT_ verify!\n"); -#endif return 1; - } - else { -#if !defined(__ROMCC__) + } else { printk(BIOS_DEBUG, "\nDRAM range verified.\n"); -#else - print_debug("\nDRAM range verified.\n"); - return 0; -#endif } return 0; } @@ -181,20 +134,10 @@ void ram_check(unsigned long start, unsigned long stop) * test than a "Is my DRAM faulty?" test. Not all bits * are tested. -Tyson */ -#if !defined(__ROMCC__) printk(BIOS_DEBUG, "Testing DRAM at: %08lx\n", start); -#else - print_debug("Testing DRAM at: "); - print_debug_hex32(start); - print_debug("\n"); -#endif if (ram_bitset_nodie(start)) die("DRAM ERROR"); -#if !defined(__ROMCC__) printk(BIOS_DEBUG, "Done.\n"); -#else - print_debug("Done.\n"); -#endif } @@ -206,20 +149,10 @@ int ram_check_nodie(unsigned long start, unsigned long stop) * test than a "Is my DRAM faulty?" test. Not all bits * are tested. -Tyson */ -#if !defined(__ROMCC__) printk(BIOS_DEBUG, "Testing DRAM at : %08lx\n", start); -#else - print_debug("Testing DRAM at : "); - print_debug_hex32(start); - print_debug("\n"); -#endif ret = ram_bitset_nodie(start); -#if !defined(__ROMCC__) printk(BIOS_DEBUG, "Done.\n"); -#else - print_debug("Done.\n"); -#endif return ret; } diff --git a/src/mainboard/bifferos/bifferboard/romstage.c b/src/mainboard/bifferos/bifferboard/romstage.c index 574e9a6caf..3bbc73a96a 100644 --- a/src/mainboard/bifferos/bifferboard/romstage.c +++ b/src/mainboard/bifferos/bifferboard/romstage.c @@ -23,6 +23,7 @@ #include <arch/io.h> #include <device/pnp_def.h> #include <pc80/mc146818rtc.h> +#include "arch/x86/lib/romcc_console.c" #include <console/console.h> #include <cpu/x86/cache.h> diff --git a/src/mainboard/dmp/vortex86ex/romstage.c b/src/mainboard/dmp/vortex86ex/romstage.c index 5deebc5a65..83f2944b2c 100644 --- a/src/mainboard/dmp/vortex86ex/romstage.c +++ b/src/mainboard/dmp/vortex86ex/romstage.c @@ -21,6 +21,7 @@ #include <stdint.h> #include <arch/io.h> #include <stdlib.h> +#include "arch/x86/lib/romcc_console.c" #include <console/console.h> #include <cpu/x86/cache.h> #include <halt.h> |