--- zzzz-none-000/linux-3.10.107/arch/mips/kernel/prom.c 2017-06-27 09:49:32.000000000 +0000 +++ scorpion-7490-727/linux-3.10.107/arch/mips/kernel/prom.c 2021-02-04 17:41:59.000000000 +0000 @@ -13,13 +13,12 @@ #include #include #include -#include #include #include #include -#include #include +#include #include #include @@ -30,7 +29,7 @@ if (name == NULL) return; - strncpy(mips_machine_name, name, sizeof(mips_machine_name)); + strlcpy(mips_machine_name, name, sizeof(mips_machine_name)); pr_info("MIPS: machine is %s\n", mips_get_machine_name()); } @@ -39,14 +38,7 @@ return mips_machine_name; } -#ifdef CONFIG_OF -int __init early_init_dt_scan_memory_arch(unsigned long node, - const char *uname, int depth, - void *data) -{ - return early_init_dt_scan_memory(node, uname, depth, data); -} - +#ifdef CONFIG_USE_OF void __init early_init_dt_add_memory_arch(u64 base, u64 size) { return add_memory_region(base, size, BOOT_MEM_RAM); @@ -57,58 +49,35 @@ return __alloc_bootmem(size, align, __pa(MAX_DMA_ADDRESS)); } -#ifdef CONFIG_BLK_DEV_INITRD -void __init early_init_dt_setup_initrd_arch(unsigned long start, - unsigned long end) -{ - initrd_start = (unsigned long)__va(start); - initrd_end = (unsigned long)__va(end); - initrd_below_start_ok = 1; -} -#endif - -int __init early_init_dt_scan_model(unsigned long node, const char *uname, - int depth, void *data) +void __init __dt_setup_arch(void *bph) { - if (!depth) { - char *model = of_get_flat_dt_prop(node, "model", NULL); - - if (model) - mips_set_machine_name(model); - } - return 0; -} + if (boot_command_line[0] == '\0') + strlcpy(boot_command_line, arcs_cmdline, + COMMAND_LINE_SIZE); -void __init early_init_devtree(void *params) -{ - /* Setup flat device-tree pointer */ - initial_boot_params = params; - - /* Retrieve various informations from the /chosen node of the - * device-tree, including the platform type, initrd location and - * size, and more ... - */ - of_scan_flat_dt(early_init_dt_scan_chosen, arcs_cmdline); - - - /* Scan memory nodes */ - of_scan_flat_dt(early_init_dt_scan_root, NULL); - of_scan_flat_dt(early_init_dt_scan_memory_arch, NULL); + if (!early_init_dt_scan(bph)) + return; - /* try to load the mips machine name */ - of_scan_flat_dt(early_init_dt_scan_model, NULL); + mips_set_machine_name(of_flat_dt_get_machine_name()); } -void __init __dt_setup_arch(struct boot_param_header *bph) +int __init __dt_register_buses(const char *bus0, const char *bus1) { - if (be32_to_cpu(bph->magic) != OF_DT_HEADER) { - pr_err("DTB has bad magic, ignoring builtin OF DTB\n"); + static struct of_device_id of_ids[3]; - return; + if (!of_have_populated_dt()) + panic("device tree not present"); + + strlcpy(of_ids[0].compatible, bus0, sizeof(of_ids[0].compatible)); + if (bus1) { + strlcpy(of_ids[1].compatible, bus1, + sizeof(of_ids[1].compatible)); } - initial_boot_params = bph; + if (of_platform_populate(NULL, of_ids, NULL, NULL)) + panic("failed to populate DT"); - early_init_devtree(initial_boot_params); + return 0; } + #endif