Skip to content

Commit 1bac186

Browse files
committed
x86: use FDT accessors for FDT blob header data
Remove the direct accesses to FDT header data using accessor function instead. This makes the code more readable and makes the FDT blob structure more opaque to the arch code. This also prepares for removing struct boot_param_header completely. 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] Tested-by: Grant Likely <[email protected]>
1 parent 060f78c commit 1bac186

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

arch/x86/kernel/devicetree.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,23 +206,21 @@ static void __init dtb_apic_setup(void)
206206
static void __init x86_flattree_get_config(void)
207207
{
208208
u32 size, map_len;
209-
struct boot_param_header *dt;
209+
void *dt;
210210

211211
if (!initial_dtb)
212212
return;
213213

214-
map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK),
215-
(u64)sizeof(struct boot_param_header));
214+
map_len = max(PAGE_SIZE - (initial_dtb & ~PAGE_MASK), (u64)128);
216215

217-
dt = early_memremap(initial_dtb, map_len);
218-
size = be32_to_cpu(dt->totalsize);
216+
initial_boot_params = dt = early_memremap(initial_dtb, map_len);
217+
size = of_get_flat_dt_size();
219218
if (map_len < size) {
220219
early_iounmap(dt, map_len);
221-
dt = early_memremap(initial_dtb, size);
220+
initial_boot_params = dt = early_memremap(initial_dtb, size);
222221
map_len = size;
223222
}
224223

225-
initial_boot_params = dt;
226224
unflatten_and_copy_device_tree();
227225
early_iounmap(dt, map_len);
228226
}

0 commit comments

Comments
 (0)