From: Thierry Reding Date: Thu, 24 Oct 2013 12:37:24 +0000 (+0200) Subject: Merge remote-tracking branch 'dt-rh/for-next' X-Git-Tag: next-20131024~45 X-Git-Url: https://git.karo-electronics.de/?p=karo-tx-linux.git;a=commitdiff_plain;h=90605becc7c6db45a84bb2d2a364db6e008f2a6e Merge remote-tracking branch 'dt-rh/for-next' --- 90605becc7c6db45a84bb2d2a364db6e008f2a6e diff --cc drivers/of/fdt.c index a4fa9ad31b8f,5c479104fc67..2fa024b97c43 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@@ -801,4 -910,39 +909,28 @@@ void __init unflatten_device_tree(void of_alias_scan(early_init_dt_alloc_memory_arch); } + /** + * unflatten_and_copy_device_tree - copy and create tree of device_nodes from flat blob + * + * Copies and unflattens the device-tree passed by the firmware, creating the + * tree of struct device_node. It also fills the "name" and "type" + * pointers of the nodes so the normal device-tree walking functions + * can be used. This should only be used when the FDT memory has not been + * reserved such is the case when the FDT is built-in to the kernel init + * section. If the FDT memory is reserved already then unflatten_device_tree + * should be used instead. + */ + void __init unflatten_and_copy_device_tree(void) + { + int size = __be32_to_cpu(initial_boot_params->totalsize); + void *dt = early_init_dt_alloc_memory_arch(size, + __alignof__(struct boot_param_header)); + + if (dt) { + memcpy(dt, initial_boot_params, size); + initial_boot_params = dt; + } + unflatten_device_tree(); + } + #endif /* CONFIG_OF_EARLY_FLATTREE */ - -/* Feed entire flattened device tree into the random pool */ -static int __init add_fdt_randomness(void) -{ - if (initial_boot_params) - add_device_randomness(initial_boot_params, - be32_to_cpu(initial_boot_params->totalsize)); - - return 0; -} -core_initcall(add_fdt_randomness);