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 #define WANT_PPCDBG_TAB /* Only defined here */
14 #include <linux/config.h>
15 #include <linux/types.h>
16 #include <linux/sched.h>
17 #include <asm/ppcdebug.h>
18 #include <asm/processor.h>
20 void (*udbg_putc
)(unsigned char c
);
21 unsigned char (*udbg_getc
)(void);
22 int (*udbg_getc_poll
)(void);
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 void udbg_console_write(struct console
*con
, const char *s
, unsigned int n
)
83 #define UDBG_BUFSIZE 256
84 void udbg_printf(const char *fmt
, ...)
86 unsigned char buf
[UDBG_BUFSIZE
];
90 vsnprintf(buf
, UDBG_BUFSIZE
, fmt
, args
);
95 /* Special print used by PPCDBG() macro */
96 void udbg_ppcdbg(unsigned long debug_flags
, const char *fmt
, ...)
98 unsigned long active_debugs
= debug_flags
& ppc64_debug_switch
;
102 unsigned char buf
[UDBG_BUFSIZE
];
103 unsigned long i
, len
= 0;
105 for (i
=0; i
< PPCDBG_NUM_FLAGS
; i
++) {
106 if (((1U << i
) & active_debugs
) &&
108 len
+= strlen(trace_names
[i
]);
109 udbg_puts(trace_names
[i
]);
114 snprintf(buf
, UDBG_BUFSIZE
, " [%s]: ", current
->comm
);
124 vsnprintf(buf
, UDBG_BUFSIZE
, fmt
, ap
);
130 unsigned long udbg_ifdebug(unsigned long flags
)
132 return (flags
& ppc64_debug_switch
);