[PATCH 11/15] zImage wrapper for Ebony

David Gibson dwg at au1.ibm.com
Sat Mar 10 15:08:02 EST 2007


On Fri, Mar 09, 2007 at 11:50:11AM -0600, Josh Boyer wrote:
> 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.

Yes.  I just wasn't sure where, so left it there for now.

> > +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).

Yeah, I've been expecting to move those into a general use file,
something like that.  But I was going to wait until the second board
came along to see what's really common.  Oh, plus I'm not sure what to
do with the poke_tree() functions - they're not 44x specific at all,
but I'm wondering if they want cleaning up before being exported to
everybody.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson



More information about the Linuxppc-dev mailing list