diff options
-rw-r--r-- | arch/x86/kernel/devicetree.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86/kernel/devicetree.c b/arch/x86/kernel/devicetree.c index d35078ea1446..7db54b5d5f86 100644 --- a/arch/x86/kernel/devicetree.c +++ b/arch/x86/kernel/devicetree.c | |||
@@ -206,23 +206,21 @@ static void __init dtb_apic_setup(void) | |||
206 | static void __init x86_flattree_get_config(void) | 206 | static void __init x86_flattree_get_config(void) |
207 | { | 207 | { |
208 | u32 size, map_len; | 208 | u32 size, map_len; |
209 | struct boot_param_header *dt; | 209 | void *dt; |
210 | 210 | ||
211 | if (!initial_dtb) | 211 | if (!initial_dtb) |
212 | return; | 212 | return; |
213 | 213 | ||
214 | map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), | 214 | map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128); |
215 | (u64)sizeof(struct boot_param_header)); | ||
216 | 215 | ||
217 | dt = early_memremap(initial_dtb, map_len); | 216 | initial_boot_params = dt = early_memremap(initial_dtb, map_len); |
218 | size = be32_to_cpu(dt->totalsize); | 217 | size = of_get_flat_dt_size(); |
219 | if (map_len < size) { | 218 | if (map_len < size) { |
220 | early_iounmap(dt, map_len); | 219 | early_iounmap(dt, map_len); |
221 | dt = early_memremap(initial_dtb, size); | 220 | initial_boot_params = dt = early_memremap(initial_dtb, size); |
222 | map_len = size; | 221 | map_len = size; |
223 | } | 222 | } |
224 | 223 | ||
225 | initial_boot_params = dt; | ||
226 | unflatten_and_copy_device_tree(); | 224 | unflatten_and_copy_device_tree(); |
227 | early_iounmap(dt, map_len); | 225 | early_iounmap(dt, map_len); |
228 | } | 226 | } |