Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 1 | /* |
| 2 | * MIPS-specific debug support for pre-boot environment |
| 3 | * |
| 4 | * NOTE: putc() is board specific, if your board have a 16550 compatible uart, |
| 5 | * please select SYS_SUPPORTS_ZBOOT_UART16550 for your machine. othewise, you |
| 6 | * need to implement your own putc(). |
| 7 | */ |
Wu Zhangjin | e52dd9f | 2010-01-26 23:02:34 +0800 | [diff] [blame] | 8 | #include <linux/compiler.h> |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 9 | #include <linux/types.h> |
| 10 | |
Wu Zhangjin | e52dd9f | 2010-01-26 23:02:34 +0800 | [diff] [blame] | 11 | void __weak putc(char c) |
Wu Zhangjin | 1b93b3c | 2009-10-14 18:12:16 +0800 | [diff] [blame] | 12 | { |
| 13 | } |
| 14 | |
| 15 | void puts(const char *s) |
| 16 | { |
| 17 | char c; |
| 18 | while ((c = *s++) != '\0') { |
| 19 | putc(c); |
| 20 | if (c == '\n') |
| 21 | putc('\r'); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | void puthex(unsigned long long val) |
| 26 | { |
| 27 | |
| 28 | unsigned char buf[10]; |
| 29 | int i; |
| 30 | for (i = 7; i >= 0; i--) { |
| 31 | buf[i] = "0123456789ABCDEF"[val & 0x0F]; |
| 32 | val >>= 4; |
| 33 | } |
| 34 | buf[8] = '\0'; |
| 35 | puts(buf); |
| 36 | } |