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 <asm/ppcdebug.h>
17 #include <asm/processor.h>
18 #include <asm/uaccess.h>
19 #include <asm/machdep.h>
23 void udbg_puts(const char *s)
25 if (ppc_md.udbg_putc) {
28 if (s && *s != '\0') {
29 while ((c = *s++) != '\0')
40 int udbg_write(const char *s, int n)
45 if (!ppc_md.udbg_putc)
48 if (s && *s != '\0') {
49 while (((c = *s++) != '\0') && (remain-- > 0)) {
57 int udbg_read(char *buf, int buflen)
62 if (!ppc_md.udbg_getc)
65 for (i = 0; i < buflen; ++i) {
67 c = ppc_md.udbg_getc();
68 } while (c == 0x11 || c == 0x13);
77 void udbg_console_write(struct console *con, const char *s, unsigned int n)
82 #define UDBG_BUFSIZE 256
83 void udbg_printf(const char *fmt, ...)
85 unsigned char buf[UDBG_BUFSIZE];
89 vsnprintf(buf, UDBG_BUFSIZE, fmt, args);
94 /* Special print used by PPCDBG() macro */
95 void udbg_ppcdbg(unsigned long debug_flags, const char *fmt, ...)
97 unsigned long active_debugs = debug_flags & ppc64_debug_switch;
101 unsigned char buf[UDBG_BUFSIZE];
102 unsigned long i, len = 0;
104 for (i=0; i < PPCDBG_NUM_FLAGS; i++) {
105 if (((1U << i) & active_debugs) &&
107 len += strlen(trace_names[i]);
108 udbg_puts(trace_names[i]);
113 snprintf(buf, UDBG_BUFSIZE, " [%s]: ", current->comm);
123 vsnprintf(buf, UDBG_BUFSIZE, fmt, ap);
129 unsigned long udbg_ifdebug(unsigned long flags)
131 return (flags & ppc64_debug_switch);