--- zzzz-none-000/linux-2.6.13.1/kernel/printk.c 2005-09-10 02:42:58.000000000 +0000 +++ ohio-7170-487/linux-2.6.13.1/kernel/printk.c 2007-11-28 12:57:40.000000000 +0000 @@ -36,6 +36,12 @@ #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) +#ifdef CONFIG_TFFS_PANIC_LOG +#if __LOG_BUF_LEN != 0x8000 +#warning CONFIG_LOG_BUF_SHIFT should be 15 +#endif +#endif /*--- #ifdef CONFIG_TFFS_PANIC_LOG ---*/ + /* printk's without a loglevel use this.. */ #define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */ @@ -121,6 +127,7 @@ static char *log_buf = __log_buf; static int log_buf_len = __LOG_BUF_LEN; static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */ +#endif /*--- #ifdef CONFIG_PRINTK ---*/ /* * Setup a list of consoles. Called from init/main.c @@ -160,6 +167,19 @@ __setup("console=", console_setup); +#ifdef CONFIG_PRINTK + +#ifdef CONFIG_TFFS_PANIC_LOG +unsigned long printk_get_buffer(char **p_log_buf, unsigned long *p_log_end, unsigned long *p_anzahl) { + *p_log_buf = log_buf; + *p_log_end = log_end & LOG_BUF_MASK; + *p_anzahl = log_end; + /*--- printk("[printk_get_buffer] log_buf 0x%p len %d write_pos %ld anzahl %ld\n", log_buf, log_buf_len, log_end & LOG_BUF_MASK, log_end); ---*/ + return log_buf_len; +} +#endif /*--- #ifdef CONFIG_TFFS_PANIC_LOG ---*/ + + static int __init log_buf_len_setup(char *str) { unsigned long size = memparse(str, &str); @@ -439,16 +459,38 @@ _call_console_drivers(start_print, end, msg_level); } +#ifdef CONFIG_ARCH_DAVINCI +unsigned int emit_log_char_state = 0; +extern void sio_init(unsigned int Baud); +extern void sio_putc(char ch); +#endif + static void emit_log_char(char c) { - LOG_BUF(log_end) = c; - log_end++; - if (log_end - log_start > log_buf_len) - log_start = log_end - log_buf_len; - if (log_end - con_start > log_buf_len) - con_start = log_end - log_buf_len; - if (logged_chars < log_buf_len) - logged_chars++; + +#ifdef CONFIG_ARCH_DAVINCI + switch(emit_log_char_state) { + case 0: /*--- call serial init ---*/ + /*--- sio_init(115200); ---*/ + emit_log_char_state = 1; + /*--- kein break ---*/ + case 1: + /*--- serial out ---*/ + sio_putc(c); + return; + default: + break; + } +#endif + + LOG_BUF(log_end) = c; + log_end++; + if (log_end - log_start > log_buf_len) + log_start = log_end - log_buf_len; + if (log_end - con_start > log_buf_len) + con_start = log_end - log_buf_len; + if (logged_chars < log_buf_len) + logged_chars++; } /* @@ -502,7 +544,9 @@ * is inspected when the actual printing occurs. */ -asmlinkage int printk(const char *fmt, ...) +#undef printk +asmlinkage int printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +asmlinkage int printk(const char *fmt, ...) { va_list args; int r; @@ -513,6 +557,21 @@ return r; } +asmlinkage int (*__printk)(const char * fmt, ...) __attribute__ ((format (printf, 1, 2))) = printk; +asmlinkage int (*_printk)(const char * fmt, ...) __attribute__ ((format (printf, 1, 2))) = printk; + +EXPORT_SYMBOL(__printk); /* zeigt immer auf printk */ +EXPORT_SYMBOL(_printk); /* wird umgesetzt */ + +void set_printk(int (*__print)(const char * fmt, ...) __attribute__ ((format (printf, 1, 2)))) { + _printk = __print; +} +EXPORT_SYMBOL(set_printk); + +void restore_printk(void) { + _printk = printk; +} +EXPORT_SYMBOL(restore_printk); asmlinkage int vprintk(const char *fmt, va_list args) { @@ -666,6 +725,10 @@ c->name[sizeof(c->name) - 1] = 0; c->options = options; c->index = idx; +#ifdef CONFIG_ARCH_DAVINCI + emit_log_char_state = 2; +#endif + return 0; } @@ -815,6 +878,7 @@ */ void console_stop(struct console *console) { + printk("[console_stop] disable\n"); acquire_console_sem(); console->flags &= ~CON_ENABLED; release_console_sem(); @@ -823,6 +887,7 @@ void console_start(struct console *console) { + printk("[console_start] enable\n"); acquire_console_sem(); console->flags |= CON_ENABLED; release_console_sem(); @@ -853,6 +918,7 @@ console->index = 0; if (console->setup == NULL || console->setup(console, NULL) == 0) { + printk("[register_console] enable\n"); console->flags |= CON_ENABLED | CON_CONSDEV; preferred_console = 0; } @@ -873,6 +939,7 @@ if (console->setup && console->setup(console, console_cmdline[i].options) != 0) break; + printk("[register_console] enable commandline console %u\n", i); console->flags |= CON_ENABLED; console->index = console_cmdline[i].index; if (i == selected_console) {