[U-Boot] [PATCH] 86xx: Cleanup MP support

Becky Bruce beckyb at kernel.crashing.org
Wed Apr 1 17:47:32 CEST 2009


On Mar 31, 2009, at 11:23 PM, Kumar Gala wrote:

> * Use CONFIG_MP instead of CONFIG_NUM_CPUS to match 85xx
> * Introduce determine_mp_bootpg() helper.  We'll need this to  
> address a
>  bug introduced in v2009.03 with 86xx MP booting.  We have to make  
> sure
>  to reserve the region of memory used for the MP bootpg() so other
>  u-boot code doesn't use it.

Excellent - thanks for doing this!

>
>
> Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
> ---
> board/freescale/mpc8641hpcn/mpc8641hpcn.c |    2 +-
> board/sbc8641d/sbc8641d.c                 |    2 +-
> cpu/mpc85xx/mp.h                          |    1 +
> cpu/mpc86xx/Makefile                      |    7 ++--
> cpu/mpc86xx/fdt.c                         |   12 ++-----
> cpu/mpc86xx/mp.c                          |   47 +++++++++++++++++ 
> +----------
> cpu/mpc86xx/mp.h                          |    1 +
> cpu/mpc86xx/release.S                     |    2 -
> include/configs/MPC8641HPCN.h             |    1 +
> include/configs/sbc8641d.h                |    1 +
> 10 files changed, 42 insertions(+), 34 deletions(-)
>
> diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/ 
> freescale/mpc8641hpcn/mpc8641hpcn.c
> index 1e35dfa..ef0095a 100644
> --- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
> +++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
> @@ -375,7 +375,7 @@ void board_reset(void)
> 		;
> }
>
> -#if (CONFIG_NUM_CPUS > 1)
> +#ifdef CONFIG_MP
> extern void cpu_mp_lmb_reserve(struct lmb *lmb);
>
> void board_lmb_reserve(struct lmb *lmb)
> diff --git a/board/sbc8641d/sbc8641d.c b/board/sbc8641d/sbc8641d.c
> index fc1f07d..9f69638 100644
> --- a/board/sbc8641d/sbc8641d.c
> +++ b/board/sbc8641d/sbc8641d.c
> @@ -414,7 +414,7 @@ void board_reset(void)
> #endif
> }
>
> -#if (CONFIG_NUM_CPUS > 1)
> +#ifdef CONFIG_MP
> extern void cpu_mp_lmb_reserve(struct lmb *lmb);
>
> void board_lmb_reserve(struct lmb *lmb)
> diff --git a/cpu/mpc85xx/mp.h b/cpu/mpc85xx/mp.h
> index 4329286..b06707f 100644
> --- a/cpu/mpc85xx/mp.h
> +++ b/cpu/mpc85xx/mp.h
> @@ -5,6 +5,7 @@ ulong get_spin_addr(void);
> void setup_mp(void);
> u32 get_my_id(void);
> void cpu_mp_lmb_reserve(struct lmb *lmb);
> +u32 determine_bootpg(void);

This hunk is bogus - it's wrong, and doesn't belong in this patch,  
anyway.

>
>
> #define BOOT_ENTRY_ADDR_UPPER	0
> #define BOOT_ENTRY_ADDR_LOWER	1
> diff --git a/cpu/mpc86xx/Makefile b/cpu/mpc86xx/Makefile
> index 34a9755..f1af64e 100644
> --- a/cpu/mpc86xx/Makefile
> +++ b/cpu/mpc86xx/Makefile
> @@ -31,10 +31,9 @@ LIB	= $(obj)lib$(CPU).a
> START	= start.o
> SOBJS	= cache.o
>
> -ifneq ($(CONFIG_NUM_CPUS),1)
> -COBJS-y += mp.o
> -SOBJS += release.o
> -endif
> +SOBJS-$(CONFIG_MP) += release.o
> +SOBJS	+= $(SOBJS-y)
> +COBJS-$(CONFIG_MP) += mp.o
> COBJS-y	+= traps.o
> COBJS-y	+= cpu.o
> COBJS-y	+= cpu_init.o
> diff --git a/cpu/mpc86xx/fdt.c b/cpu/mpc86xx/fdt.c
> index 383b06b..ee2eb0b 100644
> --- a/cpu/mpc86xx/fdt.c
> +++ b/cpu/mpc86xx/fdt.c
> @@ -15,9 +15,9 @@ DECLARE_GLOBAL_DATA_PTR;
>
> void ft_cpu_setup(void *blob, bd_t *bd)
> {
> -#if (CONFIG_NUM_CPUS > 1)
> +#ifdef CONFIG_MP
> 	int off;
> -	u32 bootpg;
> +	u32 bootpg = determine_mp_bootpg();
> #endif
>
> 	do_fixup_by_prop_u32(blob, "device_type", "cpu", 4,
> @@ -48,13 +48,7 @@ void ft_cpu_setup(void *blob, bd_t *bd)
> 			       "clock-frequency", CONFIG_SYS_NS16550_CLK, 1);
> #endif
>
> -#if (CONFIG_NUM_CPUS > 1)
> -	/* if we have 4G or more of memory, put the boot page at 4Gb-1M */
> -	if (gd->ram_size > 0xfffff000)
> -		bootpg = 0xfff00000;
> -	else
> -		bootpg = gd->ram_size - (1024 * 1024);
> -
> +#ifdef CONFIG_MP
> 	/* Reserve the boot page so OSes dont use it */
> 	off = fdt_add_mem_rsv(blob, bootpg, (u64)4096);
> 	if (off < 0)
> diff --git a/cpu/mpc86xx/mp.c b/cpu/mpc86xx/mp.c
> index 5014401..b4c6b79 100644
> --- a/cpu/mpc86xx/mp.c
> +++ b/cpu/mpc86xx/mp.c
> @@ -8,16 +8,39 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -#if (CONFIG_NUM_CPUS > 1)
> -void cpu_mp_lmb_reserve(struct lmb *lmb)
> +int cpu_reset(int nr)
> +{
> +	volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
> +	volatile ccsr_pic_t *pic = &immr->im_pic;
> +	out_be32(&pic->pir, 1 << nr);
> +	(void)in_be32(&pic->pir);
> +	out_be32(&pic->pir, 0x0);
> +
> +	return 0;
> +}
> +
> +int cpu_status(int nr)
> +{
> +	return 1;
> +}
> +
> +int cpu_release(int nr, int argc, char *argv[])
> {
> -	u32 bootpg;
> +	return 1;
> +}

Should probably add comments as to why these do nothing right now....

>
>
> +u32 determine_mp_bootpg(void)
> +{
> 	/* if we have 4G or more of memory, put the boot page at 4Gb-1M */
> 	if ((u64)gd->ram_size > 0xfffff000)
> -		bootpg = 0xfff00000;
> -	else
> -		bootpg = gd->ram_size - (1024 * 1024);
> +		return (0xfff00000);
> +
> +	return (gd->ram_size - (1024 * 1024));

Seems like we might want to define a BOOTPG_ALIGN somewhere, even if  
it's just at the top of this file for the moment.  At some point(later  
is fine) we need to talk about creating a common spot for code like  
this, because once there's  BOOTPG_ALIGN defined, this code could be  
common between 85xx/86xx. (There's other code in this file that could  
likely be made common between platforms.... so I consider that a  
future item, not something that should affect the acceptance of this  
patch).

<snip>

Cheers,
B



More information about the U-Boot mailing list