| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | * linux/arch/m68k/mac/debug.c | 
|  | 3 | * | 
|  | 4 | * Shamelessly stolen (SCC code and general framework) from: | 
|  | 5 | * | 
|  | 6 | * linux/arch/m68k/atari/debug.c | 
|  | 7 | * | 
|  | 8 | * Atari debugging and serial console stuff | 
|  | 9 | * | 
|  | 10 | * Assembled of parts of former atari/config.c 97-12-18 by Roman Hodek | 
|  | 11 | * | 
|  | 12 | * This file is subject to the terms and conditions of the GNU General Public | 
|  | 13 | * License.  See the file COPYING in the main directory of this archive | 
|  | 14 | * for more details. | 
|  | 15 | */ | 
|  | 16 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 17 | #include <linux/types.h> | 
|  | 18 | #include <linux/sched.h> | 
|  | 19 | #include <linux/tty.h> | 
|  | 20 | #include <linux/console.h> | 
|  | 21 | #include <linux/init.h> | 
|  | 22 | #include <linux/delay.h> | 
|  | 23 |  | 
|  | 24 | #define BOOTINFO_COMPAT_1_0 | 
|  | 25 | #include <asm/setup.h> | 
|  | 26 | #include <asm/bootinfo.h> | 
|  | 27 | #include <asm/machw.h> | 
|  | 28 | #include <asm/macints.h> | 
|  | 29 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | extern unsigned long mac_videobase; | 
|  | 31 | extern unsigned long mac_videodepth; | 
|  | 32 | extern unsigned long mac_rowbytes; | 
|  | 33 |  | 
|  | 34 | extern void mac_serial_print(const char *); | 
|  | 35 |  | 
|  | 36 | #define DEBUG_HEADS | 
|  | 37 | #undef DEBUG_SCREEN | 
|  | 38 | #define DEBUG_SERIAL | 
|  | 39 |  | 
|  | 40 | /* | 
|  | 41 | * These two auxiliary debug functions should go away ASAP. Only usage: | 
|  | 42 | * before the console output is up (after head.S come some other crucial | 
|  | 43 | * setup routines :-) it permits writing 'data' to the screen as bit patterns | 
|  | 44 | * (good luck reading those). Helped to figure that the bootinfo contained | 
|  | 45 | * garbage data on the amount and size of memory chunks ... | 
|  | 46 | * | 
|  | 47 | * The 'pos' argument now simply means 'linefeed after print' ... | 
|  | 48 | */ | 
|  | 49 |  | 
|  | 50 | #ifdef DEBUG_SCREEN | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 51 | static int peng, line; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | #endif | 
|  | 53 |  | 
| Adrian Bunk | 8dfbdf4 | 2008-07-17 21:16:25 +0200 | [diff] [blame] | 54 | #if 0 | 
|  | 55 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | void mac_debugging_short(int pos, short num) | 
|  | 57 | { | 
|  | 58 | #ifdef DEBUG_SCREEN | 
|  | 59 | unsigned char *pengoffset; | 
|  | 60 | unsigned char *pptr; | 
|  | 61 | int i; | 
|  | 62 | #endif | 
|  | 63 |  | 
|  | 64 | #ifdef DEBUG_SERIAL | 
|  | 65 | printk("debug: %d !\n", num); | 
|  | 66 | #endif | 
|  | 67 |  | 
|  | 68 | #ifdef DEBUG_SCREEN | 
|  | 69 | if (!MACH_IS_MAC) { | 
|  | 70 | /* printk("debug: %d !\n", num); */ | 
|  | 71 | return; | 
|  | 72 | } | 
|  | 73 |  | 
|  | 74 | /* calculate current offset */ | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 75 | pengoffset = (unsigned char *)mac_videobase + | 
| Mariusz Kozlowski | 4eb527a | 2007-06-01 00:46:30 -0700 | [diff] [blame] | 76 | (150+line*2) * mac_rowbytes + 80 * peng; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 78 | pptr = pengoffset; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 80 | for (i = 0; i < 8 * sizeof(short); i++) { /* # of bits */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 81 | /*        value        mask for bit i, reverse order */ | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 82 | *pptr++ = (num & (1 << (8*sizeof(short)-i-1)) ? 0xFF : 0x00); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | } | 
|  | 84 |  | 
|  | 85 | peng++; | 
|  | 86 |  | 
|  | 87 | if (pos) { | 
|  | 88 | line++; | 
|  | 89 | peng = 0; | 
|  | 90 | } | 
|  | 91 | #endif | 
|  | 92 | } | 
|  | 93 |  | 
|  | 94 | void mac_debugging_long(int pos, long addr) | 
|  | 95 | { | 
|  | 96 | #ifdef DEBUG_SCREEN | 
|  | 97 | unsigned char *pengoffset; | 
|  | 98 | unsigned char *pptr; | 
|  | 99 | int i; | 
|  | 100 | #endif | 
|  | 101 |  | 
|  | 102 | #ifdef DEBUG_SERIAL | 
|  | 103 | printk("debug: #%ld !\n", addr); | 
|  | 104 | #endif | 
|  | 105 |  | 
|  | 106 | #ifdef DEBUG_SCREEN | 
|  | 107 | if (!MACH_IS_MAC) { | 
|  | 108 | /* printk("debug: #%ld !\n", addr); */ | 
|  | 109 | return; | 
|  | 110 | } | 
|  | 111 |  | 
|  | 112 | pengoffset=(unsigned char *)(mac_videobase+(150+line*2)*mac_rowbytes) | 
|  | 113 | +80*peng; | 
|  | 114 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 115 | pptr = pengoffset; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 117 | for (i = 0; i < 8 * sizeof(long); i++) { /* # of bits */ | 
|  | 118 | *pptr++ = (addr & (1 << (8*sizeof(long)-i-1)) ? 0xFF : 0x00); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | } | 
|  | 120 |  | 
|  | 121 | peng++; | 
|  | 122 |  | 
|  | 123 | if (pos) { | 
|  | 124 | line++; | 
|  | 125 | peng = 0; | 
|  | 126 | } | 
|  | 127 | #endif | 
|  | 128 | } | 
|  | 129 |  | 
| Adrian Bunk | 8dfbdf4 | 2008-07-17 21:16:25 +0200 | [diff] [blame] | 130 | #endif  /*  0  */ | 
|  | 131 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | #ifdef DEBUG_SERIAL | 
|  | 133 | /* | 
|  | 134 | * TODO: serial debug code | 
|  | 135 | */ | 
|  | 136 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 137 | struct mac_SCC { | 
|  | 138 | u_char cha_b_ctrl; | 
|  | 139 | u_char char_dummy1; | 
|  | 140 | u_char cha_a_ctrl; | 
|  | 141 | u_char char_dummy2; | 
|  | 142 | u_char cha_b_data; | 
|  | 143 | u_char char_dummy3; | 
|  | 144 | u_char cha_a_data; | 
|  | 145 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 |  | 
|  | 147 | # define scc (*((volatile struct mac_SCC*)mac_bi_data.sccbase)) | 
|  | 148 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | static int scc_port = -1; | 
|  | 150 |  | 
|  | 151 | static struct console mac_console_driver = { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 152 | .name	= "debug", | 
|  | 153 | .flags	= CON_PRINTBUFFER, | 
|  | 154 | .index	= -1, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 155 | }; | 
|  | 156 |  | 
|  | 157 | /* | 
|  | 158 | * Crude hack to get console output to the screen before the framebuffer | 
|  | 159 | * is initialized (happens a lot later in 2.1!). | 
|  | 160 | * We just use the console routines declared in head.S, this will interfere | 
|  | 161 | * with regular framebuffer console output and should be used exclusively | 
|  | 162 | * to debug kernel problems manifesting before framebuffer init (aka WSOD) | 
|  | 163 | * | 
|  | 164 | * To keep this hack from interfering with the regular console driver, either | 
|  | 165 | * deregister this driver before/on framebuffer console init, or silence this | 
|  | 166 | * function after the fbcon driver is running (will lose console messages!?). | 
|  | 167 | * To debug real early bugs, need to write a 'mac_register_console_hack()' | 
|  | 168 | * that is called from start_kernel() before setup_arch() and just registers | 
|  | 169 | * this driver if Mac. | 
|  | 170 | */ | 
|  | 171 |  | 
| Adrian Bunk | 8dfbdf4 | 2008-07-17 21:16:25 +0200 | [diff] [blame] | 172 | static void mac_debug_console_write(struct console *co, const char *str, | 
|  | 173 | unsigned int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | { | 
|  | 175 | mac_serial_print(str); | 
|  | 176 | } | 
|  | 177 |  | 
|  | 178 |  | 
|  | 179 |  | 
|  | 180 | /* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ | 
|  | 181 |  | 
|  | 182 | #define uSEC 1 | 
|  | 183 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 184 | static inline void mac_sccb_out(char c) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 185 | { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 186 | int i; | 
|  | 187 |  | 
|  | 188 | do { | 
|  | 189 | for (i = uSEC; i > 0; --i) | 
|  | 190 | barrier(); | 
|  | 191 | } while (!(scc.cha_b_ctrl & 0x04)); /* wait for tx buf empty */ | 
|  | 192 | for (i = uSEC; i > 0; --i) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 193 | barrier(); | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 194 | scc.cha_b_data = c; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | } | 
|  | 196 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 197 | static inline void mac_scca_out(char c) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 199 | int i; | 
|  | 200 |  | 
|  | 201 | do { | 
|  | 202 | for (i = uSEC; i > 0; --i) | 
|  | 203 | barrier(); | 
|  | 204 | } while (!(scc.cha_a_ctrl & 0x04)); /* wait for tx buf empty */ | 
|  | 205 | for (i = uSEC; i > 0; --i) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | barrier(); | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 207 | scc.cha_a_data = c; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | } | 
|  | 209 |  | 
| Adrian Bunk | 8dfbdf4 | 2008-07-17 21:16:25 +0200 | [diff] [blame] | 210 | static void mac_sccb_console_write(struct console *co, const char *str, | 
|  | 211 | unsigned int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 212 | { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 213 | while (count--) { | 
|  | 214 | if (*str == '\n') | 
|  | 215 | mac_sccb_out('\r'); | 
|  | 216 | mac_sccb_out(*str++); | 
|  | 217 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | } | 
|  | 219 |  | 
| Adrian Bunk | 8dfbdf4 | 2008-07-17 21:16:25 +0200 | [diff] [blame] | 220 | static void mac_scca_console_write(struct console *co, const char *str, | 
|  | 221 | unsigned int count) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 223 | while (count--) { | 
|  | 224 | if (*str == '\n') | 
|  | 225 | mac_scca_out('\r'); | 
|  | 226 | mac_scca_out(*str++); | 
|  | 227 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 228 | } | 
|  | 229 |  | 
|  | 230 |  | 
|  | 231 | /* The following two functions do a quick'n'dirty initialization of the MFP or | 
|  | 232 | * SCC serial ports. They're used by the debugging interface, kgdb, and the | 
|  | 233 | * serial console code. */ | 
|  | 234 | #define SCCB_WRITE(reg,val)				\ | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 235 | do {						\ | 
|  | 236 | int i;					\ | 
|  | 237 | scc.cha_b_ctrl = (reg);			\ | 
|  | 238 | for (i = uSEC; i > 0; --i)		\ | 
|  | 239 | barrier();			\ | 
|  | 240 | scc.cha_b_ctrl = (val);			\ | 
|  | 241 | for (i = uSEC; i > 0; --i)		\ | 
|  | 242 | barrier();			\ | 
|  | 243 | } while(0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 |  | 
|  | 245 | #define SCCA_WRITE(reg,val)				\ | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 246 | do {						\ | 
|  | 247 | int i;					\ | 
|  | 248 | scc.cha_a_ctrl = (reg);			\ | 
|  | 249 | for (i = uSEC; i > 0; --i)		\ | 
|  | 250 | barrier();			\ | 
|  | 251 | scc.cha_a_ctrl = (val);			\ | 
|  | 252 | for (i = uSEC; i > 0; --i)		\ | 
|  | 253 | barrier();			\ | 
|  | 254 | } while(0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 |  | 
|  | 256 | /* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a | 
|  | 257 | * delay of ~ 60us. */ | 
|  | 258 | /* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 259 | #define LONG_DELAY()					\ | 
|  | 260 | do {						\ | 
|  | 261 | int i;					\ | 
|  | 262 | for (i = 60*uSEC; i > 0; --i)		\ | 
|  | 263 | barrier();				\ | 
|  | 264 | } while(0) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 266 | static void __init mac_init_scc_port(int cflag, int port) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | /* | 
|  | 269 | * baud rates: 1200, 1800, 2400, 4800, 9600, 19.2k, 38.4k, 57.6k, 115.2k | 
|  | 270 | */ | 
|  | 271 |  | 
|  | 272 | static int clksrc_table[9] = | 
|  | 273 | /* reg 11: 0x50 = BRG, 0x00 = RTxC, 0x28 = TRxC */ | 
|  | 274 | { 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x50, 0x00, 0x00 }; | 
|  | 275 | static int clkmode_table[9] = | 
|  | 276 | /* reg 4: 0x40 = x16, 0x80 = x32, 0xc0 = x64 */ | 
|  | 277 | { 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0xc0, 0x80 }; | 
|  | 278 | static int div_table[9] = | 
|  | 279 | /* reg12 (BRG low) */ | 
|  | 280 | { 94, 62, 46, 22, 10, 4, 1, 0, 0 }; | 
|  | 281 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 282 | int baud = cflag & CBAUD; | 
|  | 283 | int clksrc, clkmode, div, reg3, reg5; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 284 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 285 | if (cflag & CBAUDEX) | 
|  | 286 | baud += B38400; | 
|  | 287 | if (baud < B1200 || baud > B38400+2) | 
|  | 288 | baud = B9600; /* use default 9600bps for non-implemented rates */ | 
|  | 289 | baud -= B1200; /* tables starts at 1200bps */ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 291 | clksrc  = clksrc_table[baud]; | 
|  | 292 | clkmode = clkmode_table[baud]; | 
|  | 293 | div     = div_table[baud]; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 295 | reg3 = (((cflag & CSIZE) == CS8) ? 0xc0 : 0x40); | 
|  | 296 | reg5 = (((cflag & CSIZE) == CS8) ? 0x60 : 0x20) | 0x82 /* assert DTR/RTS */; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 |  | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 298 | if (port == 1) { | 
|  | 299 | (void)scc.cha_b_ctrl;	/* reset reg pointer */ | 
|  | 300 | SCCB_WRITE(9, 0xc0);	/* reset */ | 
|  | 301 | LONG_DELAY();		/* extra delay after WR9 access */ | 
|  | 302 | SCCB_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | | 
|  | 303 | 0x04 /* 1 stopbit */ | | 
|  | 304 | clkmode); | 
|  | 305 | SCCB_WRITE(3, reg3); | 
|  | 306 | SCCB_WRITE(5, reg5); | 
|  | 307 | SCCB_WRITE(9, 0);	/* no interrupts */ | 
|  | 308 | LONG_DELAY();		/* extra delay after WR9 access */ | 
|  | 309 | SCCB_WRITE(10, 0);	/* NRZ mode */ | 
|  | 310 | SCCB_WRITE(11, clksrc);	/* main clock source */ | 
|  | 311 | SCCB_WRITE(12, div);	/* BRG value */ | 
|  | 312 | SCCB_WRITE(13, 0);	/* BRG high byte */ | 
|  | 313 | SCCB_WRITE(14, 1); | 
|  | 314 | SCCB_WRITE(3, reg3 | 1); | 
|  | 315 | SCCB_WRITE(5, reg5 | 8); | 
|  | 316 | } else if (port == 0) { | 
|  | 317 | (void)scc.cha_a_ctrl;	/* reset reg pointer */ | 
|  | 318 | SCCA_WRITE(9, 0xc0);	/* reset */ | 
|  | 319 | LONG_DELAY();		/* extra delay after WR9 access */ | 
|  | 320 | SCCA_WRITE(4, (cflag & PARENB) ? ((cflag & PARODD) ? 0x01 : 0x03) : 0 | | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 321 | 0x04 /* 1 stopbit */ | | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 322 | clkmode); | 
|  | 323 | SCCA_WRITE(3, reg3); | 
|  | 324 | SCCA_WRITE(5, reg5); | 
|  | 325 | SCCA_WRITE(9, 0);	/* no interrupts */ | 
|  | 326 | LONG_DELAY();		/* extra delay after WR9 access */ | 
|  | 327 | SCCA_WRITE(10, 0);	/* NRZ mode */ | 
|  | 328 | SCCA_WRITE(11, clksrc);	/* main clock source */ | 
|  | 329 | SCCA_WRITE(12, div);	/* BRG value */ | 
|  | 330 | SCCA_WRITE(13, 0);	/* BRG high byte */ | 
|  | 331 | SCCA_WRITE(14, 1); | 
|  | 332 | SCCA_WRITE(3, reg3 | 1); | 
|  | 333 | SCCA_WRITE(5, reg5 | 8); | 
|  | 334 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 335 | } | 
|  | 336 | #endif /* DEBUG_SERIAL */ | 
|  | 337 |  | 
| Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 338 | static int __init mac_debug_setup(char *arg) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | { | 
| Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 340 | if (!MACH_IS_MAC) | 
|  | 341 | return 0; | 
|  | 342 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 343 | #ifdef DEBUG_SERIAL | 
| Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 344 | if (!strcmp(arg, "ser") || !strcmp(arg, "ser1")) { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 345 | /* Mac modem port */ | 
|  | 346 | mac_init_scc_port(B9600|CS8, 0); | 
|  | 347 | mac_console_driver.write = mac_scca_console_write; | 
|  | 348 | scc_port = 0; | 
| Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 349 | } else if (!strcmp(arg, "ser2")) { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 350 | /* Mac printer port */ | 
|  | 351 | mac_init_scc_port(B9600|CS8, 1); | 
|  | 352 | mac_console_driver.write = mac_sccb_console_write; | 
|  | 353 | scc_port = 1; | 
|  | 354 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | #endif | 
|  | 356 | #ifdef DEBUG_HEADS | 
| Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 357 | if (!strcmp(arg, "scn") || !strcmp(arg, "con")) { | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 358 | /* display, using head.S console routines */ | 
|  | 359 | mac_console_driver.write = mac_debug_console_write; | 
|  | 360 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 361 | #endif | 
| Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 362 | if (mac_console_driver.write) | 
|  | 363 | register_console(&mac_console_driver); | 
| Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 364 | return 0; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 365 | } | 
| Roman Zippel | d6713b4 | 2007-05-01 22:32:45 +0200 | [diff] [blame] | 366 |  | 
|  | 367 | early_param("debug", mac_debug_setup); |