diff --git a/kernel/printk.c b/kernel/printk.c
index 5b75d0e..9889f5a 100644
|
a
|
b
|
|
| 37 | 37 | |
| 38 | 38 | #include <asm/uaccess.h> |
| 39 | 39 | #include <asm/plat-s3c24xx/neo1973.h> |
| | 40 | #include <asm/io.h> |
| 40 | 41 | |
| 41 | 42 | /* |
| 42 | 43 | * Architectures can override it: |
| … |
… |
static char *log_buf = __log_buf; |
| 145 | 146 | static int log_buf_len = __LOG_BUF_LEN; |
| 146 | 147 | static unsigned logged_chars; /* Number of chars produced since last read+clear operation */ |
| 147 | 148 | |
| | 149 | struct ramconsole_header { |
| | 150 | __u32 magic; |
| | 151 | unsigned start; |
| | 152 | unsigned end; |
| | 153 | unsigned len; |
| | 154 | char data[1]; |
| | 155 | }; |
| | 156 | static struct ramconsole_header *ramconsole; |
| | 157 | |
| 148 | 158 | static int __init log_buf_len_setup(char *str) |
| 149 | 159 | { |
| 150 | 160 | unsigned size = memparse(str, &str); |
| … |
… |
static void emit_log_char(char c) |
| 500 | 510 | con_start = log_end - log_buf_len; |
| 501 | 511 | if (logged_chars < log_buf_len) |
| 502 | 512 | logged_chars++; |
| | 513 | if (ramconsole) { |
| | 514 | ramconsole->data[ramconsole->end % ramconsole->len] = c; |
| | 515 | ramconsole->end++; |
| | 516 | if (ramconsole->end - ramconsole->start > ramconsole->len) |
| | 517 | ramconsole->start = ramconsole->end - ramconsole->len; |
| | 518 | } |
| 503 | 519 | } |
| 504 | 520 | |
| 505 | 521 | /* |
| … |
… |
bool printk_timed_ratelimit(unsigned long *caller_jiffies, |
| 1341 | 1357 | return false; |
| 1342 | 1358 | } |
| 1343 | 1359 | EXPORT_SYMBOL(printk_timed_ratelimit); |
| | 1360 | |
| | 1361 | static int __init ramconsole_start(void) |
| | 1362 | { |
| | 1363 | unsigned i; |
| | 1364 | struct ramconsole_header *log; |
| | 1365 | |
| | 1366 | log = ioremap(0x30000000 + (127<<20), 1024*1024); |
| | 1367 | if (!log) { |
| | 1368 | printk(KERN_WARNING "ramconsole: ioremap failed\n"); |
| | 1369 | return 1; |
| | 1370 | } |
| | 1371 | |
| | 1372 | if (log->magic == 0xffffffff) { |
| | 1373 | printk(KERN_NOTICE "ramconsole: found uninitialized memory, initializing ramconsole\n"); |
| | 1374 | log->magic = 0x12345678; |
| | 1375 | log->start = 0; |
| | 1376 | log->end = 0; |
| | 1377 | log->len = 1024*512; |
| | 1378 | } else if (log->magic == 0x12345678) { |
| | 1379 | log->len = 1024*512; |
| | 1380 | printk(KERN_NOTICE "ramconsole: found existing ramconsole. Dumping %d bytes of data:\n", log->len); |
| | 1381 | if (log->end - log->start > log->len) { |
| | 1382 | printk(KERN_WARNING "ramconsole: end - start > len\n"); |
| | 1383 | log->start = log->end - log->len; |
| | 1384 | } |
| | 1385 | for (i = log->start; i != log->end; i++) { |
| | 1386 | emit_log_char(log->data[i % log->len]); |
| | 1387 | } |
| | 1388 | printk(KERN_NOTICE "ramconsole: old data ends here\n"); |
| | 1389 | } else { |
| | 1390 | printk(KERN_WARNING "ramconsole: invalid magic %08x\n", log->magic); |
| | 1391 | return 1; |
| | 1392 | } |
| | 1393 | |
| | 1394 | ramconsole = log; |
| | 1395 | return 1; |
| | 1396 | } |
| | 1397 | late_initcall(ramconsole_start); |
| 1344 | 1398 | #endif |