]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
powerpc/8xxx: Add is_core_disabled to remove disabled cores from dtb
authorKumar Gala <galak@kernel.crashing.org>
Thu, 10 Jun 2010 03:33:53 +0000 (22:33 -0500)
committerKumar Gala <galak@kernel.crashing.org>
Fri, 16 Jul 2010 15:55:08 +0000 (10:55 -0500)
If we explicitly disabled a core remove it from the dtb we pass on to
the kernel.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
arch/powerpc/cpu/mpc85xx/fdt.c
arch/powerpc/cpu/mpc85xx/mp.c
arch/powerpc/cpu/mpc86xx/fdt.c
arch/powerpc/cpu/mpc86xx/mp.c
arch/powerpc/cpu/mpc8xxx/fdt.c
arch/powerpc/include/asm/mp.h

index 1d11ab470f85c1141bfe743fe0985e7500cf0a79..2628cc5f95023e49b05163dcdb6c0ebc19082028 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2007-2009 Freescale Semiconductor, Inc.
+ * Copyright 2007-2010 Freescale Semiconductor, Inc.
  *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
@@ -404,8 +404,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
 
 #ifdef CONFIG_MP
        ft_fixup_cpu(blob, (u64)bd->bi_memstart + (u64)bd->bi_memsize);
-#endif
        ft_fixup_num_cores(blob);
+#endif
 
        ft_fixup_cache(blob);
 
index ddbc2211c3b8e1d37340367ffc0abb84fc316fd3..e05257cf04abd8bba157db911c950df2568e7a20 100644 (file)
@@ -77,6 +77,13 @@ int cpu_disable(int nr)
 
        return 0;
 }
+
+int is_core_disabled(int nr) {
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+       u32 coredisrl = in_be32(&gur->coredisrl);
+
+       return (coredisrl & (1 << nr));
+}
 #else
 int cpu_disable(int nr)
 {
@@ -96,6 +103,22 @@ int cpu_disable(int nr)
 
        return 0;
 }
+
+int is_core_disabled(int nr) {
+       ccsr_gur_t *gur = (void *)(CONFIG_SYS_MPC85xx_GUTS_ADDR);
+       u32 devdisr = in_be32(&gur->devdisr);
+
+       switch (nr) {
+       case 0:
+               return (devdisr & MPC85xx_DEVDISR_CPU0);
+       case 1:
+               return (devdisr & MPC85xx_DEVDISR_CPU1);
+       default:
+               printf("Invalid cpu number for disable %d\n", nr);
+       }
+
+       return 0;
+}
 #endif
 
 static u8 boot_entry_map[4] = {
index 51f3f4c2203ba6f1d18d3cbe917b76ac614d1aa7..ff89ee554c4125cef0f3012f363806429d6cb1c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008 Freescale Semiconductor, Inc.
+ * Copyright 2008,2010 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -55,6 +55,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
        off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
        if (off < 0)
                printf("%s: %s\n", __FUNCTION__, fdt_strerror(off));
-#endif
+
        ft_fixup_num_cores(blob);
+#endif
 }
index 24eb30aaaa68dd3b86376652d831202297862e7f..30c99ebc56ec04b43b4805a8cdb9bed860588917 100644 (file)
@@ -66,6 +66,23 @@ int cpu_disable(int nr)
        return 0;
 }
 
+int is_core_disabled(int nr) {
+       immap_t *immap = (immap_t *) CONFIG_SYS_CCSRBAR;
+       ccsr_gur_t *gur = &immap->im_gur;
+       u32 devdisr = in_be32(&gur->devdisr);
+
+       switch (nr) {
+       case 0:
+               return (devdisr & MPC86xx_DEVDISR_CPU0);
+       case 1:
+               return (devdisr & MPC86xx_DEVDISR_CPU1);
+       default:
+               printf("Invalid cpu number for disable %d\n", nr);
+       }
+
+       return 0;
+}
+
 int cpu_release(int nr, int argc, char * const argv[])
 {
        /* dummy function so common/cmd_mp.c will build
index c9956b639837456f09af004d3bcb23b4a1176d53..88c47d1aedef5bfe41a137067bd124df8d0e89d8 100644 (file)
@@ -26,8 +26,9 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <asm/mp.h>
 
-#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
+#if defined(CONFIG_MP) && (defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx))
 static int ft_del_cpuhandle(void *blob, int cpuhandle)
 {
        int off, ret = -FDT_ERR_NOTFOUND;
@@ -57,7 +58,7 @@ void ft_fixup_num_cores(void *blob) {
        while (off != -FDT_ERR_NOTFOUND) {
                u32 *reg = (u32 *)fdt_getprop(blob, off, "reg", 0);
 
-               if (*reg > num_cores-1) {
+               if ((*reg > num_cores-1) || (is_core_disabled(*reg))) {
                        int ph = fdt_get_phandle(blob, off);
 
                        /* Delete the cpu node once there are no cpu handles */
index 5388c951c84b70c67bf283b19a9c275ab340e0c3..3ffa30b9789410fe448dbd39656a87b297166a9c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2009 Freescale Semiconductor, Inc.
+ * Copyright 2009-2010 Freescale Semiconductor, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -26,5 +26,6 @@
 void setup_mp(void);
 void cpu_mp_lmb_reserve(struct lmb *lmb);
 u32 determine_mp_bootpg(void);
+int is_core_disabled(int nr);
 
 #endif