[PATCH 11/15] zImage wrapper for Ebony

Josh Boyer jwboyer at linux.vnet.ibm.com
Sat Mar 10 04:50:11 EST 2007


On Mon, 2007-03-05 at 14:24 +1100, David Gibson wrote:
> Index: working-2.6/arch/powerpc/boot/ebony.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ working-2.6/arch/powerpc/boot/ebony.c	2007-02-26 13:46:05.000000000 +1100

> +
> +static inline u32 mfpvr(void)
> +{
> +	u32 pvr;
> +	asm volatile ("mfpvr	%0" : "=r"(pvr));
> +	return pvr;
> +}

This could probably go in a generic util.h file.

> +
> +void poke_tree(const char *path, const char *name, void *val, int size)
> +{
> +	void *devp;
> +	int ret;
> +
> +	devp = finddevice(path);
> +	if (! devp) {
> +		printf("Couldn't find node %s to poke\n\r", path);
> +		exit();
> +	}
> +
> +	ret = setprop(devp, name, val, size);
> +	if (ret != 0) {
> +		printf("Couldn't set %s property in %s\n\r", name, path);
> +		exit();
> +	}
> +}
> +
> +#define poke_tree_val(path, name, val)	\
> +	do { \
> +		typeof(val) x = val; \
> +		poke_tree((path),(name),&x,sizeof(x)); \
> +	} while (0)
> +
> +/* Read the 44x memory controller to get size of system memory. */
> +static void ibm44x_fixup_memsize(void)
> +{
> +	int i;
> +	unsigned long memsize, bank_config;
> +	u32 memreg[3];
> +
> +	memsize = 0;
> +	for (i = 0; i < ARRAY_SIZE(sdram_bxcr); i++) {
> +		mtdcr(DCRN_SDRAM0_CFGADDR, sdram_bxcr[i]);
> +		bank_config = mfdcr(DCRN_SDRAM0_CFGDATA);
> +
> +		if (bank_config & SDRAM_CONFIG_BANK_ENABLE)
> +			memsize += SDRAM_CONFIG_BANK_SIZE(bank_config);
> +	}
> +
> +	printf("PPC44X: %dM RAM\n\r", memsize / 1024 / 1024);
> +	memreg[0] = memreg[1] = 0;
> +	memreg[2] = memsize;
> +	poke_tree("/memory", "reg", memreg, sizeof(memreg));
> +}

Is it possible to pull these three out into a 4xx_misc.c file?  The
exact same memory fixup can be used on boards other than Ebony (Bamboo
for example).

josh




More information about the Linuxppc-dev mailing list