Commit 95f72d1e authored by Yinghai Lu's avatar Yinghai Lu Committed by Benjamin Herrenschmidt

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: default avatarIngo Molnar <mingo@elte.hu>
Acked-by: default avatar"H. Peter Anvin" <hpa@zytor.com>
Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 1c5474a6
......@@ -1265,7 +1265,7 @@ and is between 256 and 4096 characters. It is defined in the file
If there are multiple matching configurations changing
the same attribute, the last one is used.
lmb=debug [KNL] Enable lmb debug messages.
memblock=debug [KNL] Enable memblock debug messages.
load_ramdisk= [RAM] List of ramdisks to load from floppy
See Documentation/blockdev/ramdisk.txt.
......
......@@ -5,7 +5,7 @@ mainmenu "Linux/Microblaze Kernel Configuration"
config MICROBLAZE
def_bool y
select HAVE_LMB
select HAVE_MEMBLOCK
select HAVE_FUNCTION_TRACER
select HAVE_FUNCTION_TRACE_MCOUNT_TEST
select HAVE_FUNCTION_GRAPH_TRACER
......
......@@ -6,12 +6,12 @@
* for more details.
*/
#ifndef _ASM_MICROBLAZE_LMB_H
#define _ASM_MICROBLAZE_LMB_H
#ifndef _ASM_MICROBLAZE_MEMBLOCK_H
#define _ASM_MICROBLAZE_MEMBLOCK_H
/* LMB limit is OFF */
#define LMB_REAL_LIMIT 0xFFFFFFFF
/* MEMBLOCK limit is OFF */
#define MEMBLOCK_REAL_LIMIT 0xFFFFFFFF
#endif /* _ASM_MICROBLAZE_LMB_H */
#endif /* _ASM_MICROBLAZE_MEMBLOCK_H */
......@@ -29,7 +29,7 @@
#include <linux/kexec.h>
#include <linux/debugfs.h>
#include <linux/irq.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/prom.h>
#include <asm/page.h>
......@@ -49,12 +49,12 @@ void __init early_init_dt_scan_chosen_arch(unsigned long node)
void __init early_init_dt_add_memory_arch(u64 base, u64 size)
{
lmb_add(base, size);
memblock_add(base, size);
}
u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
{
return lmb_alloc(size, align);
return memblock_alloc(size, align);
}
#ifdef CONFIG_EARLY_PRINTK
......@@ -104,8 +104,8 @@ void __init early_init_devtree(void *params)
*/
of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
/* Scan memory nodes and rebuild LMBs */
lmb_init();
/* Scan memory nodes and rebuild MEMBLOCKs */
memblock_init();
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
......@@ -113,9 +113,9 @@ void __init early_init_devtree(void *params)
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
parse_early_param();
lmb_analyze();
memblock_analyze();
pr_debug("Phys. mem: %lx\n", (unsigned long) lmb_phys_mem_size());
pr_debug("Phys. mem: %lx\n", (unsigned long) memblock_phys_mem_size());
pr_debug(" <- early_init_devtree()\n");
}
......
......@@ -10,7 +10,7 @@
#include <linux/bootmem.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/mm.h> /* mem_init */
#include <linux/initrd.h>
#include <linux/pagemap.h>
......@@ -76,10 +76,10 @@ void __init setup_memory(void)
u32 kernel_align_start, kernel_align_size;
/* Find main memory where is the kernel */
for (i = 0; i < lmb.memory.cnt; i++) {
memory_start = (u32) lmb.memory.region[i].base;
memory_end = (u32) lmb.memory.region[i].base
+ (u32) lmb.memory.region[i].size;
for (i = 0; i < memblock.memory.cnt; i++) {
memory_start = (u32) memblock.memory.region[i].base;
memory_end = (u32) memblock.memory.region[i].base
+ (u32) memblock.memory.region[i].size;
if ((memory_start <= (u32)_text) &&
((u32)_text <= memory_end)) {
memory_size = memory_end - memory_start;
......@@ -100,7 +100,7 @@ void __init setup_memory(void)
kernel_align_start = PAGE_DOWN((u32)_text);
/* ALIGN can be remove because _end in vmlinux.lds.S is align */
kernel_align_size = PAGE_UP((u32)klimit) - kernel_align_start;
lmb_reserve(kernel_align_start, kernel_align_size);
memblock_reserve(kernel_align_start, kernel_align_size);
printk(KERN_INFO "%s: kernel addr=0x%08x-0x%08x size=0x%08x\n",
__func__, kernel_align_start, kernel_align_start
+ kernel_align_size, kernel_align_size);
......@@ -141,18 +141,18 @@ void __init setup_memory(void)
map_size = init_bootmem_node(&contig_page_data,
PFN_UP(TOPHYS((u32)klimit)), min_low_pfn, max_low_pfn);
#endif
lmb_reserve(PFN_UP(TOPHYS((u32)klimit)) << PAGE_SHIFT, map_size);
memblock_reserve(PFN_UP(TOPHYS((u32)klimit)) << PAGE_SHIFT, map_size);
/* free bootmem is whole main memory */
free_bootmem(memory_start, memory_size);
/* reserve allocate blocks */
for (i = 0; i < lmb.reserved.cnt; i++) {
for (i = 0; i < memblock.reserved.cnt; i++) {
pr_debug("reserved %d - 0x%08x-0x%08x\n", i,
(u32) lmb.reserved.region[i].base,
(u32) lmb_size_bytes(&lmb.reserved, i));
reserve_bootmem(lmb.reserved.region[i].base,
lmb_size_bytes(&lmb.reserved, i) - 1, BOOTMEM_DEFAULT);
(u32) memblock.reserved.region[i].base,
(u32) memblock_size_bytes(&memblock.reserved, i));
reserve_bootmem(memblock.reserved.region[i].base,
memblock_size_bytes(&memblock.reserved, i) - 1, BOOTMEM_DEFAULT);
}
#ifdef CONFIG_MMU
init_bootmem_done = 1;
......@@ -235,7 +235,7 @@ static void mm_cmdline_setup(void)
if (maxmem && memory_size > maxmem) {
memory_size = maxmem;
memory_end = memory_start + memory_size;
lmb.memory.region[0].size = memory_size;
memblock.memory.region[0].size = memory_size;
}
}
}
......@@ -273,19 +273,19 @@ asmlinkage void __init mmu_init(void)
{
unsigned int kstart, ksize;
if (!lmb.reserved.cnt) {
if (!memblock.reserved.cnt) {
printk(KERN_EMERG "Error memory count\n");
machine_restart(NULL);
}
if ((u32) lmb.memory.region[0].size < 0x1000000) {
if ((u32) memblock.memory.region[0].size < 0x1000000) {
printk(KERN_EMERG "Memory must be greater than 16MB\n");
machine_restart(NULL);
}
/* Find main memory where the kernel is */
memory_start = (u32) lmb.memory.region[0].base;
memory_end = (u32) lmb.memory.region[0].base +
(u32) lmb.memory.region[0].size;
memory_start = (u32) memblock.memory.region[0].base;
memory_end = (u32) memblock.memory.region[0].base +
(u32) memblock.memory.region[0].size;
memory_size = memory_end - memory_start;
mm_cmdline_setup(); /* FIXME parse args from command line - not used */
......@@ -297,7 +297,7 @@ asmlinkage void __init mmu_init(void)
kstart = __pa(CONFIG_KERNEL_START); /* kernel start */
/* kernel size */
ksize = PAGE_ALIGN(((u32)_end - (u32)CONFIG_KERNEL_START));
lmb_reserve(kstart, ksize);
memblock_reserve(kstart, ksize);
#if defined(CONFIG_BLK_DEV_INITRD)
/* Remove the init RAM disk from the available memory. */
......@@ -335,7 +335,7 @@ void __init *early_get_page(void)
* Mem start + 32MB -> here is limit
* because of mem mapping from head.S
*/
p = __va(lmb_alloc_base(PAGE_SIZE, PAGE_SIZE,
p = __va(memblock_alloc_base(PAGE_SIZE, PAGE_SIZE,
memory_start + 0x2000000));
}
return p;
......
......@@ -132,7 +132,7 @@ config PPC
select HAVE_ARCH_KGDB
select HAVE_KRETPROBES
select HAVE_ARCH_TRACEHOOK
select HAVE_LMB
select HAVE_MEMBLOCK
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
select USE_GENERIC_SMP_HELPERS if SMP
......
......@@ -12,7 +12,7 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/types.h>
#include <asm/page.h>
......
#ifndef _ASM_POWERPC_LMB_H
#define _ASM_POWERPC_LMB_H
#ifndef _ASM_POWERPC_MEMBLOCK_H
#define _ASM_POWERPC_MEMBLOCK_H
#include <asm/udbg.h>
#define LMB_DBG(fmt...) udbg_printf(fmt)
#define MEMBLOCK_DBG(fmt...) udbg_printf(fmt)
#ifdef CONFIG_PPC32
extern phys_addr_t lowmem_end_addr;
#define LMB_REAL_LIMIT lowmem_end_addr
#define MEMBLOCK_REAL_LIMIT lowmem_end_addr
#else
#define LMB_REAL_LIMIT 0
#define MEMBLOCK_REAL_LIMIT 0
#endif
#endif /* _ASM_POWERPC_LMB_H */
#endif /* _ASM_POWERPC_MEMBLOCK_H */
......@@ -7,7 +7,7 @@
#include <linux/string.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/sections.h>
#include <asm/prom.h>
......
......@@ -24,7 +24,7 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/types.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/processor.h>
#include <asm/machdep.h>
......
......@@ -13,7 +13,7 @@
#include <linux/crash_dump.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/code-patching.h>
#include <asm/kdump.h>
#include <asm/prom.h>
......@@ -33,7 +33,7 @@ unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
#ifndef CONFIG_RELOCATABLE
void __init reserve_kdump_trampoline(void)
{
lmb_reserve(0, KDUMP_RESERVE_LIMIT);
memblock_reserve(0, KDUMP_RESERVE_LIMIT);
}
static void __init create_trampoline(unsigned long addr)
......
......@@ -71,7 +71,7 @@ static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
sd->max_direct_dma_addr = 0;
/* May need to bounce if the device can't address all of DRAM */
if ((dma_get_mask(dev) + 1) < lmb_end_of_DRAM())
if ((dma_get_mask(dev) + 1) < memblock_end_of_DRAM())
set_dma_ops(dev, &swiotlb_dma_ops);
return NOTIFY_DONE;
......
......@@ -9,7 +9,7 @@
#include <linux/dma-mapping.h>
#include <linux/dma-debug.h>
#include <linux/gfp.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/bug.h>
#include <asm/abs_addr.h>
......@@ -89,7 +89,7 @@ static int dma_direct_dma_supported(struct device *dev, u64 mask)
/* Could be improved so platforms can set the limit in case
* they have limited DMA windows
*/
return mask >= (lmb_end_of_DRAM() - 1);
return mask >= (memblock_end_of_DRAM() - 1);
#else
return 1;
#endif
......
......@@ -12,7 +12,7 @@
#include <linux/kexec.h>
#include <linux/reboot.h>
#include <linux/threads.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/of.h>
#include <asm/machdep.h>
#include <asm/prom.h>
......@@ -66,11 +66,11 @@ 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();
/* use common parsing */
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;
......@@ -133,9 +133,9 @@ void __init reserve_crashkernel(void)
"for crashkernel (System RAM: %ldMB)\n",
(unsigned long)(crash_size >> 20),
(unsigned long)(crashk_res.start >> 20),
(unsigned long)(lmb_phys_mem_size() >> 20));
(unsigned long)(memblock_phys_mem_size() >> 20));
lmb_reserve(crashk_res.start, crash_size);
memblock_reserve(crashk_res.start, crash_size);
}
int overlaps_crashkernel(unsigned long start, unsigned long size)
......
......@@ -9,7 +9,7 @@
#include <linux/threads.h>
#include <linux/module.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/firmware.h>
#include <asm/lppaca.h>
......@@ -117,7 +117,7 @@ void __init allocate_pacas(void)
* the first segment. On iSeries they must be within the area mapped
* by the HV, which is HvPagesToMap * HVPAGESIZE bytes.
*/
limit = min(0x10000000ULL, lmb.rmo_size);
limit = min(0x10000000ULL, memblock.rmo_size);
if (firmware_has_feature(FW_FEATURE_ISERIES))
limit = min(limit, HvPagesToMap * HVPAGESIZE);
......@@ -128,7 +128,7 @@ void __init allocate_pacas(void)
paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus);
paca = __va(lmb_alloc_base(paca_size, PAGE_SIZE, limit));
paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit));
memset(paca, 0, paca_size);
printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n",
......@@ -148,7 +148,7 @@ void __init free_unused_pacas(void)
if (new_size >= paca_size)
return;
lmb_free(__pa(paca) + new_size, paca_size - new_size);
memblock_free(__pa(paca) + new_size, paca_size - new_size);
printk(KERN_DEBUG "Freed %u bytes for unused pacas\n",
paca_size - new_size);
......
......@@ -31,7 +31,7 @@
#include <linux/kexec.h>
#include <linux/debugfs.h>
#include <linux/irq.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/prom.h>
#include <asm/rtas.h>
......@@ -98,7 +98,7 @@ static void __init move_device_tree(void)
if ((memory_limit && (start + size) > memory_limit) ||
overlaps_crashkernel(start, size)) {
p = __va(lmb_alloc_base(size, PAGE_SIZE, lmb.rmo_size));
p = __va(memblock_alloc_base(size, PAGE_SIZE, memblock.rmo_size));
memcpy(p, initial_boot_params, size);
initial_boot_params = (struct boot_param_header *)p;
DBG("Moved device tree to 0x%p\n", p);
......@@ -411,13 +411,13 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
{
__be32 *dm, *ls, *usm;
unsigned long l, n, flags;
u64 base, size, lmb_size;
u64 base, size, memblock_size;
unsigned int is_kexec_kdump = 0, rngs;
ls = of_get_flat_dt_prop(node, "ibm,lmb-size", &l);
ls = of_get_flat_dt_prop(node, "ibm,memblock-size", &l);
if (ls == NULL || l < dt_root_size_cells * sizeof(__be32))
return 0;
lmb_size = dt_mem_next_cell(dt_root_size_cells, &ls);
memblock_size = dt_mem_next_cell(dt_root_size_cells, &ls);
dm = of_get_flat_dt_prop(node, "ibm,dynamic-memory", &l);
if (dm == NULL || l < sizeof(__be32))
......@@ -442,11 +442,11 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
or if the block is not assigned to this partition (0x8) */
if ((flags & 0x80) || !(flags & 0x8))
continue;
size = lmb_size;
size = memblock_size;
rngs = 1;
if (is_kexec_kdump) {
/*
* For each lmb in ibm,dynamic-memory, a corresponding
* For each memblock in ibm,dynamic-memory, a corresponding
* entry in linux,drconf-usable-memory property contains
* a counter 'p' followed by 'p' (base, size) duple.
* Now read the counter from
......@@ -469,10 +469,10 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
if ((base + size) > 0x80000000ul)
size = 0x80000000ul - base;
}
lmb_add(base, size);
memblock_add(base, size);
} while (--rngs);
}
lmb_dump_all();
memblock_dump_all();
return 0;
}
#else
......@@ -501,14 +501,14 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
}
#endif
lmb_add(base, size);
memblock_add(base, size);
memstart_addr = min((u64)memstart_addr, base);
}
u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
{
return lmb_alloc(size, align);
return memblock_alloc(size, align);
}
#ifdef CONFIG_BLK_DEV_INITRD
......@@ -534,12 +534,12 @@ static void __init early_reserve_mem(void)
/* before we do anything, lets reserve the dt blob */
self_base = __pa((unsigned long)initial_boot_params);
self_size = initial_boot_params->totalsize;
lmb_reserve(self_base, self_size);
memblock_reserve(self_base, self_size);
#ifdef CONFIG_BLK_DEV_INITRD
/* then reserve the initrd, if any */
if (initrd_start && (initrd_end > initrd_start))
lmb_reserve(__pa(initrd_start), initrd_end - initrd_start);
memblock_reserve(__pa(initrd_start), initrd_end - initrd_start);
#endif /* CONFIG_BLK_DEV_INITRD */
#ifdef CONFIG_PPC32
......@@ -560,7 +560,7 @@ static void __init early_reserve_mem(void)
if (base_32 == self_base && size_32 == self_size)
continue;
DBG("reserving: %x -> %x\n", base_32, size_32);
lmb_reserve(base_32, size_32);
memblock_reserve(base_32, size_32);
}
return;
}
......@@ -571,7 +571,7 @@ static void __init early_reserve_mem(void)
if (size == 0)
break;
DBG("reserving: %llx -> %llx\n", base, size);
lmb_reserve(base, size);
memblock_reserve(base, size);
}
}
......@@ -594,7 +594,7 @@ static inline unsigned long phyp_dump_calculate_reserve_size(void)
return phyp_dump_info->reserve_bootvar;
/* divide by 20 to get 5% of value */
tmp = lmb_end_of_DRAM();
tmp = memblock_end_of_DRAM();
do_div(tmp, 20);
/* round it down in multiples of 256 */
......@@ -633,11 +633,11 @@ static void __init phyp_dump_reserve_mem(void)
if (phyp_dump_info->phyp_dump_is_active) {
/* Reserve *everything* above RMR.Area freed by userland tools*/
base = variable_reserve_size;
size = lmb_end_of_DRAM() - base;
size = memblock_end_of_DRAM() - base;
/* XXX crashed_ram_end is wrong, since it may be beyond
* the memory_limit, it will need to be adjusted. */
lmb_reserve(base, size);
memblock_reserve(base, size);
phyp_dump_info->init_reserve_start = base;
phyp_dump_info->init_reserve_size = size;
......@@ -645,8 +645,8 @@ static void __init phyp_dump_reserve_mem(void)
size = phyp_dump_info->cpu_state_size +
phyp_dump_info->hpte_region_size +
variable_reserve_size;
base = lmb_end_of_DRAM() - size;
lmb_reserve(base, size);
base = memblock_end_of_DRAM() - size;
memblock_reserve(base, size);
phyp_dump_info->init_reserve_start = base;
phyp_dump_info->init_reserve_size = size;
}
......@@ -681,8 +681,8 @@ void __init early_init_devtree(void *params)
*/
of_scan_flat_dt(early_init_dt_scan_chosen, NULL);
/* Scan memory nodes and rebuild LMBs */
lmb_init();
/* Scan memory nodes and rebuild MEMBLOCKs */
memblock_init();
of_scan_flat_dt(early_init_dt_scan_root, NULL);
of_scan_flat_dt(early_init_dt_scan_memory_ppc, NULL);
......@@ -690,11 +690,11 @@ void __init early_init_devtree(void *params)
strlcpy(boot_command_line, cmd_line, COMMAND_LINE_SIZE);
parse_early_param();
/* Reserve LMB regions used by kernel, initrd, dt, etc... */
lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
/* Reserve MEMBLOCK regions used by kernel, initrd, dt, etc... */
memblock_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
/* If relocatable, reserve first 32k for interrupt vectors etc. */
if (PHYSICAL_START > MEMORY_START)
lmb_reserve(MEMORY_START, 0x8000);
memblock_reserve(MEMORY_START, 0x8000);
reserve_kdump_trampoline();
reserve_crashkernel();
early_reserve_mem();
......@@ -706,17 +706,17 @@ void __init early_init_devtree(void *params)
/* Ensure that total memory size is page-aligned, because
* otherwise mark_bootmem() gets upset. */
lmb_analyze();
memsize = lmb_phys_mem_size();
memblock_analyze();
memsize = memblock_phys_mem_size();
if ((memsize & PAGE_MASK) != memsize)
limit = memsize & PAGE_MASK;
}
lmb_enforce_memory_limit(limit);
memblock_enforce_memory_limit(limit);
lmb_analyze();
lmb_dump_all();
memblock_analyze();
memblock_dump_all();
DBG("Phys. mem: %llx\n", lmb_phys_mem_size());
DBG("Phys. mem: %llx\n", memblock_phys_mem_size());
/* We may need to relocate the flat tree, do it now.
* FIXME .. and the initrd too? */
......
......@@ -22,7 +22,7 @@
#include <linux/smp.h>
#include <linux/completion.h>
#include <linux/cpumask.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/slab.h>
#include <asm/prom.h>
......@@ -934,11 +934,11 @@ void __init rtas_initialize(void)
*/
#ifdef CONFIG_PPC64
if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR)) {
rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX);
rtas_region = min(memblock.rmo_size, RTAS_INSTANTIATE_MAX);
ibm_suspend_me_token = rtas_token("ibm,suspend-me");
}
#endif
rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
rtas_rmo_buf = memblock_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
#ifdef CONFIG_RTAS_ERROR_LOGGING
rtas_last_error_token = rtas_token("rtas-last-error");
......
......@@ -33,7 +33,7 @@
#include <linux/serial_8250.h>
#include <linux/debugfs.h>
#include <linux/percpu.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/of_platform.h>
#include <asm/io.h>
#include <asm/paca.h>
......
......@@ -16,7 +16,7 @@
#include <linux/root_dev.h>
#include <linux/cpu.h>
#include <linux/console.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/io.h>
#include <asm/prom.h>
......@@ -246,12 +246,12 @@ static void __init irqstack_early_init(void)
unsigned int i;
/* interrupt stacks must be in lowmem, we get that for free on ppc32
* as the lmb is limited to lowmem by LMB_REAL_LIMIT */
* as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */
for_each_possible_cpu(i) {
softirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
hardirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
}
}
......@@ -261,15 +261,15 @@ static void __init exc_lvl_early_init(void)
unsigned int i;
/* interrupt stacks must be in lowmem, we get that for free on ppc32
* as the lmb is limited to lowmem by LMB_REAL_LIMIT */
* as the memblock is limited to lowmem by MEMBLOCK_REAL_LIMIT */
for_each_possible_cpu(i) {
critirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
#ifdef CONFIG_BOOKE
dbgirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
mcheckirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
#endif
}
}
......
......@@ -34,7 +34,7 @@
#include <linux/bootmem.h>
#include <linux/pci.h>
#include <linux/lockdep.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/io.h>
#include <asm/kdump.h>
#include <asm/prom.h>
......@@ -158,7 +158,7 @@ static void __init setup_paca(struct paca_struct *new_paca)
* the CPU that ignores the top 2 bits of the address in real
* mode so we can access kernel globals normally provided we
* only toy with things in the RMO region. From here, we do
* some early parsing of the device-tree to setup out LMB
* some early parsing of the device-tree to setup out MEMBLOCK
* data structures, and allocate & initialize the hash table
* and segment tables so we can start running with translation
* enabled.
......@@ -404,7 +404,7 @@ void __init setup_system(void)
printk("-----------------------------------------------------\n");
printk("ppc64_pft_size = 0x%llx\n", ppc64_pft_size);
printk("physicalMemorySize = 0x%llx\n", lmb_phys_mem_size());
printk("physicalMemorySize = 0x%llx\n", memblock_phys_mem_size());
if (ppc64_caches.dline_size != 0x80)
printk("ppc64_caches.dcache_line_size = 0x%x\n",
ppc64_caches.dline_size);
......@@ -443,10 +443,10 @@ static void __init irqstack_early_init(void)
*/
for_each_possible_cpu(i) {
softirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc_base(THREAD_SIZE,
__va(memblock_alloc_base(THREAD_SIZE,
THREAD_SIZE, limit));
hardirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc_base(THREAD_SIZE,
__va(memblock_alloc_base(THREAD_SIZE,
THREAD_SIZE, limit));
}
}
......@@ -458,11 +458,11 @@ static void __init exc_lvl_early_init(void)
for_each_possible_cpu(i) {
critirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
dbgirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
mcheckirq_ctx[i] = (struct thread_info *)
__va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
__va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
}
}
#else
......@@ -487,11 +487,11 @@ static void __init emergency_stack_init(void)
* bringup, we need to get at them in real mode. This means they
* must also be within the RMO region.
*/
limit = min(slb0_limit(), lmb.rmo_size);
limit = min(slb0_limit(), memblock.rmo_size);
for_each_possible_cpu(i) {
unsigned long sp;
sp = lmb_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
sp = memblock_alloc_base(THREAD_SIZE, THREAD_SIZE, limit);
sp += THREAD_SIZE;
paca[i].emergency_sp = __va(sp);
}
......
......@@ -22,7 +22,7 @@
#include <linux/elf.h>
#include <linux/security.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/pgtable.h>
#include <asm/system.h>
......@@ -734,7 +734,7 @@ static int __init vdso_init(void)
vdso_data->platform = machine_is(iseries) ? 0x200 : 0x100;
if (firmware_has_feature(FW_FEATURE_LPAR))
vdso_data->platform |= 1;
vdso_data->physicalMemorySize = lmb_phys_mem_size();
vdso_data->physicalMemorySize = memblock_phys_mem_size();
vdso_data->dcache_size = ppc64_caches.dsize;
vdso_data->dcache_line_size = ppc64_caches.dline_size;
vdso_data->icache_size = ppc64_caches.isize;
......
......@@ -135,7 +135,7 @@ unsigned long __init mmu_mapin_ram(unsigned long top)
/* If the size of RAM is not an exact power of two, we may not
* have covered RAM in its entirety with 16 and 4 MiB
* pages. Consequently, restrict the top end of RAM currently
* allocable so that calls to the LMB to allocate PTEs for "tail"
* allocable so that calls to the MEMBLOCK to allocate PTEs for "tail"
* coverage with normal-sized pages (or other reasons) do not
* attempt to allocate outside the allowed range.
*/
......
......@@ -31,7 +31,7 @@
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/signal.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/processor.h>
#include <asm/pgtable.h>
......@@ -384,8 +384,8 @@ static int __init htab_dt_scan_hugepage_blocks(unsigned long node,
printk(KERN_INFO "Huge page(16GB) memory: "
"addr = 0x%lX size = 0x%lX pages = %d\n",
phys_addr, block_size, expected_pages);
if (phys_addr + (16 * GB) <= lmb_end_of_DRAM()) {
lmb_reserve(phys_addr, block_size * expected_pages);
if (phys_addr + (16 * GB) <= memblock_end_of_DRAM()) {
memblock_reserve(phys_addr, block_size * expected_pages);
add_gpage(phys_addr, block_size, expected_pages);
}
return 0;
......@@ -458,7 +458,7 @@ static void __init htab_init_page_sizes(void)
* and we have at least 1G of RAM at boot
*/
if (mmu_psize_defs[MMU_PAGE_16M].shift &&
lmb_phys_mem_size() >= 0x40000000)
memblock_phys_mem_size() >= 0x40000000)
mmu_vmemmap_psize = MMU_PAGE_16M;
else if (mmu_psize_defs[MMU_PAGE_64K].shift)
mmu_vmemmap_psize = MMU_PAGE_64K;
......@@ -520,7 +520,7 @@ static unsigned long __init htab_get_table_size(void)
return 1UL << ppc64_pft_size;
/* round mem_size up to next power of 2 */
mem_size = lmb_phys_mem_size();
mem_size = memblock_phys_mem_size();
rnd_mem_size = 1UL << __ilog2(mem_size);
if (rnd_mem_size < mem_size)
rnd_mem_size <<= 1;
......@@ -627,7 +627,7 @@ static void __init htab_initialize(void)
else
limit = 0;
table = lmb_alloc_base(htab_size_bytes, htab_size_bytes, limit);
table = memblock_alloc_base(htab_size_bytes, htab_size_bytes, limit);
DBG("Hash table allocated at %lx, size: %lx\n", table,
htab_size_bytes);
......@@ -647,9 +647,9 @@ static void __init htab_initialize(void)
prot = pgprot_val(PAGE_KERNEL);
#ifdef CONFIG_DEBUG_PAGEALLOC
linear_map_hash_count = lmb_end_of_DRAM() >> PAGE_SHIFT;
linear_map_hash_slots = __va(lmb_alloc_base(linear_map_hash_count,
1, lmb.rmo_size));
linear_map_hash_count = memblock_end_of_DRAM() >> PAGE_SHIFT;
linear_map_hash_slots = __va(memblock_alloc_base(linear_map_hash_count,
1, memblock.rmo_size));
memset(linear_map_hash_slots, 0, linear_map_hash_count);
#endif /* CONFIG_DEBUG_PAGEALLOC */
......@@ -659,16 +659,16 @@ static void __init htab_initialize(void)
*/
/* create bolted the linear mapping in the hash table */
for (i=0; i < lmb.memory.cnt; i++) {
base = (unsigned long)__va(lmb.memory.region[i].base);
size = lmb.memory.region[i].size;
for (i=0; i < memblock.memory.cnt; i++) {
base = (unsigned long)__va(memblock.memory.region[i].base);
size = memblock.memory.region[i].size;
DBG("creating mapping for region: %lx..%lx (prot: %lx)\n",
base, size, prot);
#ifdef CONFIG_U3_DART
/* Do not map the DART space. Fortunately, it will be aligned
* in such a way that it will not cross two lmb regions and
* in such a way that it will not cross two memblock regions and
* will fit within a single 16Mb page.
* The DART space is assumed to be a full 16Mb region even if
* we only use 2Mb of that space. We will use more of it later
......
......@@ -30,7 +30,7 @@
#include <linux/highmem.h>
#include <linux/initrd.h>
#include <linux/pagemap.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/gfp.h>
#include <asm/pgalloc.h>
......@@ -136,17 +136,17 @@ void __init MMU_init(void)
/* parse args from command line */
MMU_setup();
if (lmb.memory.cnt > 1) {
if (memblock.memory.cnt > 1) {
#ifndef CONFIG_WII
lmb.memory.cnt = 1;
lmb_analyze();
memblock.memory.cnt = 1;
memblock_analyze();
printk(KERN_WARNING "Only using first contiguous memory region");
#else
wii_memory_fixups();
#endif
}
total_lowmem = total_memory = lmb_end_of_DRAM() - memstart_addr;
total_lowmem = total_memory = memblock_end_of_DRAM() - memstart_addr;
lowmem_end_addr = memstart_addr + total_lowmem;
#ifdef CONFIG_FSL_BOOKE
......@@ -161,8 +161,8 @@ void __init MMU_init(void)
lowmem_end_addr = memstart_addr + total_lowmem;
#ifndef CONFIG_HIGHMEM
total_memory = total_lowmem;
lmb_enforce_memory_limit(lowmem_end_addr);
lmb_analyze();
memblock_enforce_memory_limit(lowmem_end_addr);
memblock_analyze();
#endif /* CONFIG_HIGHMEM */
}
......@@ -200,7 +200,7 @@ void __init *early_get_page(void)
if (init_bootmem_done) {
p = alloc_bootmem_pages(PAGE_SIZE);
} else {
p = __va(lmb_alloc_base(PAGE_SIZE, PAGE_SIZE,
p = __va(memblock_alloc_base(PAGE_SIZE, PAGE_SIZE,
__initial_memory_limit_addr));
}
return p;
......
......@@ -40,7 +40,7 @@
#include <linux/nodemask.h>
#include <linux/module.h>
#include <linux/poison.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/hugetlb.h>
#include <linux/slab.h>
......
......@@ -32,7 +32,7 @@
#include <linux/initrd.h>
#include <linux/pagemap.h>
#include <linux/suspend.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/hugetlb.h>
#include <asm/pgalloc.h>
......@@ -83,13 +83,13 @@ int page_is_ram(unsigned long pfn)
#else
unsigned long paddr = (pfn << PAGE_SHIFT);
int i;
for (i=0; i < lmb.memory.cnt; i++) {
for (i=0; i < memblock.memory.cnt; i++) {
unsigned long base;
base = lmb.memory.region[i].base;
base = memblock.memory.region[i].base;
if ((paddr >= base) &&
(paddr < (base + lmb.memory.region[i].size))) {
(paddr < (base + memblock.memory.region[i].size))) {
return 1;
}
}
......@@ -142,14 +142,14 @@ int arch_add_memory(int nid, u64 start, u64 size)
/*
* walk_memory_resource() needs to make sure there is no holes in a given
* memory range. PPC64 does not maintain the memory layout in /proc/iomem.
* Instead it maintains it in lmb.memory structures. Walk through the
* Instead it maintains it in memblock.memory structures. Walk through the
* memory regions, find holes and callback for contiguous regions.
*/
int
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *))
{
struct lmb_property res;
struct memblock_property res;
unsigned long pfn, len;
u64 end;
int ret = -1;
......@@ -158,7 +158,7 @@ walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
res.size = (u64) nr_pages << PAGE_SHIFT;
end = res.base + res.size - 1;
while ((res.base < end) && (lmb_find(&res) >= 0)) {
while ((res.base < end) && (memblock_find(&res) >= 0)) {
pfn = (unsigned long)(res.base >> PAGE_SHIFT);
len = (unsigned long)(res.size >> PAGE_SHIFT);
ret = (*func)(pfn, len, arg);
......@@ -184,8 +184,8 @@ void __init do_init_bootmem(void)
unsigned long total_pages;
int boot_mapsize;
max_low_pfn = max_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT;
total_pages = (lmb_end_of_DRAM() - memstart_addr) >> PAGE_SHIFT;
max_low_pfn = max_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
total_pages = (memblock_end_of_DRAM() - memstart_addr) >> PAGE_SHIFT;
#ifdef CONFIG_HIGHMEM
total_pages = total_lowmem >> PAGE_SHIFT;
max_low_pfn = lowmem_end_addr >> PAGE_SHIFT;
......@@ -198,16 +198,16 @@ void __init do_init_bootmem(void)
*/
bootmap_pages = bootmem_bootmap_pages(total_pages);
start = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE);
start = memblock_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE);
min_low_pfn = MEMORY_START >> PAGE_SHIFT;
boot_mapsize = init_bootmem_node(NODE_DATA(0), start >> PAGE_SHIFT, min_low_pfn, max_low_pfn);
/* 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);
}
......@@ -218,17 +218,17 @@ void __init do_init_bootmem(void)
free_bootmem_with_active_regions(0, lowmem_end_addr >> PAGE_SHIFT);
/* reserve the sections we're already using */
for (i = 0; i < lmb.reserved.cnt; i++) {
unsigned long addr = lmb.reserved.region[i].base +
lmb_size_bytes(&lmb.reserved, i) - 1;
for (i = 0; i < memblock.reserved.cnt; i++) {
unsigned long addr = memblock.reserved.region[i].base +
memblock_size_bytes(&memblock.reserved, i) - 1;
if (addr < lowmem_end_addr)
reserve_bootmem(lmb.reserved.region[i].base,
lmb_size_bytes(&lmb.reserved, i),
reserve_bootmem(memblock.reserved.region[i].base,
memblock_size_bytes(&memblock.reserved, i),
BOOTMEM_DEFAULT);
else if (lmb.reserved.region[i].base < lowmem_end_addr) {
else if (memblock.reserved.region[i].base < lowmem_end_addr) {
unsigned long adjusted_size = lowmem_end_addr -
lmb.reserved.region[i].base;
reserve_bootmem(lmb.reserved.region[i].base,
memblock.reserved.region[i].base;
reserve_bootmem(memblock.reserved.region[i].base,
adjusted_size, BOOTMEM_DEFAULT);
}
}
......@@ -236,9 +236,9 @@ void __init do_init_bootmem(void)
free_bootmem_with_active_regions(0, max_pfn);
/* 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);
#endif
......@@ -251,20 +251,20 @@ void __init do_init_bootmem(void)
/* mark pages that don't exist as nosave */
static int __init mark_nonram_nosave(void)
{
unsigned long lmb_next_region_start_pfn,
lmb_region_max_pfn;
unsigned long memblock_next_region_start_pfn,
memblock_region_max_pfn;
int i;
for (i = 0; i < lmb.memory.cnt - 1; i++) {
lmb_region_max_pfn =
(lmb.memory.region[i].base >> PAGE_SHIFT) +
(lmb.memory.region[i].size >> PAGE_SHIFT);
lmb_next_region_start_pfn =
lmb.memory.region[i+1].base >> PAGE_SHIFT;
for (i = 0; i < memblock.memory.cnt - 1; i++) {
memblock_region_max_pfn =
(memblock.memory.region[i].base >> PAGE_SHIFT) +
(memblock.memory.region[i].size >> PAGE_SHIFT);
memblock_next_region_start_pfn =
memblock.memory.region[i+1].base >> PAGE_SHIFT;
if (lmb_region_max_pfn < lmb_next_region_start_pfn)
register_nosave_region(lmb_region_max_pfn,
lmb_next_region_start_pfn);
if (memblock_region_max_pfn < memblock_next_region_start_pfn)
register_nosave_region(memblock_region_max_pfn,
memblock_next_region_start_pfn);
}
return 0;
......@@ -275,8 +275,8 @@ static int __init mark_nonram_nosave(void)
*/
void __init paging_init(void)
{
unsigned long total_ram = lmb_phys_mem_size();
phys_addr_t top_of_ram = lmb_end_of_DRAM();
unsigned long total_ram = memblock_phys_mem_size();
phys_addr_t top_of_ram = memblock_end_of_DRAM();
unsigned long max_zone_pfns[MAX_NR_ZONES];
#ifdef CONFIG_PPC32
......@@ -327,7 +327,7 @@ void __init mem_init(void)
swiotlb_init(1);
#endif
num_physpages = lmb.memory.size >> PAGE_SHIFT;
num_physpages = memblock.memory.size >> PAGE_SHIFT;
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
#ifdef CONFIG_NEED_MULTIPLE_NODES
......@@ -364,7 +364,7 @@ void __init mem_init(void)
highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT;
for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
struct page *page = pfn_to_page(pfn);
if (lmb_is_reserved(pfn << PAGE_SHIFT))
if (memblock_is_reserved(pfn << PAGE_SHIFT))
continue;
ClearPageReserved(page);
init_page_count(page);
......
This diff is collapsed.
......@@ -26,7 +26,7 @@
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/highmem.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/slab.h>
#include <asm/pgtable.h>
......@@ -198,7 +198,7 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
* mem_init() sets high_memory so only do the check after that.
*/
if (mem_init_done && (p < virt_to_phys(high_memory)) &&
!(__allow_ioremap_reserved && lmb_is_region_reserved(p, size))) {
!(__allow_ioremap_reserved && memblock_is_region_reserved(p, size))) {
printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
(unsigned long long)p, __builtin_return_address(0));
return NULL;
......@@ -331,7 +331,7 @@ void __init mapin_ram(void)
s = mmu_mapin_ram(top);
__mapin_ram_chunk(s, top);
top = lmb_end_of_DRAM();
top = memblock_end_of_DRAM();
s = wii_mmu_mapin_mem2(top);
__mapin_ram_chunk(s, top);
}
......
......@@ -34,7 +34,7 @@
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/slab.h>
#include <asm/pgalloc.h>
......@@ -67,7 +67,7 @@ static void *early_alloc_pgtable(unsigned long size)
if (init_bootmem_done)
pt = __alloc_bootmem(size, size, __pa(MAX_DMA_ADDRESS));
else
pt = __va(lmb_alloc_base(size, size,
pt = __va(memblock_alloc_base(size, size,
__pa(MAX_DMA_ADDRESS)));
memset(pt, 0, size);
......
......@@ -26,7 +26,7 @@
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/highmem.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/prom.h>
#include <asm/mmu.h>
......@@ -223,7 +223,7 @@ void __init MMU_init_hw(void)
* Find some memory for the hash table.
*/
if ( ppc_md.progress ) ppc_md.progress("hash:find piece", 0x322);
Hash = __va(lmb_alloc_base(Hash_size, Hash_size,
Hash = __va(memblock_alloc_base(Hash_size, Hash_size,
__initial_memory_limit_addr));
cacheable_memzero(Hash, Hash_size);
_SDR1 = __pa(Hash) | SDR1_LOW_BITS;
......
......@@ -12,7 +12,7 @@
* 2 of the License, or (at your option) any later version.
*/
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/pgtable.h>
#include <asm/mmu.h>
......@@ -252,7 +252,7 @@ void __init stabs_alloc(void)
if (cpu == 0)
continue; /* stab for CPU 0 is statically allocated */
newstab = lmb_alloc_base(HW_PAGE_SIZE, HW_PAGE_SIZE,
newstab = memblock_alloc_base(HW_PAGE_SIZE, HW_PAGE_SIZE,
1<<SID_SHIFT);
newstab = (unsigned long)__va(newstab);
......
......@@ -34,7 +34,7 @@
#include <linux/pagemap.h>
#include <linux/preempt.h>
#include <linux/spinlock.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/tlbflush.h>
#include <asm/tlb.h>
......@@ -426,7 +426,7 @@ static void __early_init_mmu(int boot_cpu)
/* Set the global containing the top of the linear mapping
* for use by the TLB miss code
*/
linear_map_top = lmb_end_of_DRAM();
linear_map_top = memblock_end_of_DRAM();
/* A sync won't hurt us after mucking around with
* the MMU configuration
......
......@@ -16,7 +16,7 @@
#include <linux/kdev_t.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/system.h>
#include <asm/time.h>
......@@ -100,7 +100,7 @@ void __init corenet_ds_setup_arch(void)
#endif
#ifdef CONFIG_SWIOTLB
if (lmb_end_of_DRAM() > max) {
if (memblock_end_of_DRAM() > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
......
......@@ -17,7 +17,7 @@
#include <linux/seq_file.h>
#include <linux/interrupt.h>
#include <linux/of_platform.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/system.h>
#include <asm/time.h>
......@@ -94,7 +94,7 @@ static void __init mpc8536_ds_setup_arch(void)
#endif
#ifdef CONFIG_SWIOTLB
if (lmb_end_of_DRAM() > max) {
if (memblock_end_of_DRAM() > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
......
......@@ -20,7 +20,7 @@
#include <linux/seq_file.h>
#include <linux/interrupt.h>
#include <linux/of_platform.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/system.h>
#include <asm/time.h>
......@@ -190,7 +190,7 @@ static void __init mpc85xx_ds_setup_arch(void)
#endif
#ifdef CONFIG_SWIOTLB
if (lmb_end_of_DRAM() > max) {
if (memblock_end_of_DRAM() > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
......
......@@ -33,7 +33,7 @@
#include <linux/of_platform.h>
#include <linux/of_device.h>
#include <linux/phy.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/system.h>
#include <asm/atomic.h>
......@@ -325,7 +325,7 @@ static void __init mpc85xx_mds_setup_arch(void)
#endif /* CONFIG_QUICC_ENGINE */
#ifdef CONFIG_SWIOTLB
if (lmb_end_of_DRAM() > max) {
if (memblock_end_of_DRAM() > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
......
......@@ -19,7 +19,7 @@
#include <linux/delay.h>
#include <linux/seq_file.h>
#include <linux/of_platform.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/system.h>
#include <asm/time.h>
......@@ -103,7 +103,7 @@ mpc86xx_hpcn_setup_arch(void)
#endif
#ifdef CONFIG_SWIOTLB
if (lmb_end_of_DRAM() > max) {
if (memblock_end_of_DRAM() > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_dma_ops);
ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
......
......@@ -29,7 +29,7 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/slab.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/prom.h>
#include <asm/iommu.h>
......@@ -845,10 +845,10 @@ static int __init cell_iommu_init_disabled(void)
/* If we found a DMA window, we check if it's big enough to enclose
* all of physical memory. If not, we force enable IOMMU
*/
if (np && size < lmb_end_of_DRAM()) {
if (np && size < memblock_end_of_DRAM()) {
printk(KERN_WARNING "iommu: force-enabled, dma window"
" (%ldMB) smaller than total memory (%lldMB)\n",
size >> 20, lmb_end_of_DRAM() >> 20);
size >> 20, memblock_end_of_DRAM() >> 20);
return -ENODEV;
}
......@@ -1064,7 +1064,7 @@ static int __init cell_iommu_fixed_mapping_init(void)
}
fbase = _ALIGN_UP(fbase, 1 << IO_SEGMENT_SHIFT);
fsize = lmb_phys_mem_size();
fsize = memblock_phys_mem_size();
if ((fbase + fsize) <= 0x800000000ul)
hbase = 0; /* use the device tree window */
......@@ -1169,7 +1169,7 @@ static int __init cell_iommu_init(void)
* Note: should we make sure we have the IOMMU actually disabled ?
*/
if (iommu_is_off ||
(!iommu_force_on && lmb_end_of_DRAM() <= 0x80000000ull))
(!iommu_force_on && memblock_end_of_DRAM() <= 0x80000000ull))
if (cell_iommu_init_disabled() == 0)
goto bail;
......
......@@ -20,7 +20,7 @@
#include <linux/seq_file.h>
#include <linux/kexec.h>
#include <linux/of_platform.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <mm/mmu_decl.h>
#include <asm/io.h>
......@@ -65,7 +65,7 @@ static int __init page_aligned(unsigned long x)
void __init wii_memory_fixups(void)
{
struct lmb_property *p = lmb.memory.region;
struct memblock_property *p = memblock.memory.region;
/*
* This is part of a workaround to allow the use of two
......@@ -77,7 +77,7 @@ void __init wii_memory_fixups(void)
* between both ranges.
*/
BUG_ON(lmb.memory.cnt != 2);
BUG_ON(memblock.memory.cnt != 2);
BUG_ON(!page_aligned(p[0].base) || !page_aligned(p[1].base));
p[0].size = _ALIGN_DOWN(p[0].size, PAGE_SIZE);
......@@ -92,11 +92,11 @@ void __init wii_memory_fixups(void)
p[0].size += wii_hole_size + p[1].size;
lmb.memory.cnt = 1;
lmb_analyze();
memblock.memory.cnt = 1;
memblock_analyze();
/* reserve the hole */
lmb_reserve(wii_hole_start, wii_hole_size);
memblock_reserve(wii_hole_start, wii_hole_size);
/* allow ioremapping the address space in the hole */
__allow_ioremap_reserved = 1;
......
......@@ -41,7 +41,7 @@
#include <linux/smp.h>
#include <linux/bitops.h>
#include <linux/of_device.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/processor.h>
#include <asm/sections.h>
......
......@@ -204,7 +204,7 @@ int __init iob_init(struct device_node *dn)
pr_debug(" -> %s\n", __func__);
/* Allocate a spare page to map all invalid IOTLB pages. */
tmp = lmb_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE);
tmp = memblock_alloc(IOBMAP_PAGE_SIZE, IOBMAP_PAGE_SIZE);
if (!tmp)
panic("IOBMAP: Cannot allocate spare page!");
/* Empty l1 is marked invalid */
......@@ -275,7 +275,7 @@ void __init alloc_iobmap_l2(void)
return;
#endif
/* For 2G space, 8x64 pages (2^21 bytes) is max total l2 size */
iob_l2_base = (u32 *)abs_to_virt(lmb_alloc_base(1UL<<21, 1UL<<21, 0x80000000));
iob_l2_base = (u32 *)abs_to_virt(memblock_alloc_base(1UL<<21, 1UL<<21, 0x80000000));
printk(KERN_INFO "IOBMAP L2 allocated at: %p\n", iob_l2_base);
}
......@@ -51,7 +51,7 @@
#include <linux/suspend.h>
#include <linux/of_device.h>
#include <linux/of_platform.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/reg.h>
#include <asm/sections.h>
......@@ -619,7 +619,7 @@ static int __init pmac_probe(void)
* driver needs that. We have to allocate it now. We allocate 4k
* (1 small page) for now.
*/
smu_cmdbuf_abs = lmb_alloc_base(4096, 4096, 0x80000000UL);
smu_cmdbuf_abs = memblock_alloc_base(4096, 4096, 0x80000000UL);
#endif /* CONFIG_PMAC_SMU */
return 1;
......
......@@ -19,7 +19,7 @@
*/
#include <linux/kernel.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/machdep.h>
#include <asm/prom.h>
......
......@@ -21,7 +21,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/memory_hotplug.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/slab.h>
#include <asm/cell-regs.h>
......@@ -318,8 +318,8 @@ static int __init ps3_mm_add_memory(void)
return result;
}
lmb_add(start_addr, map.r1.size);
lmb_analyze();
memblock_add(start_addr, map.r1.size);
memblock_analyze();
result = online_pages(start_pfn, nr_pages);
......
......@@ -24,7 +24,7 @@
#include <linux/fs.h>
#include <linux/syscalls.h>
#include <linux/ctype.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/of.h>
#include <linux/slab.h>
......@@ -723,7 +723,7 @@ static void os_area_queue_work(void)
* flash to a high address in the boot memory region and then puts that RAM
* address and the byte count into the repository for retrieval by the guest.
* We copy the data we want into a static variable and allow the memory setup
* by the HV to be claimed by the lmb manager.
* by the HV to be claimed by the memblock manager.
*
* The os area mirror will not be available to a second stage kernel, and
* the header verify will fail. In this case, the saved_params values will
......
......@@ -10,14 +10,14 @@
*/
#include <linux/of.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/vmalloc.h>
#include <asm/firmware.h>
#include <asm/machdep.h>
#include <asm/pSeries_reconfig.h>
#include <asm/sparsemem.h>
static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
static int pseries_remove_memblock(unsigned long base, unsigned int memblock_size)
{
unsigned long start, start_pfn;
struct zone *zone;
......@@ -26,7 +26,7 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
start_pfn = base >> PAGE_SHIFT;
if (!pfn_valid(start_pfn)) {
lmb_remove(base, lmb_size);
memblock_remove(base, memblock_size);
return 0;
}
......@@ -41,20 +41,20 @@ static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
* to sysfs "state" file and we can't remove sysfs entries
* while writing to it. So we have to defer it to here.
*/
ret = __remove_pages(zone, start_pfn, lmb_size >> PAGE_SHIFT);
ret = __remove_pages(zone, start_pfn, memblock_size >> PAGE_SHIFT);
if (ret)
return ret;
/*
* Update memory regions for memory remove
*/
lmb_remove(base, lmb_size);
memblock_remove(base, memblock_size);
/*
* Remove htab bolted mappings for this section of memory
*/
start = (unsigned long)__va(base);
ret = remove_section_mapping(start, start + lmb_size);
ret = remove_section_mapping(start, start + memblock_size);
/* Ensure all vmalloc mappings are flushed in case they also
* hit that section of memory
......@@ -69,7 +69,7 @@ static int pseries_remove_memory(struct device_node *np)
const char *type;
const unsigned int *regs;
unsigned long base;
unsigned int lmb_size;
unsigned int memblock_size;
int ret = -EINVAL;
/*
......@@ -80,16 +80,16 @@ static int pseries_remove_memory(struct device_node *np)
return 0;
/*
* Find the bae address and size of the lmb
* Find the bae address and size of the memblock
*/
regs = of_get_property(np, "reg", NULL);
if (!regs)
return ret;
base = *(unsigned long *)regs;
lmb_size = regs[3];
memblock_size = regs[3];
ret = pseries_remove_lmb(base, lmb_size);
ret = pseries_remove_memblock(base, memblock_size);
return ret;
}
......@@ -98,7 +98,7 @@ static int pseries_add_memory(struct device_node *np)
const char *type;
const unsigned int *regs;
unsigned long base;
unsigned int lmb_size;
unsigned int memblock_size;
int ret = -EINVAL;
/*
......@@ -109,43 +109,43 @@ static int pseries_add_memory(struct device_node *np)
return 0;
/*
* Find the base and size of the lmb
* Find the base and size of the memblock
*/
regs = of_get_property(np, "reg", NULL);
if (!regs)
return ret;
base = *(unsigned long *)regs;
lmb_size = regs[3];
memblock_size = regs[3];
/*
* Update memory region to represent the memory add
*/
ret = lmb_add(base, lmb_size);
ret = memblock_add(base, memblock_size);
return (ret < 0) ? -EINVAL : 0;
}
static int pseries_drconf_memory(unsigned long *base, unsigned int action)
{
struct device_node *np;
const unsigned long *lmb_size;
const unsigned long *memblock_size;
int rc;
np = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
if (!np)
return -EINVAL;
lmb_size = of_get_property(np, "ibm,lmb-size", NULL);
if (!lmb_size) {
memblock_size = of_get_property(np, "ibm,memblock-size", NULL);
if (!memblock_size) {
of_node_put(np);
return -EINVAL;
}
if (action == PSERIES_DRCONF_MEM_ADD) {
rc = lmb_add(*base, *lmb_size);
rc = memblock_add(*base, *memblock_size);
rc = (rc < 0) ? -EINVAL : 0;
} else if (action == PSERIES_DRCONF_MEM_REMOVE) {
rc = pseries_remove_lmb(*base, *lmb_size);
rc = pseries_remove_memblock(*base, *memblock_size);
} else {
rc = -EINVAL;
}
......
......@@ -66,7 +66,7 @@ static int tce_build_pSeries(struct iommu_table *tbl, long index,
tcep = ((u64 *)tbl->it_base) + index;
while (npages--) {
/* can't move this out since we might cross LMB boundary */
/* can't move this out since we might cross MEMBLOCK boundary */
rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
*tcep = proto_tce | (rpn & TCE_RPN_MASK) << TCE_RPN_SHIFT;
......
......@@ -255,12 +255,12 @@ void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr)
/* ------------------------------------------------- */
/**
* release_memory_range -- release memory previously lmb_reserved
* release_memory_range -- release memory previously memblock_reserved
* @start_pfn: starting physical frame number
* @nr_pages: number of pages to free.
*
* This routine will release memory that had been previously
* lmb_reserved in early boot. The released memory becomes
* memblock_reserved in early boot. The released memory becomes
* available for genreal use.
*/
static void release_memory_range(unsigned long start_pfn,
......
......@@ -36,7 +36,7 @@
#include <linux/dma-mapping.h>
#include <linux/vmalloc.h>
#include <linux/suspend.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/gfp.h>
#include <asm/io.h>
#include <asm/prom.h>
......@@ -232,7 +232,7 @@ static int __init dart_init(struct device_node *dart_node)
* that to work around what looks like a problem with the HT bridge
* prefetching into invalid pages and corrupting data
*/
tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
tmp = memblock_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) &
DARTMAP_RPNMASK);
......@@ -407,7 +407,7 @@ void __init alloc_dart_table(void)
if (iommu_is_off)
return;
if (!iommu_force_on && lmb_end_of_DRAM() <= 0x40000000ull)
if (!iommu_force_on && memblock_end_of_DRAM() <= 0x40000000ull)
return;
/* 512 pages (2MB) is max DART tablesize. */
......@@ -416,7 +416,7 @@ void __init alloc_dart_table(void)
* will blow up an entire large page anyway in the kernel mapping
*/
dart_tablebase = (unsigned long)
abs_to_virt(lmb_alloc_base(1UL<<24, 1UL<<24, 0x80000000L));
abs_to_virt(memblock_alloc_base(1UL<<24, 1UL<<24, 0x80000000L));
printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase);
}
......@@ -23,7 +23,7 @@
#include <linux/string.h>
#include <linux/init.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/log2.h>
#include <linux/slab.h>
......@@ -190,7 +190,7 @@ static void __init setup_pci_atmu(struct pci_controller *hose,
pr_info("%s: PCICSRBAR @ 0x%x\n", name, pcicsrbar);
/* Setup inbound mem window */
mem = lmb_end_of_DRAM();
mem = memblock_end_of_DRAM();
sz = min(mem, paddr_lo);
mem_log = __ilog2_u64(sz);
......
......@@ -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
......
#ifndef __ASM_SH_LMB_H
#define __ASM_SH_LMB_H
#define LMB_REAL_LIMIT 0
#endif /* __ASM_SH_LMB_H */
#ifndef __ASM_SH_MEMBLOCK_H
#define __ASM_SH_MEMBLOCK_H
#define MEMBLOCK_REAL_LIMIT 0
#endif /* __ASM_SH_MEMBLOCK_H */
......@@ -15,7 +15,7 @@
#include <linux/numa.h>
#include <linux/ftrace.h>
#include <linux/suspend.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <asm/mmu_context.h>
......@@ -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;
......
......@@ -30,7 +30,7 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <asm/page.h>
......@@ -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;
......
......@@ -16,7 +16,7 @@
#include <linux/pagemap.h>
#include <linux/percpu.h>
#include <linux/io.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/dma-mapping.h>
#include <asm/mmu_context.h>
#include <asm/mmzone.h>
......@@ -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();
......
......@@ -9,7 +9,7 @@
*/
#include <linux/module.h>
#include <linux/bootmem.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/mm.h>
#include <linux/numa.h>
#include <linux/pfn.h>
......@@ -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);
......
......@@ -42,7 +42,7 @@ config SPARC64
select HAVE_FUNCTION_TRACE_MCOUNT_TEST
select HAVE_KRETPROBES
select HAVE_KPROBES
select HAVE_LMB
select HAVE_MEMBLOCK
select HAVE_SYSCALL_WRAPPERS
select HAVE_DYNAMIC_FTRACE
select HAVE_FTRACE_MCOUNT_RECORD
......
#ifndef _SPARC64_LMB_H
#define _SPARC64_LMB_H
#include <asm/oplib.h>
#define LMB_DBG(fmt...) prom_printf(fmt)
#define LMB_REAL_LIMIT 0
#endif /* !(_SPARC64_LMB_H) */
#ifndef _SPARC64_MEMBLOCK_H
#define _SPARC64_MEMBLOCK_H
#include <asm/oplib.h>
#define MEMBLOCK_DBG(fmt...) prom_printf(fmt)
#define MEMBLOCK_REAL_LIMIT 0
#endif /* !(_SPARC64_MEMBLOCK_H) */
......@@ -4,7 +4,7 @@
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/log2.h>
#include <linux/list.h>
#include <linux/slab.h>
......@@ -86,7 +86,7 @@ static void mdesc_handle_init(struct mdesc_handle *hp,
hp->handle_size = handle_size;
}
static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
static struct mdesc_handle * __init mdesc_memblock_alloc(unsigned int mdesc_size)
{
unsigned int handle_size, alloc_size;
struct mdesc_handle *hp;
......@@ -97,7 +97,7 @@ static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
mdesc_size);
alloc_size = PAGE_ALIGN(handle_size);
paddr = lmb_alloc(alloc_size, PAGE_SIZE);
paddr = memblock_alloc(alloc_size, PAGE_SIZE);
hp = NULL;
if (paddr) {
......@@ -107,7 +107,7 @@ static struct mdesc_handle * __init mdesc_lmb_alloc(unsigned int mdesc_size)
return hp;
}
static void mdesc_lmb_free(struct mdesc_handle *hp)
static void mdesc_memblock_free(struct mdesc_handle *hp)
{
unsigned int alloc_size;
unsigned long start;
......@@ -120,9 +120,9 @@ static void mdesc_lmb_free(struct mdesc_handle *hp)
free_bootmem_late(start, alloc_size);
}
static struct mdesc_mem_ops lmb_mdesc_ops = {
.alloc = mdesc_lmb_alloc,
.free = mdesc_lmb_free,
static struct mdesc_mem_ops memblock_mdesc_ops = {
.alloc = mdesc_memblock_alloc,
.free = mdesc_memblock_free,
};
static struct mdesc_handle *mdesc_kmalloc(unsigned int mdesc_size)
......@@ -914,7 +914,7 @@ void __init sun4v_mdesc_init(void)
printk("MDESC: Size is %lu bytes.\n", len);
hp = mdesc_alloc(len, &lmb_mdesc_ops);
hp = mdesc_alloc(len, &memblock_mdesc_ops);
if (hp == NULL) {
prom_printf("MDESC: alloc of %lu bytes failed.\n", len);
prom_halt();
......
......@@ -20,7 +20,7 @@
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/of_device.h>
#include <asm/prom.h>
......@@ -34,7 +34,7 @@
void * __init prom_early_alloc(unsigned long size)
{
unsigned long paddr = lmb_alloc(size, SMP_CACHE_BYTES);
unsigned long paddr = memblock_alloc(size, SMP_CACHE_BYTES);
void *ret;
if (!paddr) {
......
......@@ -23,7 +23,7 @@
#include <linux/cache.h>
#include <linux/sort.h>
#include <linux/percpu.h>
#include <linux/lmb.h>
#include <linux/memblock.h>
#include <linux/mmzone.h>
#include <linux/gfp.h>
......@@ -726,7 +726,7 @@ static void __init find_ramdisk(unsigned long phys_base)
initrd_start = ramdisk_image;
initrd_end = ramdisk_image + sparc_ramdisk_size;
lmb_reserve(initrd_start, sparc_ramdisk_size);
memblock_reserve(initrd_start, sparc_ramdisk_size);
initrd_start += PAGE_OFFSET;
initrd_end += PAGE_OFFSET;
......@@ -822,7 +822,7 @@ static void __init allocate_node_data(int nid)
struct pglist_data *p;
#ifdef CONFIG_NEED_MULTIPLE_NODES
paddr = lmb_alloc_nid(sizeof(struct pglist_data),
paddr = memblock_alloc_nid(sizeof(struct pglist_data),
SMP_CACHE_BYTES, nid, nid_range);
if (!paddr) {
prom_printf("Cannot allocate pglist_data for nid[%d]\n", nid);
......@@ -843,7 +843,7 @@ static void __init allocate_node_data(int nid)
if (p->node_spanned_pages) {
num_pages = bootmem_bootmap_pages(p->node_spanned_pages);
paddr = lmb_alloc_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid,
paddr = memblock_alloc_nid(num_pages << PAGE_SHIFT, PAGE_SIZE, nid,
nid_range);
if (!paddr) {
prom_printf("Cannot allocate bootmap for nid[%d]\n",
......@@ -974,11 +974,11 @@ static void __init add_node_ranges(void)
{
int i;
for (i = 0; i < lmb.memory.cnt; i++) {
unsigned long size = lmb_size_bytes(&lmb.memory, i);
for (i = 0; i < memblock.memory.cnt; i++) {
unsigned long size = memblock_size_bytes(&memblock.memory, i);
unsigned long start, end;
start = lmb.memory.region[i].base;
start = memblock.memory.region[i].base;
end = start + size;
while (start < end) {
unsigned long this_end;
......@@ -1010,7 +1010,7 @@ static int __init grab_mlgroups(struct mdesc_handle *md)
if (!count)
return -ENOENT;
paddr = lmb_alloc(count * sizeof(struct mdesc_mlgroup),
paddr = memblock_alloc(count * sizeof(struct mdesc_mlgroup),
SMP_CACHE_BYTES);
if (!paddr)
return -ENOMEM;
......@@ -1051,7 +1051,7 @@ static int __init grab_mblocks(struct mdesc_handle *md)
if (!count)
return -ENOENT;
paddr = lmb_alloc(count * sizeof(struct mdesc_mblock),
paddr = memblock_alloc(count * sizeof(struct mdesc_mblock),
SMP_CACHE_BYTES);
if (!paddr)
return -ENOMEM;
......@@ -1279,8 +1279,8 @@ static int bootmem_init_numa(void)
static void __init bootmem_init_nonnuma(void)
{
unsigned long top_of_ram = lmb_end_of_DRAM();
unsigned long total_ram = lmb_phys_mem_size();
unsigned long top_of_ram = memblock_end_of_DRAM();
unsigned long total_ram = memblock_phys_mem_size();
unsigned int i;
numadbg("bootmem_init_nonnuma()\n");
......@@ -1292,15 +1292,15 @@ static void __init bootmem_init_nonnuma(void)
init_node_masks_nonnuma();
for (i = 0; i < lmb.memory.cnt; i++) {
unsigned long size = lmb_size_bytes(&lmb.memory, i);
for (i = 0; i < memblock.memory.cnt; i++) {
unsigned long size = memblock_size_bytes(&memblock.memory, i);
unsigned long start_pfn, end_pfn;
if (!size)
continue;
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);
}
......@@ -1338,9 +1338,9 @@ static void __init trim_reserved_in_node(int nid)
numadbg(" trim_reserved_in_node(%d)\n", nid);
for (i = 0; i < lmb.reserved.cnt; i++) {
unsigned long start = lmb.reserved.region[i].base;
unsigned long size = lmb_size_bytes(&lmb.reserved, i);
for (i = 0; i < memblock.reserved.cnt; i++) {
unsigned long start = memblock.reserved.region[i].base;
unsigned long size = memblock_size_bytes(&memblock.reserved, i);
unsigned long end = start + size;
reserve_range_in_node(nid, start, end);
......@@ -1384,7 +1384,7 @@ static unsigned long __init bootmem_init(unsigned long phys_base)
unsigned long end_pfn;
int nid;
end_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT;
end_pfn = memblock_end_of_DRAM() >> PAGE_SHIFT;
max_pfn = max_low_pfn = end_pfn;
min_low_pfn = (phys_base >> PAGE_SHIFT);
......@@ -1734,7 +1734,7 @@ void __init paging_init(void)
sun4v_ktsb_init();
}
lmb_init();
memblock_init();
/* Find available physical memory...
*
......@@ -1752,17 +1752,17 @@ void __init paging_init(void)
phys_base = 0xffffffffffffffffUL;
for (i = 0; i < pavail_ents; i++) {
phys_base = min(phys_base, pavail[i].phys_addr);
lmb_add(pavail[i].phys_addr, pavail[i].reg_size);
memblock_add(pavail[i].phys_addr, pavail[i].reg_size);
}
lmb_reserve(kern_base, kern_size);
memblock_reserve(kern_base, kern_size);
find_ramdisk(phys_base);
lmb_enforce_memory_limit(cmdline_memory_size);
memblock_enforce_memory_limit(cmdline_memory_size);
lmb_analyze();
lmb_dump_all();
memblock_analyze();
memblock_dump_all();
set_bit(0, mmu_context_bmap);
......@@ -1816,8 +1816,8 @@ void __init paging_init(void)
*/
for_each_possible_cpu(i) {
/* XXX Use node local allocations... XXX */
softirq_stack[i] = __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
hardirq_stack[i] = __va(lmb_alloc(THREAD_SIZE, THREAD_SIZE));
softirq_stack[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
hardirq_stack[i] = __va(memblock_alloc(THREAD_SIZE, THREAD_SIZE));
}
/* Setup bootmem... */
......
#ifndef _LINUX_LMB_H
#define _LINUX_LMB_H
#ifndef _LINUX_MEMBLOCK_H
#define _LINUX_MEMBLOCK_H
#ifdef __KERNEL__
/*
......@@ -16,74 +16,74 @@
#include <linux/init.h>
#include <linux/mm.h>
#define MAX_LMB_REGIONS 128
#define MAX_MEMBLOCK_REGIONS 128
struct lmb_property {
struct memblock_property {
u64 base;
u64 size;
};
struct lmb_region {
struct memblock_region {
unsigned long cnt;
u64 size;
struct lmb_property region[MAX_LMB_REGIONS+1];
struct memblock_property region[MAX_MEMBLOCK_REGIONS+1];
};
struct lmb {
struct memblock {
unsigned long debug;
u64 rmo_size;
struct lmb_region memory;
struct lmb_region reserved;
struct memblock_region memory;
struct memblock_region reserved;
};
extern struct lmb lmb;
extern struct memblock memblock;
extern void __init lmb_init(void);
extern void __init lmb_analyze(void);
extern long lmb_add(u64 base, u64 size);
extern long lmb_remove(u64 base, u64 size);
extern long __init lmb_free(u64 base, u64 size);
extern long __init lmb_reserve(u64 base, u64 size);
extern u64 __init lmb_alloc_nid(u64 size, u64 align, int nid,
extern void __init memblock_init(void);
extern void __init memblock_analyze(void);
extern long memblock_add(u64 base, u64 size);
extern long memblock_remove(u64 base, u64 size);
extern long __init memblock_free(u64 base, u64 size);
extern long __init memblock_reserve(u64 base, u64 size);
extern u64 __init memblock_alloc_nid(u64 size, u64 align, int nid,
u64 (*nid_range)(u64, u64, int *));
extern u64 __init lmb_alloc(u64 size, u64 align);
extern u64 __init lmb_alloc_base(u64 size,
extern u64 __init memblock_alloc(u64 size, u64 align);
extern u64 __init memblock_alloc_base(u64 size,
u64, u64 max_addr);
extern u64 __init __lmb_alloc_base(u64 size,
extern u64 __init __memblock_alloc_base(u64 size,
u64 align, u64 max_addr);
extern u64 __init lmb_phys_mem_size(void);
extern u64 lmb_end_of_DRAM(void);
extern void __init lmb_enforce_memory_limit(u64 memory_limit);
extern int __init lmb_is_reserved(u64 addr);
extern int lmb_is_region_reserved(u64 base, u64 size);
extern int lmb_find(struct lmb_property *res);
extern u64 __init memblock_phys_mem_size(void);
extern u64 memblock_end_of_DRAM(void);
extern void __init memblock_enforce_memory_limit(u64 memory_limit);
extern int __init memblock_is_reserved(u64 addr);
extern int memblock_is_region_reserved(u64 base, u64 size);
extern int memblock_find(struct memblock_property *res);
extern void lmb_dump_all(void);
extern void memblock_dump_all(void);
static inline u64
lmb_size_bytes(struct lmb_region *type, unsigned long region_nr)
memblock_size_bytes(struct memblock_region *type, unsigned long region_nr)
{
return type->region[region_nr].size;
}
static inline u64
lmb_size_pages(struct lmb_region *type, unsigned long region_nr)
memblock_size_pages(struct memblock_region *type, unsigned long region_nr)
{
return lmb_size_bytes(type, region_nr) >> PAGE_SHIFT;
return memblock_size_bytes(type, region_nr) >> PAGE_SHIFT;
}
static inline u64
lmb_start_pfn(struct lmb_region *type, unsigned long region_nr)
memblock_start_pfn(struct memblock_region *type, unsigned long region_nr)
{
return type->region[region_nr].base >> PAGE_SHIFT;
}
static inline u64
lmb_end_pfn(struct lmb_region *type, unsigned long region_nr)
memblock_end_pfn(struct memblock_region *type, unsigned long region_nr)
{
return lmb_start_pfn(type, region_nr) +
lmb_size_pages(type, region_nr);
return memblock_start_pfn(type, region_nr) +
memblock_size_pages(type, region_nr);
}
#include <asm/lmb.h>
#include <asm/memblock.h>
#endif /* __KERNEL__ */
#endif /* _LINUX_LMB_H */
#endif /* _LINUX_MEMBLOCK_H */
......@@ -181,9 +181,6 @@ config HAS_DMA
config CHECK_SIGNATURE
bool
config HAVE_LMB
boolean
config CPUMASK_OFFSTACK
bool "Force CPU masks off stack" if DEBUG_PER_CPU_MAPS
help
......
......@@ -89,8 +89,6 @@ obj-$(CONFIG_CPU_NOTIFIER_ERROR_INJECT) += cpu-notifier-error-inject.o
lib-$(CONFIG_GENERIC_BUG) += bug.o
obj-$(CONFIG_HAVE_LMB) += lmb.o
obj-$(CONFIG_HAVE_ARCH_TRACEHOOK) += syscall.o
obj-$(CONFIG_DYNAMIC_DEBUG) += dynamic_debug.o
......
......@@ -128,6 +128,9 @@ config SPARSEMEM_VMEMMAP
pfn_to_page and page_to_pfn operations. This is the most
efficient option when sufficient kernel resources are available.
config HAVE_MEMBLOCK
boolean
# eventually, we can have this option just 'select SPARSEMEM'
config MEMORY_HOTPLUG
bool "Allow for memory hot-add"
......
......@@ -15,6 +15,8 @@ obj-y := bootmem.o filemap.o mempool.o oom_kill.o fadvise.o \
$(mmu-y)
obj-y += init-mm.o
obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
obj-$(CONFIG_BOUNCE) += bounce.o
obj-$(CONFIG_SWAP) += page_io.o swap_state.o swapfile.o thrash.o
obj-$(CONFIG_HAS_DMA) += dmapool.o
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment