ppc4xx: Add routine to retrieve CPU number
PATCH v2 3/3 ppc4xx: Add routine to retrieve CPU number
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.
---
v2:
- Correct return code of the generic get_cpu_num routine and make the return code a defined value.
cpu/ppc4xx/cpu.c | 19 ++++++++++++++++++- include/ppc4xx.h | 3 +++ 2 files changed, 21 insertions(+), 1 deletions(-)
cpu/ppc4xx/cpu.c +18 -1
@@ -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);
include/ppc4xx.h +3 -0
@@ -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__ */
Signature · 1 line
1.5.5
PATCH v2 3/3 ppc4xx: Add routine to retrieve CPU number
Dear Adam Graham,
Quoted 1 line · In message <[email protected]> you wrote:
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.cfor an example.
Line too long.
Quoted 3 lines
cpu/ppc4xx/cpu.c +3
-0+int __get_cpu_num (void ) +{ +return __NA_OR_UNKNOWN_CPU;
...
include/ppc4xx.h static inline void set_mcsr(u32 val) · line 222
Quoted 8 lines
include/ppc4xx.h +2
-0@@ -218,4 +218,7 @@ static inline void set_mcsr(u32 val)#endif /* __ASSEMBLY__ */ +/* for multi-cpu support */ +#define __NA_OR_UNKNOWN_CPU -1
Please don't use identifiers starting with underscores. These have a special meaning in C.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Der Horizont vieler Menschen ist ein Kreis mit Radius Null -- und das nennen sie ihren Standpunkt.