[U-Boot-Users] bd_info vs. global_data

Wolfgang Denk wd at denx.de
Fri Nov 10 01:29:11 CET 2006


In message <4553B60D.3030901 at freescale.com> you wrote:
> 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():

Right. Historically, we started with bd_info, and gd was added  later
when  we needed to find a way to pass "global data" around in U-Boot.
This was mostly a code size optimization - before, we had to pass all
this stuff in long argument lists - if any low level function  needed
such data, we had to pass it though all callers.

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

Correct.

> 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 

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.

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

> 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?

Keep in mind that not all the world is a VAX ... oops, wrong  decade,
a PowerPC. You won't find OFT implementations on ARM, MIPS, NIOS, BF,
CF, ...

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Some people march to the beat of a different drummer. And some people
tango!




More information about the U-Boot mailing list