提交 d5189cc5 编写于 作者: R Rob Herring

arm64: use early_init_dt_scan

Convert arm64 to use new early_init_dt_scan function.
Signed-off-by: NRob Herring <rob.herring@calxeda.com>
Acked-by: NCatalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
上级 56dc1f47
...@@ -124,37 +124,19 @@ static void __init setup_processor(void) ...@@ -124,37 +124,19 @@ static void __init setup_processor(void)
static void __init setup_machine_fdt(phys_addr_t dt_phys) static void __init setup_machine_fdt(phys_addr_t dt_phys)
{ {
struct boot_param_header *devtree;
unsigned long dt_root; unsigned long dt_root;
/* Check we have a non-NULL DT pointer */ if (!dt_phys || !early_init_dt_scan(phys_to_virt(dt_phys))) {
if (!dt_phys) {
early_print("\n"
"Error: NULL or invalid device tree blob\n"
"The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
"\nPlease check your bootloader.\n");
while (true)
cpu_relax();
}
devtree = phys_to_virt(dt_phys);
/* Check device tree validity */
if (be32_to_cpu(devtree->magic) != OF_DT_HEADER) {
early_print("\n" early_print("\n"
"Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n" "Error: invalid device tree blob at physical address 0x%p (virtual address 0x%p)\n"
"Expected 0x%x, found 0x%x\n" "The dtb must be 8-byte aligned and passed in the first 512MB of memory\n"
"\nPlease check your bootloader.\n", "\nPlease check your bootloader.\n",
dt_phys, devtree, OF_DT_HEADER, dt_phys, phys_to_virt(dt_phys));
be32_to_cpu(devtree->magic));
while (true) while (true)
cpu_relax(); cpu_relax();
} }
initial_boot_params = devtree;
dt_root = of_get_flat_dt_root(); dt_root = of_get_flat_dt_root();
machine_name = of_get_flat_dt_prop(dt_root, "model", NULL); machine_name = of_get_flat_dt_prop(dt_root, "model", NULL);
...@@ -163,13 +145,6 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) ...@@ -163,13 +145,6 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys)
if (!machine_name) if (!machine_name)
machine_name = "<unknown>"; machine_name = "<unknown>";
pr_info("Machine: %s\n", machine_name); pr_info("Machine: %s\n", machine_name);
/* Retrieve various information from the /chosen node */
of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line);
/* Initialize {size,address}-cells info */
of_scan_flat_dt(early_init_dt_scan_root, NULL);
/* Setup memory, calling early_init_dt_add_memory_arch */
of_scan_flat_dt(early_init_dt_scan_memory, NULL);
} }
void __init early_init_dt_add_memory_arch(u64 base, u64 size) void __init early_init_dt_add_memory_arch(u64 base, u64 size)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册