[U-Boot-Users] bd_info vs. global_data

Timur Tabi timur at freescale.com
Fri Nov 10 00:13:17 CET 2006


In looking at OF_TBCLK-related code, I noticed that U-Boot has what is 
basically two structures that contain a variety of "global" data, global_data 
and bd_info.  There are a number of fields in bd_info that also exist in 
global_data and contain the same value.  For instance, we have this in 
board_init_f():

	bd->bi_inpfreq   = gd->inp_clk;
	bd->bi_pcifreq   = gd->pci_clk;
	bd->bi_vcofreq   = gd->vco_clk;
	bd->bi_pevfreq   = gd->pev_clk;
	bd->bi_flbfreq   = gd->flb_clk;

 From my understanding, the bd_info structure is passed to the kernel as a 
binary blob, whereas the the global_data structure is used internally by 
U-Boot to store global data.  Obviously, we can't get rid of one or the other.

Wouldn't it be better if the bd_info structure were created and initialized 
only when Linux is about to be booted?  Currently, we have some code that uses 
bd->xxx and other code that uses gd->xxx, with no real consistence.  I think 
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?

-- 
Timur Tabi
Linux Kernel Developer @ Freescale




More information about the U-Boot mailing list