提交 672c5446 编写于 作者: G Grant Likely

dt/flattree: Return virtual address from early_init_dt_alloc_memory_arch()

The physical address is never used by the device tree code when
allocating memory for unflattening.  Change the architecture's alloc
hook to return the virutal address instead.
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
上级 1b59be2a
...@@ -47,9 +47,9 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) ...@@ -47,9 +47,9 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
memblock_add(base, size); memblock_add(base, size);
} }
u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
{ {
return memblock_alloc(size, align); return __va(memblock_alloc(size, align));
} }
#ifdef CONFIG_EARLY_PRINTK #ifdef CONFIG_EARLY_PRINTK
......
...@@ -45,11 +45,9 @@ void __init free_mem_mach(unsigned long addr, unsigned long size) ...@@ -45,11 +45,9 @@ void __init free_mem_mach(unsigned long addr, unsigned long size)
return free_bootmem(addr, size); return free_bootmem(addr, size);
} }
u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
{ {
return virt_to_phys( return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS));
__alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS))
);
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
......
...@@ -519,9 +519,9 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) ...@@ -519,9 +519,9 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size)
memblock_add(base, size); memblock_add(base, size);
} }
u64 __init early_init_dt_alloc_memory_arch(u64 size, u64 align) void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align)
{ {
return memblock_alloc(size, align); return __va(memblock_alloc(size, align));
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
......
...@@ -692,12 +692,6 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname, ...@@ -692,12 +692,6 @@ int __init early_init_dt_scan_chosen(unsigned long node, const char *uname,
return 1; return 1;
} }
static void *__init early_device_tree_alloc(u64 size, u64 align)
{
unsigned long mem = early_init_dt_alloc_memory_arch(size, align);
return __va(mem);
}
/** /**
* unflatten_device_tree - create tree of device_nodes from flat blob * unflatten_device_tree - create tree of device_nodes from flat blob
* *
...@@ -709,7 +703,7 @@ static void *__init early_device_tree_alloc(u64 size, u64 align) ...@@ -709,7 +703,7 @@ static void *__init early_device_tree_alloc(u64 size, u64 align)
void __init unflatten_device_tree(void) void __init unflatten_device_tree(void)
{ {
__unflatten_device_tree(initial_boot_params, &allnodes, __unflatten_device_tree(initial_boot_params, &allnodes,
early_device_tree_alloc); early_init_dt_alloc_memory_arch);
/* Get pointer to OF "/chosen" node for use everywhere */ /* Get pointer to OF "/chosen" node for use everywhere */
of_chosen = of_find_node_by_path("/chosen"); of_chosen = of_find_node_by_path("/chosen");
......
...@@ -97,7 +97,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node); ...@@ -97,7 +97,7 @@ extern void early_init_dt_check_for_initrd(unsigned long node);
extern int early_init_dt_scan_memory(unsigned long node, const char *uname, extern int early_init_dt_scan_memory(unsigned long node, const char *uname,
int depth, void *data); int depth, void *data);
extern void early_init_dt_add_memory_arch(u64 base, u64 size); extern void early_init_dt_add_memory_arch(u64 base, u64 size);
extern u64 early_init_dt_alloc_memory_arch(u64 size, u64 align); extern void * early_init_dt_alloc_memory_arch(u64 size, u64 align);
extern u64 dt_mem_next_cell(int s, __be32 **cellp); extern u64 dt_mem_next_cell(int s, __be32 **cellp);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册