diff options
Diffstat (limited to 'arch/mips/boot/compressed/dbg.c')
-rw-r--r-- | arch/mips/boot/compressed/dbg.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/arch/mips/boot/compressed/dbg.c b/arch/mips/boot/compressed/dbg.c new file mode 100644 index 000000000000..ff4dc7a33a9f --- /dev/null +++ b/arch/mips/boot/compressed/dbg.c | |||
@@ -0,0 +1,37 @@ | |||
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 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/types.h> | ||
11 | |||
12 | void __attribute__ ((weak)) putc(char c) | ||
13 | { | ||
14 | } | ||
15 | |||
16 | void puts(const char *s) | ||
17 | { | ||
18 | char c; | ||
19 | while ((c = *s++) != '\0') { | ||
20 | putc(c); | ||
21 | if (c == '\n') | ||
22 | putc('\r'); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | void puthex(unsigned long long val) | ||
27 | { | ||
28 | |||
29 | unsigned char buf[10]; | ||
30 | int i; | ||
31 | for (i = 7; i >= 0; i--) { | ||
32 | buf[i] = "0123456789ABCDEF"[val & 0x0F]; | ||
33 | val >>= 4; | ||
34 | } | ||
35 | buf[8] = '\0'; | ||
36 | puts(buf); | ||
37 | } | ||