[U-Boot] passing info from SPL to U-Boot

Wolfgang Denk wd at denx.de
Fri Mar 15 09:34:08 UTC 2019


Dear Simon,

In message <CAPnjgZ14Sq=OWRbM6hpqO2CLP=1eg=ftQw_1Bqu0DNe+6OxTkQ at mail.gmail.com> you wrote:
>
> I think it is a reasonable idea to allow the gd region to pass from
> TPL -> SPL -> U-Boot. But we'll need to remove use of
> CONFIG_IS_ENABLED(), or put shared things at the beginning of the
> structure.

Indeed. And/or split things up in "common" stuff and optional /
config dependent things.

> We need the concept of 'am I the first thing to run'. This is
> implemented in bloblist as u_boot_first_phase() - see spl.h. If this
> is true, we must set up the data structure. If false we must find one
> set up by a previous phase and use it. Bloblist handles this, but
> perhaps gd could as well?

I wonder why we need 4 different ways of doing basically the same
thing.

First, we have GD, which exists since the dawn of U-Boot, which was
intended to pass data between boot stages (by then, before and after
relocation), but apparently it has never been used for passing
information between SPL and U-Boot proper.

Then you added the bloblist thingy.  It's not really clear what it's
intentions are - I see the commits, but I can't find what you want
to use it for or what design you have in mind.  It's too complicated
for passing just a few data, but apparently you find it necessary to
make it secure enough that you add version, magic and checksum
(which makes it necessary to have CRC32 in SPL...).  Also, I wonder
how the search mechanism effects boot time...

An then there is commit b0edea3c27 with the spl_handoff thing.  I
can't decide whether this is intended as a general feature or a
separate, SPL specific mechanism.  And more questions - if we pass
the handoff pointer in GD, why all the effort - why don't we just
make sure GD is passed properly?  The fact that there is no use case
at all in mainline U-Boot makes it really hard to understand your
intentions.

And finally there is bootstage with it's own mechanism of
information passing.


Can we not unify these, and use one common method, please?


> Also consider the scenario where there is a read-only TPL programmed
> in manufacture that never changes, and a read-write SPL +  U-Boot that
> can be upgraded in the field. In this case they may eventually end up
> being built with different versions of U-Boot. The bloblist structure
> is intended to handle this by at least checking that the size matches.

You also have the version field there, right?  Who not (also)
checking this?

> Related, I feel that we should figure out how to use registers to pass
> addresses from SPL to U-Boot. On ARM we could use r0 to pass the value
> of gd, perhaps.

There is no need to.  GD already has a well-defined register which
has been reserved exclusively for this use - on ARM, it's R9.



Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Little known fact about Middle Earth:   The Hobbits had a very sophi-
sticated computer network!   It was a Tolkien Ring...


More information about the U-Boot mailing list