]> git.sur5r.net Git - u-boot/commitdiff
ppc4xx: Add routine to retrieve CPU number
authorAdam Graham <agraham@amcc.com>
Wed, 8 Oct 2008 17:13:19 +0000 (10:13 -0700)
committerStefan Roese <sr@denx.de>
Tue, 21 Oct 2008 15:34:56 +0000 (17:34 +0200)
Provide a weak defined routine to retrieve the CPU number for
reference boards that have multiple CPU's.  Default behavior
is the existing single CPU print output.  Reference boards with
multiple CPU's need to provide a board specific routine.
See board/amcc/arches/arches.c for an example.

Signed-off-by: Adam Graham <agraham@amcc.com>
Signed-off-by: Victor Gallardo <vgallardo@amcc.com>
Signed-off-by: Stefan Roese <sr@denx.de>
cpu/ppc4xx/cpu.c
include/ppc4xx.h

index 66a77370c8f422016dab2a7c489691ef7985d41b..a676b30efe735bca9057916abfdf437d8a577397 100644 (file)
@@ -41,6 +41,18 @@ DECLARE_GLOBAL_DATA_PTR;
 
 void board_reset(void);
 
+/*
+ * To provide an interface to detect CPU number for boards that support
+ * more then one CPU, we implement the "weak" default functions here.
+ *
+ * Returns CPU number
+ */
+int __get_cpu_num(void)
+{
+       return NA_OR_UNKNOWN_CPU;
+}
+int get_cpu_num(void) __attribute__((weak, alias("__get_cpu_num")));
+
 #if defined(CONFIG_405GP) || \
     defined(CONFIG_440EP) || defined(CONFIG_440GR) || \
     defined(CONFIG_440EPX) || defined(CONFIG_440GRX)
@@ -274,8 +286,13 @@ int checkcpu (void)
 #if !defined(CONFIG_IOP480)
        char addstr[64] = "";
        sys_info_t sys_info;
+       int cpu_num;
 
-       puts ("CPU:   ");
+       cpu_num = get_cpu_num();
+       if (cpu_num >= 0)
+               printf("CPU%d:  ", cpu_num);
+       else
+               puts("CPU:   ");
 
        get_sys_info(&sys_info);
 
index ce4b29a1939fbb19c29a1909cc9046634e3bb23b..f1478854d116e30f9d69789b15da56dd1bb807d9 100644 (file)
@@ -218,4 +218,7 @@ static inline void set_mcsr(u32 val)
 
 #endif /* __ASSEMBLY__ */
 
+/* for multi-cpu support */
+#define NA_OR_UNKNOWN_CPU      -1
+
 #endif /* __PPC4XX_H__ */