powerpc: Free up some CPU feature bits by moving out MMU-related features
[pandora-kernel.git] / arch / powerpc / kernel / prom.c
index 05b7139..5f5e6ae 100644 (file)
@@ -123,18 +123,19 @@ static void __init move_device_tree(void)
  */
 static struct ibm_pa_feature {
        unsigned long   cpu_features;   /* CPU_FTR_xxx bit */
+       unsigned long   mmu_features;   /* MMU_FTR_xxx bit */
        unsigned int    cpu_user_ftrs;  /* PPC_FEATURE_xxx bit */
        unsigned char   pabyte;         /* byte number in ibm,pa-features */
        unsigned char   pabit;          /* bit number (big-endian) */
        unsigned char   invert;         /* if 1, pa bit set => clear feature */
 } ibm_pa_features[] __initdata = {
-       {0, PPC_FEATURE_HAS_MMU,        0, 0, 0},
-       {0, PPC_FEATURE_HAS_FPU,        0, 1, 0},
-       {CPU_FTR_SLB, 0,                0, 2, 0},
-       {CPU_FTR_CTRL, 0,               0, 3, 0},
-       {CPU_FTR_NOEXECUTE, 0,          0, 6, 0},
-       {CPU_FTR_NODSISRALIGN, 0,       1, 1, 1},
-       {CPU_FTR_CI_LARGE_PAGE, 0,      1, 2, 0},
+       {0, 0, PPC_FEATURE_HAS_MMU,     0, 0, 0},
+       {0, 0, PPC_FEATURE_HAS_FPU,     0, 1, 0},
+       {0, MMU_FTR_SLB, 0,             0, 2, 0},
+       {CPU_FTR_CTRL, 0, 0,            0, 3, 0},
+       {CPU_FTR_NOEXECUTE, 0, 0,       0, 6, 0},
+       {CPU_FTR_NODSISRALIGN, 0, 0,    1, 1, 1},
+       {0, MMU_FTR_CI_LARGE_PAGE, 0,   1, 2, 0},
        {CPU_FTR_REAL_LE, PPC_FEATURE_TRUE_LE, 5, 0, 0},
 };
 
@@ -166,9 +167,11 @@ static void __init scan_features(unsigned long node, unsigned char *ftrs,
                if (bit ^ fp->invert) {
                        cur_cpu_spec->cpu_features |= fp->cpu_features;
                        cur_cpu_spec->cpu_user_features |= fp->cpu_user_ftrs;
+                       cur_cpu_spec->mmu_features |= fp->mmu_features;
                } else {
                        cur_cpu_spec->cpu_features &= ~fp->cpu_features;
                        cur_cpu_spec->cpu_user_features &= ~fp->cpu_user_ftrs;
+                       cur_cpu_spec->mmu_features &= ~fp->mmu_features;
                }
        }
 }
@@ -268,13 +271,12 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
                                          const char *uname, int depth,
                                          void *data)
 {
-       static int logical_cpuid = 0;
        char *type = of_get_flat_dt_prop(node, "device_type", NULL);
        const u32 *prop;
        const u32 *intserv;
        int i, nthreads;
        unsigned long len;
-       int found = 0;
+       int found = -1;
 
        /* We are scanning "cpu" nodes only */
        if (type == NULL || strcmp(type, "cpu") != 0)
@@ -299,11 +301,8 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
                 * booted proc.
                 */
                if (initial_boot_params && initial_boot_params->version >= 2) {
-                       if (intserv[i] ==
-                                       initial_boot_params->boot_cpuid_phys) {
-                               found = 1;
-                               break;
-                       }
+                       if (intserv[i] == initial_boot_params->boot_cpuid_phys)
+                               found = boot_cpu_count;
                } else {
                        /*
                         * Check if it's the boot-cpu, set it's hw index now,
@@ -311,23 +310,20 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
                         * off secondary threads.
                         */
                        if (of_get_flat_dt_prop(node,
-                                       "linux,boot-cpu", NULL) != NULL) {
-                               found = 1;
-                               break;
-                       }
+                                       "linux,boot-cpu", NULL) != NULL)
+                               found = boot_cpu_count;
                }
-
 #ifdef CONFIG_SMP
                /* logical cpu id is always 0 on UP kernels */
-               logical_cpuid++;
+               boot_cpu_count++;
 #endif
        }
 
-       if (found) {
-               DBG("boot cpu: logical %d physical %d\n", logical_cpuid,
+       if (found >= 0) {
+               DBG("boot cpu: logical %d physical %d\n", found,
                        intserv[i]);
-               boot_cpuid = logical_cpuid;
-               set_hard_smp_processor_id(boot_cpuid, intserv[i]);
+               boot_cpuid = found;
+               set_hard_smp_processor_id(found, intserv[i]);
 
                /*
                 * PAPR defines "logical" PVR values for cpus that
@@ -683,7 +679,7 @@ void __init early_init_devtree(void *params)
 #endif
 
 #ifdef CONFIG_PHYP_DUMP
-       /* scan tree to see if dump occured during last boot */
+       /* scan tree to see if dump occurred during last boot */
        of_scan_flat_dt(early_init_dt_scan_phyp_dump, NULL);
 #endif
 
@@ -739,7 +735,7 @@ void __init early_init_devtree(void *params)
 
        DBG("Scanning CPUs ...\n");
 
-       /* Retreive CPU related informations from the flat tree
+       /* Retrieve CPU related informations from the flat tree
         * (altivec support, boot CPU ID, ...)
         */
        of_scan_flat_dt(early_init_dt_scan_cpus, NULL);