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

Wolfgang Denk wd at denx.de
Sun Mar 17 12:01:21 UTC 2019


Dear Simon,

In message <CAPnjgZ05B7qB0JJn6=cStyW6tj_i5jBZQwEAxTDF-fMp8NHeOQ at mail.gmail.com> you wrote:
>
> > 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.
>
> That's right. It is always zeroed these days at the start of each
> phase. So I think work is needed if we want to use this.

Yes, of course.  I just want to make sure we have agreement in which
direction we should move.

> Also I don't think we can assume that gd stays in the same place
> through all phases of U-Boot. Probably we can keep it in the same
> place in TPL, SPL and U-Boot pre-relocation, then move it to SDRAM
> during relocation.

Correct - it has never been a requirement that GD remains in place -
just that the pointer that is being passed points to valid data.
The currentimplementation already allows to move the GD from some
restricted resource (like on-chip-RAM or cache) to SDRAM as soon as
it becomes available.

> > Then you added the bloblist thingy.  It's not really clear what it's
...
> This is designed for things that need to past structs between phases.
> For example, verified boot may start processing in TPL and then pass
> information to SPL and then to U-Boot proper. This may involve quite a
> bit of info, so it is in a C structure. It isn't really suitable to
> put this entire structure in gd IMO, since that struct is pretty
> small.

So what is your recommendation?  Shall we use GD and bloblists side
by side?  Shall the GD just contain the lob list pointer?

Or shall we move all things have been thrown (without much thought,
as it seems) into GD to smaller structs and convert to blobs, so the
GD pointer actually becomes a pointer to the blob list (which would
increase code and executin time, I'm afraid).

What is your recommendation?

> The version, magic and checksum are to ensure that the data is not
> corrupted by mistake, which as you know can happen very easily with
> fixed-position data structures. The search is pretty quick once the
> checksum is done, just running through a few pointers. I suppose we
> could make the checksum optional.

But still it is another increase in code size - as is, for accessing
a field in GD we just dereference a pointer which is already in a
register; for a blob list, we need to call (at least) a function...

> > An then there is commit b0edea3c27 with the spl_handoff thing.  I
...
> That actually uses the bloblist, putting an SPL struct in there,
> intended to hold things like the SDRAM config or boot options
> discovered in SPL. At present we have a few ad-hoc ways of

Again: this is exactly what GD was intended for - now we have more
than one implementation and should decide what to do...

> > And finally there is bootstage with it's own mechanism of
> > information passing.
>
> Yes, and this is ad-hoc too. I would like to move it to bloblist.

So bloblist would be the way to go for GD, too?

> > Can we not unify these, and use one common method, please?
>
> I think we might end up with gd (once this work is done) and bloblist.
> For now I feel that bloblist has a purpose but let's see how it goes
> with the gd work.

Why do we need GD _and_ bloblist?   I would like to have one
solution only.


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
"The algorithm to do that is extremely nasty. You might want  to  mug
someone with it."                   - M. Devine, Computer Science 340


More information about the U-Boot mailing list