[U-Boot] [PATCH 1/2] Removed CONFIG_NUM_CPUS for 85xx and 86xxFreescale processors.

Aggrwal Poonam-B10812 Poonam.Aggrwal at freescale.com
Wed Jul 22 12:14:45 CEST 2009


 


> 
> ...
> > +#ifndef CONFIG_MP
> > +	if (cpu_numcores() > 1)
> > +		puts("#############################################\n"
> > +			"The system is detected to be MULTICORE,\n"
> > +			"but u-boot is built with UNI-CORE\n"
> > +			"To enable mutlticore Build set CONFIG_MP\n"
> > +		     
> "#############################################\n\n");
> >  #endif
> 
> Please use terse error messages. We don't print prose here.
> 
> > -	cpu = identify_cpu(ver);
> > -	if (cpu) {
> > +	if (cpu_numcores() > 1) {
> > +		volatile ccsr_pic_t *pic = (void 
> *)(CONFIG_SYS_MPC85xx_PIC_ADDR);
> > +		printf("CPU%d:  ", pic->whoami);
> > +	}
> > +	else
> 
> Incorrect brace style.
> 
> > --- a/cpu/mpc85xx/speed.c
> > +++ b/cpu/mpc85xx/speed.c
> ...
> > @@ -51,7 +51,7 @@ void get_sys_info (sys_info_t * sysInfo)
> >  	/* Divide before multiply to avoid integer
> >  	 * overflow for processor speeds above 2GHz */
> >  	half_freqSystemBus = sysInfo->freqSystemBus/2;
> > -	for (i = 0; i < CONFIG_NUM_CPUS; i++) {
> > +	for (i = 0; i  < cpu_numcores(); i++) {
> 
> Only one space before the '<', please.
> 
> ...
> > --- a/cpu/mpc86xx/cpu.c
> > +++ b/cpu/mpc86xx/cpu.c
> ...
> > +int probecpu (void)
> > +{
> > +	uint svr;
> > +	uint ver;
> > +
> > +	svr = get_svr();
> > +	ver = SVR_SOC_VER(svr);
> > +
> > +	gd->cpu = identify_cpu(ver);
> > +
> > +	return 0;
> > +}
> > +
> > +int cpu_numcores() {
> > +	struct cpu_type *cpu;
> > +	cpu = gd->cpu;
> > +	return cpu->num_cores;
> > +}
> > +
> 
> This seems to be identically repeated code. Please factor out 
> into common code.
Actually the files cpu/mpc86xx/cpu.c cpu/mpc85xx/cpu.c are quite
identical.
Kumar, Please suggest how should this be taken care.
Probably a single file to take care of 85xx and 86xx don't know?
> 
> >   * Default board reset function
> >   */
> > @@ -66,9 +88,9 @@ checkcpu(void)
> >  	uint ver;
> >  	uint major, minor;
> >  	char buf1[32], buf2[32];
> > +	struct cpu_type *cpu;
> >  	volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
> >  	volatile ccsr_gur_t *gur = &immap->im_gur;
> > -	struct cpu_type *cpu;
> >  	uint msscr0 = mfspr(MSSCR0);
> >  
> >  	svr = get_svr();
> > @@ -76,10 +98,20 @@ checkcpu(void)
> >  	major = SVR_MAJ(svr);
> >  	minor = SVR_MIN(svr);
> >  
> > +#ifndef CONFIG_MP
> > +	if (cpu_numcores() > 1)
> > +		puts("#############################################\n"
> > +			"The system is detected to be MULTICORE,\n"
> > +			"but u-boot is built with UNI-CORE\n"
> > +			"To enable mutlticore Build set CONFIG_MP\n"
> > +		     
> "#############################################\n\n");
> > +#endif
> 
> Ditto.
> 
> >  	puts("CPU:   ");
> >  
> > -	cpu = identify_cpu(ver);
> > -	if (cpu) {
> > +	cpu = gd->cpu;
> > +
> > +	if (cpu->name) {
> >  		puts(cpu->name);
> >  	} else {
> 
> No braces for one-line statements, please.
> 
> > diff --git a/include/asm-ppc/config.h 
> b/include/asm-ppc/config.h index 
> > ca143c7..b799a22 100644
> > --- a/include/asm-ppc/config.h
> > +++ b/include/asm-ppc/config.h
> > @@ -37,4 +37,45 @@
> >  #endif
> >  #endif
> >  
> > +#if defined(CONFIG_MPC8533)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8535)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8536)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8540)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8541)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8543)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8544)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8545)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8547)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8548)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8555)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8560)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8567)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8568)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8569)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8572)
> > +#define CONFIG_MAX_CPUS	2
> > +#elif defined(CONFIG_P2020)
> > +#define CONFIG_MAX_CPUS	2
> > +
> > +#elif defined(CONFIG_MPC8610)
> > +#define CONFIG_MAX_CPUS	1
> > +#elif defined(CONFIG_MPC8641)
> > +#define CONFIG_MAX_CPUS	2
> > +#endif
> 
> Sorry, but this does not scale. Please find a better solution.
> 
> > diff --git a/include/asm-ppc/global_data.h 
> > b/include/asm-ppc/global_data.h index 244c161..aa531b9 100644
> > --- a/include/asm-ppc/global_data.h
> > +++ b/include/asm-ppc/global_data.h
> > @@ -1,4 +1,5 @@
> >  /*
> > + * Copyright (C) 2009 Freescale Semiconductor, Inc. All 
> rights reserved.
> 

> 
> Best regards,
> 
> Wolfgang Denk
> 
> -- 
> 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 You can only live once, but if you do it right, 
> once is enough.
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
> 


More information about the U-Boot mailing list