From: Felix Fietkau Date: Sun, 22 Jul 2012 16:39:33 +0000 (+0000) Subject: crashlog: fix dependency, add memblock support X-Git-Tag: reboot~13341 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b59bc92c6edf517d0a2d958530ac58fc58f74c32;p=oweals%2Fopenwrt.git crashlog: fix dependency, add memblock support SVN-Revision: 32787 --- diff --git a/target/linux/generic/patches-3.3/930-crashlog.patch b/target/linux/generic/patches-3.3/930-crashlog.patch index cc18714703..d0ff752305 100644 --- a/target/linux/generic/patches-3.3/930-crashlog.patch +++ b/target/linux/generic/patches-3.3/930-crashlog.patch @@ -1,13 +1,18 @@ --- /dev/null +++ b/include/linux/crashlog.h -@@ -0,0 +1,12 @@ +@@ -0,0 +1,17 @@ +#ifndef __CRASHLOG_H +#define __CRASHLOG_H + +#ifdef CONFIG_CRASHLOG -+void __init crashlog_init_mem(struct bootmem_data *bdata); ++void __init crashlog_init_bootmem(struct bootmem_data *bdata); ++void __init crashlog_init_memblock(phys_addr_t addr, phys_addr_t size); +#else -+static inline void crashlog_init_mem(struct bootmem_data *bdata) ++static inline void crashlog_init_bootmem(struct bootmem_data *bdata) ++{ ++} ++ ++static inline void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) +{ +} +#endif @@ -21,7 +26,7 @@ +config CRASHLOG + bool "Crash logging" -+ depends on !NO_BOOTMEM && !HAVE_MEMBLOCK ++ depends on !NO_BOOTMEM || HAVE_MEMBLOCK + config BLK_DEV_INITRD bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support" @@ -38,7 +43,7 @@ --- /dev/null +++ b/kernel/crashlog.c -@@ -0,0 +1,171 @@ +@@ -0,0 +1,190 @@ +/* + * Crash information logger + * Copyright (C) 2010 Felix Fietkau @@ -64,6 +69,7 @@ + +#include +#include ++#include +#include +#include +#include @@ -96,7 +102,8 @@ + +extern struct list_head *crashlog_modules; + -+void __init crashlog_init_mem(bootmem_data_t *bdata) ++#ifndef CONFIG_NO_BOOTMEM ++void __init crashlog_init_bootmem(bootmem_data_t *bdata) +{ + unsigned long addr; + @@ -111,6 +118,23 @@ + } + crashlog_addr = addr; +} ++#endif ++ ++#ifdef CONFIG_HAVE_MEMBLOCK ++void __init crashlog_init_memblock(phys_addr_t addr, phys_addr_t size) ++{ ++ if (crashlog_addr) ++ return; ++ ++ addr += size - CRASHLOG_OFFSET; ++ if (memblock_reserve(addr, CRASHLOG_SIZE)) { ++ printk("Crashlog failed to allocate RAM at address 0x%lx\n", (unsigned long) addr); ++ return; ++ } ++ ++ crashlog_addr = addr; ++} ++#endif + +static void __init crashlog_copy(void) +{ @@ -224,7 +248,7 @@ if (!bdata->node_bootmem_map) return 0; -+ crashlog_init_mem(bdata); ++ crashlog_init_bootmem(bdata); start = bdata->node_min_pfn; end = bdata->node_low_pfn; @@ -240,3 +264,22 @@ /* Block module loading/unloading? */ +--- a/mm/memblock.c ++++ b/mm/memblock.c +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + + static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; + static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock; +@@ -305,6 +306,8 @@ static void __init_memblock memblock_ins + memblock_set_region_node(rgn, nid); + type->cnt++; + type->total_size += size; ++ if (type == &memblock.memory && idx == 0) ++ crashlog_init_memblock(base, size); + } + + /**