Skip to content

Commit

Permalink
x86: use unflatten_and_copy_device_tree
Browse files Browse the repository at this point in the history
Use the common unflatten_and_copy_device_tree to copy the built-in FDT
out of init section.

Signed-off-by: Rob Herring <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
  • Loading branch information
Rob Herring committed Oct 9, 2013
1 parent 3486892 commit 21c561b
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions arch/x86/kernel/devicetree.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,32 +230,25 @@ static void __init dtb_apic_setup(void)
static void __init x86_flattree_get_config(void)
{
u32 size, map_len;
void *new_dtb;
struct boot_param_header *dt;

if (!initial_dtb)
return;

map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK),
(u64)sizeof(struct boot_param_header));

initial_boot_params = early_memremap(initial_dtb, map_len);
size = be32_to_cpu(initial_boot_params->totalsize);
dt = early_memremap(initial_dtb, map_len);
size = be32_to_cpu(dt->totalsize);
if (map_len < size) {
early_iounmap(initial_boot_params, map_len);
initial_boot_params = early_memremap(initial_dtb, size);
early_iounmap(dt, map_len);
dt = early_memremap(initial_dtb, size);
map_len = size;
}

new_dtb = alloc_bootmem(size);
memcpy(new_dtb, initial_boot_params, size);
early_iounmap(initial_boot_params, map_len);

initial_boot_params = new_dtb;

/* root level address cells */
of_scan_flat_dt(early_init_dt_scan_root, NULL);

unflatten_device_tree();
initial_boot_params = dt;
unflatten_and_copy_device_tree();
early_iounmap(dt, map_len);
}
#else
static inline void x86_flattree_get_config(void) { }
Expand Down

0 comments on commit 21c561b

Please sign in to comment.