2 * polling mode stateless debugging stuff, originally for NS16550 Serial Ports
4 * c 2001 PPC 64 Team, IBM Corp
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
13 #include <linux/config.h>
14 #include <linux/types.h>
15 #include <linux/sched.h>
16 #include <linux/console.h>
17 #include <asm/processor.h>
19 void (*udbg_putc
)(unsigned char c
);
20 unsigned char (*udbg_getc
)(void);
21 int (*udbg_getc_poll
)(void);
23 /* udbg library, used by xmon et al */
24 void udbg_puts(const char *s
)
29 if (s
&& *s
!= '\0') {
30 while ((c
= *s
++) != '\0')
41 int udbg_write(const char *s
, int n
)
49 if (s
&& *s
!= '\0') {
50 while (((c
= *s
++) != '\0') && (remain
-- > 0)) {
58 int udbg_read(char *buf
, int buflen
)
66 for (i
= 0; i
< buflen
; ++i
) {
69 } while (c
== 0x11 || c
== 0x13);
78 #define UDBG_BUFSIZE 256
79 void udbg_printf(const char *fmt
, ...)
81 unsigned char buf
[UDBG_BUFSIZE
];
85 vsnprintf(buf
, UDBG_BUFSIZE
, fmt
, args
);
91 * Early boot console based on udbg
93 static void udbg_console_write(struct console
*con
, const char *s
,
99 static struct console udbg_console
= {
101 .write
= udbg_console_write
,
102 .flags
= CON_PRINTBUFFER
,
106 static int early_console_initialized
;
108 void __init
disable_early_printk(void)
110 if (!early_console_initialized
)
112 unregister_console(&udbg_console
);
113 early_console_initialized
= 0;
116 /* called by setup_system */
117 void register_early_udbg_console(void)
119 early_console_initialized
= 1;
120 register_console(&udbg_console
);
123 #if 0 /* if you want to use this as a regular output console */
124 console_initcall(register_udbg_console
);