These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / arch / powerpc / kernel / prom.c
index 308c5e1..7030b03 100644 (file)
@@ -46,7 +46,6 @@
 #include <asm/mmu.h>
 #include <asm/paca.h>
 #include <asm/pgtable.h>
-#include <asm/pci.h>
 #include <asm/iommu.h>
 #include <asm/btext.h>
 #include <asm/sections.h>
@@ -219,22 +218,18 @@ static void __init check_cpu_pa_features(unsigned long node)
 }
 
 #ifdef CONFIG_PPC_STD_MMU_64
-static void __init check_cpu_slb_size(unsigned long node)
+static void __init init_mmu_slb_size(unsigned long node)
 {
        const __be32 *slb_size_ptr;
 
-       slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL);
-       if (slb_size_ptr != NULL) {
-               mmu_slb_size = be32_to_cpup(slb_size_ptr);
-               return;
-       }
-       slb_size_ptr = of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
-       if (slb_size_ptr != NULL) {
+       slb_size_ptr = of_get_flat_dt_prop(node, "slb-size", NULL) ? :
+                       of_get_flat_dt_prop(node, "ibm,slb-size", NULL);
+
+       if (slb_size_ptr)
                mmu_slb_size = be32_to_cpup(slb_size_ptr);
-       }
 }
 #else
-#define check_cpu_slb_size(node) do { } while(0)
+#define init_mmu_slb_size(node) do { } while(0)
 #endif
 
 static struct feature_property {
@@ -381,7 +376,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
 
        check_cpu_feature_properties(node);
        check_cpu_pa_features(node);
-       check_cpu_slb_size(node);
+       init_mmu_slb_size(node);
 
 #ifdef CONFIG_PPC64
        if (nthreads > 1)
@@ -477,9 +472,10 @@ static int __init early_init_dt_scan_drconf_memory(unsigned long node)
                flags = of_read_number(&dm[3], 1);
                /* skip DRC index, pad, assoc. list index, flags */
                dm += 4;
-               /* skip this block if the reserved bit is set in flags (0x80)
-                  or if the block is not assigned to this partition (0x8) */
-               if ((flags & 0x80) || !(flags & 0x8))
+               /* skip this block if the reserved bit is set in flags
+                  or if the block is not assigned to this partition */
+               if ((flags & DRCONF_MEM_RESERVED) ||
+                               !(flags & DRCONF_MEM_ASSIGNED))
                        continue;
                size = memblock_size;
                rngs = 1;
@@ -573,6 +569,7 @@ static void __init early_reserve_mem_dt(void)
        int len;
        const __be32 *prop;
 
+       early_init_fdt_reserve_self();
        early_init_fdt_scan_reserved_mem();
 
        dt_root = of_get_flat_dt_root();
@@ -786,20 +783,23 @@ void __init early_get_first_memblock_info(void *params, phys_addr_t *size)
 int of_get_ibm_chip_id(struct device_node *np)
 {
        of_node_get(np);
-       while(np) {
-               struct device_node *old = np;
-               const __be32 *prop;
+       while (np) {
+               u32 chip_id;
 
-               prop = of_get_property(np, "ibm,chip-id", NULL);
-               if (prop) {
+               /*
+                * Skiboot may produce memory nodes that contain more than one
+                * cell in chip-id, we only read the first one here.
+                */
+               if (!of_property_read_u32(np, "ibm,chip-id", &chip_id)) {
                        of_node_put(np);
-                       return be32_to_cpup(prop);
+                       return chip_id;
                }
-               np = of_get_parent(np);
-               of_node_put(old);
+
+               np = of_get_next_parent(np);
        }
        return -1;
 }
+EXPORT_SYMBOL(of_get_ibm_chip_id);
 
 /**
  * cpu_to_chip_id - Return the cpus chip-id