[U-Boot] [PATCH V4] cmd_bdinfo: move implementation to arch instead of common

Joakim Tjernlund joakim.tjernlund at transmode.se
Thu Dec 4 14:36:58 CET 2008


On Thu, 2008-12-04 at 13:35 +0100, Jean-Christophe PLAGNIOL-VILLARD
wrote:
> introduce 3 new weak functions board_bdinfo, cpu_bdinfo and soc_bdinfo to allow
> board, cpu and soc to print more information
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj at jcrosoft.com>
> ---
> diff with V3
> rename cpu_bdinfo to soc_bdinfo for soc
> 
> Best Regards,
> J.

Since you are starting to use weak function I think you really need to fix the relocation procedure not to relocate
NULL values too. Othervise you risk running into hard to debug problems, possibly one should do the same
for __eabi_uconvert(). The function below could be written a bit cleaner though:

void __eabi_convert(unsigned long *low, unsigned long *high,
                    unsigned long addend)
{
        unsigned long len = high - low, val;

	for(--low; len; --len) {
		val = *++low;
		if (!val)
			continue;
                *low = val + addend;
	}
}

void __eabi_uconvert(unsigned long *low, unsigned long *high,
                     unsigned long addend)
{
        unsigned long len = high - low, val, *v2p;

	for(--low; len; --len) {
                val = *++low;
                val += addend;
                v2p = (unsigned long *)val;
                *low = val;
		*v2p += added;
	}
}

Pasting part of an earlier mail:

And you need to fix the relocation not to relocate NULL values, see
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/eabi.asm?rev=1.13&content-type=text/x-cvsweb-markup
look for __eabi_uconvert.

For fun I once tried to rewrite these functions i C, not tested though:

void __eabi_convert(unsigned long *low, unsigned long *high,
                    unsigned long addend)
{
        unsigned long len = high - low, val;
        if (!len)
                return;
        low--;
        do {
                val = *++low;
                if (!val)
                        continue;
                *low = val + addend;
        } while(--len);
}

void __eabi_uconvert(unsigned long *low, unsigned long *high,
                     unsigned long addend)
{
        unsigned long len = high - low, val, val2, *v2p;
        if (!len)
                return;
        low--;
        do {
                val = *++low;
                val += addend;
                v2p = (unsigned long *)val;
                *low = val;
                val2 = *v2p;
                val2 += addend;
                *v2p = val2;
        } while(--len);
}

void __eabi_uconvert_org(unsigned long *low, unsigned long *high,
                     unsigned long addend)
{
        unsigned long len = high - low, val, val2, *v2p;
        if (!len)
                return;
        low--;
        do {
                val = *++low;
                val += addend;
                v2p = (unsigned long *)val;
                val2 = *v2p;
                *low = val;
                val2 += addend;
                *v2p = val2;
        } while(--len);
}



More information about the U-Boot mailing list