powerpc/64: Move 64-bit probe_machine() to later in the boot process
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Tue, 5 Jul 2016 05:04:00 +0000 (15:04 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 21 Jul 2016 08:59:22 +0000 (18:59 +1000)
We no long need the machine type that early, so we can move probe_machine()
to after the device-tree has been expanded. This will allow further
consolidation.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/setup_64.c
arch/powerpc/platforms/cell/setup.c
arch/powerpc/platforms/maple/setup.c
arch/powerpc/platforms/pasemi/setup.c
arch/powerpc/platforms/powermac/setup.c
arch/powerpc/platforms/powernv/setup.c
arch/powerpc/platforms/ps3/setup.c
arch/powerpc/platforms/pseries/setup.c

index 4ffd090633de6f2731229a7afb82bd8e14c8d65e..883d527899a756a6e701f863f718180b2f15f883 100644 (file)
@@ -301,9 +301,6 @@ void __init early_setup(unsigned long dt_ptr)
        setup_paca(&paca[boot_cpuid]);
        fixup_boot_paca();
 
-       /* Probe the machine type */
-       probe_machine();
-
        /*
         * Configure exception handlers. This include setting up trampolines
         * if needed, setting exception endian mode, etc...
@@ -511,6 +508,9 @@ void __init setup_system(void)
         */
        check_for_initrd();
 
+       /* Probe the machine type */
+       probe_machine();
+
        /*
         * Do some platform specific early initializations, that includes
         * setting up the hash table pointers. It also sets up some interrupt-mapping
index e342f7833db5bca267d8636a112535d7916f90cb..d3543e68efe80afde410f40665bb17af61a4e5f7 100644 (file)
@@ -255,10 +255,8 @@ static void __init cell_setup_arch(void)
 
 static int __init cell_probe(void)
 {
-       unsigned long root = of_get_flat_dt_root();
-
-       if (!of_flat_dt_is_compatible(root, "IBM,CBEA") &&
-           !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
+       if (!of_machine_is_compatible("IBM,CBEA") &&
+           !of_machine_is_compatible("IBM,CPBW-1.0"))
                return 0;
 
        pm_power_off = rtas_power_off;
index b1ecd991a0fbefc4f7947e13f27ff3603f998bdc..d3d44cba661b48d007c307a8fbb897a127e9a009 100644 (file)
@@ -300,10 +300,8 @@ static void __init maple_progress(char *s, unsigned short hex)
  */
 static int __init maple_probe(void)
 {
-       unsigned long root = of_get_flat_dt_root();
-
-       if (!of_flat_dt_is_compatible(root, "Momentum,Maple") &&
-           !of_flat_dt_is_compatible(root, "Momentum,Apache"))
+       if (!of_machine_is_compatible("Momentum,Maple") &&
+           !of_machine_is_compatible("Momentum,Apache"))
                return 0;
 
        pm_power_off = maple_power_off;
index d120f7a9e4ad267e8e7634916c992332a92317d7..ec810ddb10ee9e352767baabae0df6e8bf490877 100644 (file)
@@ -420,10 +420,8 @@ machine_device_initcall(pasemi, pasemi_publish_devices);
  */
 static int __init pas_probe(void)
 {
-       unsigned long root = of_get_flat_dt_root();
-
-       if (!of_flat_dt_is_compatible(root, "PA6T-1682M") &&
-           !of_flat_dt_is_compatible(root, "pasemi,pwrficient"))
+       if (!of_machine_is_compatible("PA6T-1682M") &&
+           !of_machine_is_compatible("pasemi,pwrficient"))
                return 0;
 
        return 1;
index 8fffe1c4b6f50847290d32e10452f99112732ffd..0872f9837cf5fa8dd65d4e4572eee12ace18aafc 100644 (file)
@@ -590,11 +590,17 @@ console_initcall(check_pmac_serial_console);
  */
 static int __init pmac_probe(void)
 {
+#ifdef CONFIG_PPC32
        unsigned long root = of_get_flat_dt_root();
 
        if (!of_flat_dt_is_compatible(root, "Power Macintosh") &&
            !of_flat_dt_is_compatible(root, "MacRISC"))
                return 0;
+#else
+       if (!of_machine_is_compatible("Power Macintosh") &&
+           !of_machine_is_compatible("MacRISC"))
+               return 0;
+#endif
 
 #ifdef CONFIG_PPC32
        /* isa_io_base gets set in pmac_pci_init */
index f70ea83502b26d0e74764edb7dea5f25f93bf896..8865efa54e51d55c247bd98dd983d3c540f1e8df 100644 (file)
@@ -268,9 +268,7 @@ static void __init pnv_setup_machdep_opal(void)
 
 static int __init pnv_probe(void)
 {
-       unsigned long root = of_get_flat_dt_root();
-
-       if (!of_flat_dt_is_compatible(root, "ibm,powernv"))
+       if (!of_machine_is_compatible("ibm,powernv"))
                return 0;
 
        if (firmware_has_feature(FW_FEATURE_OPAL))
index b7fdf88474e83e21cbb09905d2c760c149951e89..3a487e7f4a5e73e049a91780bdde0c38ed3de9ac 100644 (file)
@@ -237,15 +237,13 @@ void __init ps3_early_mm_init(void)
 
 static int __init ps3_probe(void)
 {
-       unsigned long dt_root;
-
        DBG(" -> %s:%d\n", __func__, __LINE__);
 
-       dt_root = of_get_flat_dt_root();
-       if (!of_flat_dt_is_compatible(dt_root, "sony,ps3"))
+       if (!of_machine_is_compatible("sony,ps3"))
                return 0;
 
        ps3_os_area_save_params();
+
        pm_power_off = ps3_power_off;
 
        DBG(" <- %s:%d\n", __func__, __LINE__);
index 240721348ebc8bf567521d6b18bbc5dacf81dcc1..6988b9dc3d3b3914357e7eb5f0182b7e9e04bc43 100644 (file)
@@ -672,8 +672,7 @@ static void pseries_power_off(void)
 
 static int __init pSeries_probe(void)
 {
-       unsigned long root = of_get_flat_dt_root();
-       const char *dtype = of_get_flat_dt_prop(root, "device_type", NULL);
+       const char *dtype = of_get_property(of_root, "device_type", NULL);
 
        if (dtype == NULL)
                return 0;
@@ -683,8 +682,8 @@ static int __init pSeries_probe(void)
        /* Cell blades firmware claims to be chrp while it's not. Until this
         * is fixed, we need to avoid those here.
         */
-       if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0") ||
-           of_flat_dt_is_compatible(root, "IBM,CBEA"))
+       if (of_machine_is_compatible("IBM,CPBW-1.0") ||
+           of_machine_is_compatible("IBM,CBEA"))
                return 0;
 
        pm_power_off = pseries_power_off;