import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / arch / arm / kernel / devtree.c
index 5af04f6daa33804ac8a3d03b7765e7bae4a86106..f8414182a4d0db68c2d6d4700ff84e7bc2f804f2 100644 (file)
@@ -26,6 +26,8 @@
 #include <asm/mach/arch.h>
 #include <asm/mach-types.h>
 
+extern char default_command_line[COMMAND_LINE_SIZE];
+
 void __init early_init_dt_add_memory_arch(u64 base, u64 size)
 {
        arm_add_memory(base, size);
@@ -82,7 +84,7 @@ void __init arm_dt_init_cpu_maps(void)
        u32 i, j, cpuidx = 1;
        u32 mpidr = is_smp() ? read_cpuid_mpidr() & MPIDR_HWID_BITMASK : 0;
 
-       u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = UINT_MAX };
+       u32 tmp_map[NR_CPUS] = { [0 ... NR_CPUS-1] = MPIDR_INVALID };
        bool bootcpu_valid = false;
        cpus = of_find_node_by_path("/cpus");
 
@@ -92,6 +94,9 @@ void __init arm_dt_init_cpu_maps(void)
        for_each_child_of_node(cpus, cpu) {
                u32 hwid;
 
+               if (of_node_cmp(cpu->type, "cpu"))
+                       continue;
+
                pr_debug(" * %s...\n", cpu->full_name);
                /*
                 * A device tree containing CPU nodes with missing "reg"
@@ -149,9 +154,10 @@ void __init arm_dt_init_cpu_maps(void)
                tmp_map[i] = hwid;
        }
 
-       if (WARN(!bootcpu_valid, "DT missing boot CPU MPIDR[23:0], "
-                                "fall back to default cpu_logical_map\n"))
+       if (!bootcpu_valid) {
+               pr_warn("DT missing boot CPU MPIDR[23:0], fall back to default cpu_logical_map\n");
                return;
+       }
 
        /*
         * Since the boot CPU node contains proper data, and all nodes have
@@ -179,6 +185,7 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
        unsigned int score, mdesc_score = ~1;
        unsigned long dt_root;
        const char *model;
+       char *from = default_command_line;
 
 #ifdef CONFIG_ARCH_MULTIPLATFORM
        DT_MACHINE_START(GENERIC_DT, "Generic DT based system")
@@ -241,5 +248,10 @@ struct machine_desc * __init setup_machine_fdt(unsigned int dt_phys)
        /* Change machine number to match the mdesc we're using */
        __machine_arch_type = mdesc_best->nr;
 
+       if (mdesc_best->fixup) {
+        mdesc_best->fixup((void *)dt_root, &from, &meminfo);
+        strlcpy(boot_command_line, from, COMMAND_LINE_SIZE);
+    }
+
        return mdesc_best;
 }