[U-Boot-Users] bd_info vs. global_data

Timur Tabi timur at freescale.com
Fri Nov 10 03:15:32 CET 2006

Wolfgang Denk wrote:
> Yes, but IIRC also contains information that is noit available in gd,
> and I don't want to extend gd if it can be avoided, a this  is  taken
> from very scarce resources.

Is the bd located immediately after the gd in memory?

>> bd->xxx and other code that uses gd->xxx, with no real consistence.  I think 
> Actually, in most cases it makes some sense if you think longer about
> it. But I agree, it's not nice.

How about a rule that any function can write to bd_info (to initialize its 
contents), but only the do_bootm_xxx functions can read from it, and only to 
prepare it for passing to Linux.  This would eliminate code like this:

#define OF_TBCLK		(bd->bi_busfreq / 4)

and hopefully stuff like this:

	if ((s = getenv ("clocks_in_mhz")) != NULL) {
		/* convert all clock information to MHz */
		kbd->bi_intfreq /= 1000000L;
		kbd->bi_busfreq /= 1000000L;
#if defined(CONFIG_MPC8220)
	kbd->bi_inpfreq /= 1000000L;
	kbd->bi_pcifreq /= 1000000L;
	kbd->bi_pevfreq /= 1000000L;
	kbd->bi_flbfreq /= 1000000L;
	kbd->bi_vcofreq /= 1000000L;
#if defined(CONFIG_CPM2)
		kbd->bi_cpmfreq /= 1000000L;
		kbd->bi_brgfreq /= 1000000L;
		kbd->bi_sccfreq /= 1000000L;
		kbd->bi_vco     /= 1000000L;

In this case, I don't understand the clocks_in_mhz environment variable.  Is 
this something that we really want to be run-time configurable?

>> the bd_info structure should be local to cmd_bootm.c, and should be allocated 
>> and initialized only if we're booting a non-OF version of Linux.  This would 
>> eliminate using bd-> for anything other than booting non-OF Linux.
>> Comments?
> Did you try to implement this?

No, it's just something that occurred to me today while trying to resolve the 
OF_TBCLK problem.

Timur Tabi
Linux Kernel Developer @ Freescale

More information about the U-Boot mailing list