--- zzzz-none-000/linux-2.6.28.10/kernel/printk.c 2009-05-02 18:54:43.000000000 +0000 +++ puma5-6360-529/linux-2.6.28.10/kernel/printk.c 2010-04-15 11:41:42.000000000 +0000 @@ -42,6 +42,11 @@ { } +#ifdef CONFIG_DEBUG_LL +void printascii(const char *string); +int init_phase = 1; +#endif + #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT) /* printk's without a loglevel use this.. */ @@ -135,6 +140,15 @@ static char *log_buf = __log_buf; static int log_buf_len = __LOG_BUF_LEN; static unsigned logged_chars; /* Number of chars produced since last read+clear operation */ +#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) { @@ -554,7 +568,12 @@ * * See the vsnprintf() documentation for format string extensions over C99. */ +#undef vprintk +asmlinkage int vprintk(const char *fmt, va_list args); +asmlinkage int (*__vprintk)(const char * fmt, va_list args) = vprintk; +asmlinkage int (*_vprintk)(const char * fmt, va_list args) = vprintk; +#undef printk asmlinkage int printk(const char *fmt, ...) { va_list args; @@ -567,6 +586,49 @@ 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 */ +EXPORT_SYMBOL(__vprintk); /* zeigt immer auf vprintk */ +EXPORT_SYMBOL(_vprintk); /* wird umgesetzt */ + +/*--------------------------------------------------------------------------------*\ +\*--------------------------------------------------------------------------------*/ +void set_printk(int (*__print)(const char * fmt, ...) __attribute__ ((format (printf, 1, 2)))) { + _printk = __print; +} +EXPORT_SYMBOL(set_printk); + +/*--------------------------------------------------------------------------------*\ +\*--------------------------------------------------------------------------------*/ +void set_vprintk(int (*__vprint)(const char * fmt, va_list args)) { + _vprintk = __vprint; +} +EXPORT_SYMBOL(set_vprintk); + +#if defined(CONFIG_AVM_SAMMEL) +void (*debug_sync)(void); +EXPORT_SYMBOL(debug_sync); +#endif/*--- #if defined(CONFIG_AVM_SAMMEL) ---*/ + +/*--------------------------------------------------------------------------------*\ +\*--------------------------------------------------------------------------------*/ +void restore_printk(void) { + if(_printk != printk) { +#if defined(CONFIG_AVM_SAMMEL) + if(debug_sync) { + debug_sync(); /*--- avm_debug -> printk ---*/ + } +#endif/*--- #if defined(CONFIG_AVM_SAMMEL) ---*/ + _vprintk = vprintk; + _printk = printk; + } +} +EXPORT_SYMBOL(restore_printk); + + /* cpu currently holding logbuf_lock */ static volatile unsigned int printk_cpu = UINT_MAX; @@ -668,6 +730,12 @@ printed_len += vscnprintf(printk_buf + printed_len, sizeof(printk_buf) - printed_len, fmt, args); + #ifdef CONFIG_DEBUG_LL + if (init_phase) { + printascii(printk_buf); + } + #endif + /* * Copy the output into log_buf. If the caller didn't provide @@ -1088,6 +1156,11 @@ { acquire_console_sem(); console->flags |= CON_ENABLED; + +#ifdef CONFIG_DEBUG_LL + init_phase = 0; +#endif + release_console_sem(); } EXPORT_SYMBOL(console_start); @@ -1128,6 +1201,9 @@ if (console->setup == NULL || console->setup(console, NULL) == 0) { console->flags |= CON_ENABLED; +#ifdef CONFIG_DEBUG_LL + init_phase = 0; +#endif if (console->device) { console->flags |= CON_CONSDEV; preferred_console = 0; @@ -1162,6 +1238,9 @@ console->setup(console, console_cmdline[i].options) != 0) break; console->flags |= CON_ENABLED; +#ifdef CONFIG_DEBUG_LL + init_phase = 0; +#endif console->index = console_cmdline[i].index; if (i == selected_console) { console->flags |= CON_CONSDEV;