From 95f72d1ed41a66f1c1c29c24d479de81a0bea36f Mon Sep 17 00:00:00 2001 From: Yinghai Lu Date: Mon, 12 Jul 2010 14:36:09 +1000 Subject: lmb: rename to memblock via following scripts FILES=$(find * -type f | grep -vE 'oprofile|[^K]config') sed -i \ -e 's/lmb/memblock/g' \ -e 's/LMB/MEMBLOCK/g' \ $FILES for N in $(find . -name lmb.[ch]); do M=$(echo $N | sed 's/lmb/memblock/g') mv $N $M done and remove some wrong change like lmbench and dlmb etc. also move memblock.c from lib/ to mm/ Suggested-by: Ingo Molnar Acked-by: "H. Peter Anvin" Acked-by: Benjamin Herrenschmidt Acked-by: Linus Torvalds Signed-off-by: Yinghai Lu Signed-off-by: Benjamin Herrenschmidt --- arch/sh/Kconfig | 2 +- arch/sh/include/asm/lmb.h | 6 ------ arch/sh/include/asm/memblock.h | 6 ++++++ arch/sh/kernel/machine_kexec.c | 18 +++++++++--------- arch/sh/kernel/setup.c | 8 ++++---- arch/sh/mm/init.c | 40 ++++++++++++++++++++-------------------- arch/sh/mm/numa.c | 8 ++++---- 7 files changed, 44 insertions(+), 44 deletions(-) delete mode 100644 arch/sh/include/asm/lmb.h create mode 100644 arch/sh/include/asm/memblock.h (limited to 'arch/sh') diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 573fca1fbd9b..82868fee21fd 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -10,7 +10,7 @@ config SUPERH select EMBEDDED select HAVE_CLK select HAVE_IDE if HAS_IOPORT - select HAVE_LMB + select HAVE_MEMBLOCK select HAVE_OPROFILE select HAVE_GENERIC_DMA_COHERENT select HAVE_ARCH_TRACEHOOK diff --git a/arch/sh/include/asm/lmb.h b/arch/sh/include/asm/lmb.h deleted file mode 100644 index 9b437f657ffa..000000000000 --- a/arch/sh/include/asm/lmb.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __ASM_SH_LMB_H -#define __ASM_SH_LMB_H - -#define LMB_REAL_LIMIT 0 - -#endif /* __ASM_SH_LMB_H */ diff --git a/arch/sh/include/asm/memblock.h b/arch/sh/include/asm/memblock.h new file mode 100644 index 000000000000..dfe683b88075 --- /dev/null +++ b/arch/sh/include/asm/memblock.h @@ -0,0 +1,6 @@ +#ifndef __ASM_SH_MEMBLOCK_H +#define __ASM_SH_MEMBLOCK_H + +#define MEMBLOCK_REAL_LIMIT 0 + +#endif /* __ASM_SH_MEMBLOCK_H */ diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c index 5a559e666eb3..e2a3af31ff99 100644 --- a/arch/sh/kernel/machine_kexec.c +++ b/arch/sh/kernel/machine_kexec.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include #include #include @@ -157,10 +157,10 @@ void __init reserve_crashkernel(void) unsigned long long crash_size, crash_base; int ret; - /* this is necessary because of lmb_phys_mem_size() */ - lmb_analyze(); + /* this is necessary because of memblock_phys_mem_size() */ + memblock_analyze(); - ret = parse_crashkernel(boot_command_line, lmb_phys_mem_size(), + ret = parse_crashkernel(boot_command_line, memblock_phys_mem_size(), &crash_size, &crash_base); if (ret == 0 && crash_size > 0) { crashk_res.start = crash_base; @@ -172,14 +172,14 @@ void __init reserve_crashkernel(void) crash_size = PAGE_ALIGN(crashk_res.end - crashk_res.start + 1); if (!crashk_res.start) { - unsigned long max = lmb_end_of_DRAM() - memory_limit; - crashk_res.start = __lmb_alloc_base(crash_size, PAGE_SIZE, max); + unsigned long max = memblock_end_of_DRAM() - memory_limit; + crashk_res.start = __memblock_alloc_base(crash_size, PAGE_SIZE, max); if (!crashk_res.start) { pr_err("crashkernel allocation failed\n"); goto disable; } } else { - ret = lmb_reserve(crashk_res.start, crash_size); + ret = memblock_reserve(crashk_res.start, crash_size); if (unlikely(ret < 0)) { pr_err("crashkernel reservation failed - " "memory is in use\n"); @@ -192,7 +192,7 @@ void __init reserve_crashkernel(void) /* * Crash kernel trumps memory limit */ - if ((lmb_end_of_DRAM() - memory_limit) <= crashk_res.end) { + if ((memblock_end_of_DRAM() - memory_limit) <= crashk_res.end) { memory_limit = 0; pr_info("Disabled memory limit for crashkernel\n"); } @@ -201,7 +201,7 @@ void __init reserve_crashkernel(void) "for crashkernel (System RAM: %ldMB)\n", (unsigned long)(crash_size >> 20), (unsigned long)(crashk_res.start), - (unsigned long)(lmb_phys_mem_size() >> 20)); + (unsigned long)(memblock_phys_mem_size() >> 20)); return; diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index 272734681d29..e769401a78ba 100644 --- a/arch/sh/kernel/setup.c +++ b/arch/sh/kernel/setup.c @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -141,10 +141,10 @@ void __init check_for_initrd(void) goto disable; } - if (unlikely(end > lmb_end_of_DRAM())) { + if (unlikely(end > memblock_end_of_DRAM())) { pr_err("initrd extends beyond end of memory " "(0x%08lx > 0x%08lx)\ndisabling initrd\n", - end, (unsigned long)lmb_end_of_DRAM()); + end, (unsigned long)memblock_end_of_DRAM()); goto disable; } @@ -161,7 +161,7 @@ void __init check_for_initrd(void) initrd_start = (unsigned long)__va(__pa(start)); initrd_end = initrd_start + INITRD_SIZE; - lmb_reserve(__pa(initrd_start), INITRD_SIZE); + memblock_reserve(__pa(initrd_start), INITRD_SIZE); return; diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 46f84de62469..d0e249100e98 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -33,7 +33,7 @@ pgd_t swapper_pg_dir[PTRS_PER_PGD]; void __init generic_mem_init(void) { - lmb_add(__MEMORY_START, __MEMORY_SIZE); + memblock_add(__MEMORY_START, __MEMORY_SIZE); } void __init __weak plat_mem_setup(void) @@ -176,12 +176,12 @@ void __init allocate_pgdat(unsigned int nid) get_pfn_range_for_nid(nid, &start_pfn, &end_pfn); #ifdef CONFIG_NEED_MULTIPLE_NODES - phys = __lmb_alloc_base(sizeof(struct pglist_data), + phys = __memblock_alloc_base(sizeof(struct pglist_data), SMP_CACHE_BYTES, end_pfn << PAGE_SHIFT); /* Retry with all of system memory */ if (!phys) - phys = __lmb_alloc_base(sizeof(struct pglist_data), - SMP_CACHE_BYTES, lmb_end_of_DRAM()); + phys = __memblock_alloc_base(sizeof(struct pglist_data), + SMP_CACHE_BYTES, memblock_end_of_DRAM()); if (!phys) panic("Can't allocate pgdat for node %d\n", nid); @@ -212,7 +212,7 @@ static void __init bootmem_init_one_node(unsigned int nid) total_pages = bootmem_bootmap_pages(p->node_spanned_pages); - paddr = lmb_alloc(total_pages << PAGE_SHIFT, PAGE_SIZE); + paddr = memblock_alloc(total_pages << PAGE_SHIFT, PAGE_SIZE); if (!paddr) panic("Can't allocate bootmap for nid[%d]\n", nid); @@ -227,9 +227,9 @@ static void __init bootmem_init_one_node(unsigned int nid) */ if (nid == 0) { /* Reserve the sections we're already using. */ - for (i = 0; i < lmb.reserved.cnt; i++) - reserve_bootmem(lmb.reserved.region[i].base, - lmb_size_bytes(&lmb.reserved, i), + for (i = 0; i < memblock.reserved.cnt; i++) + reserve_bootmem(memblock.reserved.region[i].base, + memblock_size_bytes(&memblock.reserved, i), BOOTMEM_DEFAULT); } @@ -241,10 +241,10 @@ static void __init do_init_bootmem(void) int i; /* Add active regions with valid PFNs. */ - for (i = 0; i < lmb.memory.cnt; i++) { + for (i = 0; i < memblock.memory.cnt; i++) { unsigned long start_pfn, end_pfn; - start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; - end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); + start_pfn = memblock.memory.region[i].base >> PAGE_SHIFT; + end_pfn = start_pfn + memblock_size_pages(&memblock.memory, i); __add_active_range(0, start_pfn, end_pfn); } @@ -276,7 +276,7 @@ static void __init early_reserve_mem(void) * this catches the (definitely buggy) case of us accidentally * initializing the bootmem allocator with an invalid RAM area. */ - lmb_reserve(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET, + memblock_reserve(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET, (PFN_PHYS(start_pfn) + PAGE_SIZE - 1) - (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET)); @@ -284,7 +284,7 @@ static void __init early_reserve_mem(void) * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET. */ if (CONFIG_ZERO_PAGE_OFFSET != 0) - lmb_reserve(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET); + memblock_reserve(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET); /* * Handle additional early reservations @@ -299,27 +299,27 @@ void __init paging_init(void) unsigned long vaddr, end; int nid; - lmb_init(); + memblock_init(); sh_mv.mv_mem_init(); early_reserve_mem(); - lmb_enforce_memory_limit(memory_limit); - lmb_analyze(); + memblock_enforce_memory_limit(memory_limit); + memblock_analyze(); - lmb_dump_all(); + memblock_dump_all(); /* * Determine low and high memory ranges: */ - max_low_pfn = max_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT; + max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT; min_low_pfn = __MEMORY_START >> PAGE_SHIFT; nodes_clear(node_online_map); memory_start = (unsigned long)__va(__MEMORY_START); - memory_end = memory_start + (memory_limit ?: lmb_phys_mem_size()); + memory_end = memory_start + (memory_limit ?: memblock_phys_mem_size()); uncached_init(); pmb_init(); diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index a2e645f64a37..3d85225b9e95 100644 --- a/arch/sh/mm/numa.c +++ b/arch/sh/mm/numa.c @@ -9,7 +9,7 @@ */ #include #include -#include +#include #include #include #include @@ -39,12 +39,12 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) pmb_bolt_mapping((unsigned long)__va(start), start, end - start, PAGE_KERNEL); - lmb_add(start, end - start); + memblock_add(start, end - start); __add_active_range(nid, start_pfn, end_pfn); /* Node-local pgdat */ - NODE_DATA(nid) = __va(lmb_alloc_base(sizeof(struct pglist_data), + NODE_DATA(nid) = __va(memblock_alloc_base(sizeof(struct pglist_data), SMP_CACHE_BYTES, end)); memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); @@ -54,7 +54,7 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) /* Node-local bootmap */ bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); - bootmem_paddr = lmb_alloc_base(bootmap_pages << PAGE_SHIFT, + bootmem_paddr = memblock_alloc_base(bootmap_pages << PAGE_SHIFT, PAGE_SIZE, end); init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT, start_pfn, end_pfn); -- cgit v1.2.3-59-g8ed1b