fdt.c (04b954a673dd02f585a2769c4945a43880faa989) | fdt.c (4ef7b373df330bc0ff037dc4792d373c9346375f) |
---|---|
1/* 2 * Functions for working with the Flattened Device Tree data format 3 * 4 * Copyright 2009 Benjamin Herrenschmidt, IBM Corp 5 * benh@kernel.crashing.org 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * version 2 as published by the Free Software Foundation. 10 */ 11 12#include <linux/kernel.h> | 1/* 2 * Functions for working with the Flattened Device Tree data format 3 * 4 * Copyright 2009 Benjamin Herrenschmidt, IBM Corp 5 * benh@kernel.crashing.org 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * version 2 as published by the Free Software Foundation. 10 */ 11 12#include <linux/kernel.h> |
13#include <linux/lmb.h> | |
14#include <linux/initrd.h> 15#include <linux/of.h> 16#include <linux/of_fdt.h> | 13#include <linux/initrd.h> 14#include <linux/of.h> 15#include <linux/of_fdt.h> |
16#include <linux/string.h> 17#include <linux/errno.h> |
|
17 | 18 |
18 | |
19#ifdef CONFIG_PPC 20#include <asm/machdep.h> 21#endif /* CONFIG_PPC */ 22 | 19#ifdef CONFIG_PPC 20#include <asm/machdep.h> 21#endif /* CONFIG_PPC */ 22 |
23#include <asm/page.h> 24 |
|
23int __initdata dt_root_addr_cells; 24int __initdata dt_root_size_cells; 25 26struct boot_param_header *initial_boot_params; 27 28char *find_flat_dt_string(u32 offset) 29{ 30 return ((char *)initial_boot_params) + --- 524 unchanged lines hidden (view full) --- 555 start = ((unsigned long)initial_boot_params) + 556 be32_to_cpu(initial_boot_params->off_dt_struct); 557 size = unflatten_dt_node(0, &start, NULL, NULL, 0); 558 size = (size | 3) + 1; 559 560 pr_debug(" size is %lx, allocating...\n", size); 561 562 /* Allocate memory for the expanded device tree */ | 25int __initdata dt_root_addr_cells; 26int __initdata dt_root_size_cells; 27 28struct boot_param_header *initial_boot_params; 29 30char *find_flat_dt_string(u32 offset) 31{ 32 return ((char *)initial_boot_params) + --- 524 unchanged lines hidden (view full) --- 557 start = ((unsigned long)initial_boot_params) + 558 be32_to_cpu(initial_boot_params->off_dt_struct); 559 size = unflatten_dt_node(0, &start, NULL, NULL, 0); 560 size = (size | 3) + 1; 561 562 pr_debug(" size is %lx, allocating...\n", size); 563 564 /* Allocate memory for the expanded device tree */ |
563 mem = lmb_alloc(size + 4, __alignof__(struct device_node)); | 565 mem = early_init_dt_alloc_memory_arch(size + 4, 566 __alignof__(struct device_node)); |
564 mem = (unsigned long) __va(mem); 565 566 ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef); 567 568 pr_debug(" unflattening %lx...\n", mem); 569 570 /* Second pass, do actual unflattening */ 571 start = ((unsigned long)initial_boot_params) + --- 16 unchanged lines hidden --- | 567 mem = (unsigned long) __va(mem); 568 569 ((__be32 *)mem)[size / 4] = cpu_to_be32(0xdeadbeef); 570 571 pr_debug(" unflattening %lx...\n", mem); 572 573 /* Second pass, do actual unflattening */ 574 start = ((unsigned long)initial_boot_params) + --- 16 unchanged lines hidden --- |