[U-Boot] [PATCH] ppc/8xxx: Add is_core_disabled to remove disabled cores from dtb
Kumar Gala
galak at kernel.crashing.org
Thu Jun 10 05:34:54 CEST 2010
If we explicitly disabled a core remove it from the dtb we pass on to
the kernel.
Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
arch/powerpc/cpu/mpc85xx/mp.c | 25 +++++++++++++++++++++++++
arch/powerpc/cpu/mpc86xx/mp.c | 19 +++++++++++++++++++
arch/powerpc/cpu/mpc8xxx/fdt.c | 3 ++-
arch/powerpc/include/asm/mp.h | 3 ++-
4 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c
index 826bf32..0d39f3b 100644
--- a/arch/powerpc/cpu/mpc85xx/mp.c
+++ b/arch/powerpc/cpu/mpc85xx/mp.c
@@ -77,6 +77,13 @@ int cpu_disable(int nr)
return 0;
}
+
+int is_core_disabled(int nr) {
+ volatile 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,24 @@ int cpu_disable(int nr)
return 0;
}
+
+int is_core_disabled(int nr) {
+ volatile 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);
+ break;
+ case 1:
+ return (devdisr & MPC85xx_DEVDISR_CPU1);
+ break;
+ default:
+ printf("Invalid cpu number for disable %d\n", nr);
+ }
+
+ return 0;
+}
#endif
static u8 boot_entry_map[4] = {
diff --git a/arch/powerpc/cpu/mpc86xx/mp.c b/arch/powerpc/cpu/mpc86xx/mp.c
index b4a0faa..97e4692 100644
--- a/arch/powerpc/cpu/mpc86xx/mp.c
+++ b/arch/powerpc/cpu/mpc86xx/mp.c
@@ -66,6 +66,25 @@ int cpu_disable(int nr)
return 0;
}
+int is_core_disabled(int nr) {
+ volatile immap_t *immap = (immap_t *) CONFIG_SYS_CCSRBAR;
+ volatile ccsr_gur_t *gur = &immap->im_gur;
+ u32 devdisr = in_be32(&gur->devdisr);
+
+ switch (nr) {
+ case 0:
+ return (devdisr & MPC86xx_DEVDISR_CPU0);
+ break;
+ case 1:
+ return (devdisr & MPC86xx_DEVDISR_CPU1);
+ break;
+ default:
+ printf("Invalid cpu number for disable %d\n", nr);
+ }
+
+ return 0;
+}
+
int cpu_release(int nr, int argc, char *argv[])
{
/* dummy function so common/cmd_mp.c will build
diff --git a/arch/powerpc/cpu/mpc8xxx/fdt.c b/arch/powerpc/cpu/mpc8xxx/fdt.c
index c9956b6..02bdb70 100644
--- a/arch/powerpc/cpu/mpc8xxx/fdt.c
+++ b/arch/powerpc/cpu/mpc8xxx/fdt.c
@@ -26,6 +26,7 @@
#include <common.h>
#include <libfdt.h>
#include <fdt_support.h>
+#include <asm/mp.h>
#if defined(CONFIG_MPC85xx) || defined(CONFIG_MPC86xx)
static int ft_del_cpuhandle(void *blob, int cpuhandle)
@@ -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 */
diff --git a/arch/powerpc/include/asm/mp.h b/arch/powerpc/include/asm/mp.h
index 5388c95..3ffa30b 100644
--- a/arch/powerpc/include/asm/mp.h
+++ b/arch/powerpc/include/asm/mp.h
@@ -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
--
1.6.0.6
More information about the U-Boot
mailing list