
Hello Simon,
On Wed, 4 Feb 2015 19:51:36 -0700, Simon Glass sjg@chromium.org wrote:
Hi Albert,
On 4 February 2015 at 01:59, Albert ARIBAUD albert.u.boot@aribaud.net wrote:
Hello Simon,
On Tue, 3 Feb 2015 21:18:52 -0700, Simon Glass sjg@chromium.org wrote:
The link register value can be required on some boards (e.g. FEL mode on sunxi) so stash it to r4 before jumping to save_boot_params().
I'd rather not make this there; I would like save_boot_params to start with as unmodified a core state as possible, because r4 might actually, now or in the future, contain important data.
I'd even go as far as saying that save_boot_params should be branched into rather than called, and should branch back to a fixed label right after reset, so that even lr is preserved. For SoCs which do not need to save any boot parameters, a weak version of save_boot_params would just do the branching back.
(this should help merging all start.S instances into a singe one, which I still want to achieve one day)
I did consider this but was worried that some save_boot_params() functions are written in C (OMAP) so this would not work. But if we can require it to be written in assembler, or provide an asm macro to return from the C function, then I can do that. What do you think?
I think that save_boot_params runs right at reset and cannot rely on any C environment at all, and should indeed be written in asm and only deal with *very urgent* savings; only those registers that would be lost almost immediately, like r0-r14 and some system registers. Anything else is less urgent and can be processed later, possibly even in board_init_f().
That being said, OMAP does not have save_boot_params in C that I can find; actualy, doing a 'git grep save_boot_param -- *.c' shows only one occurrence, in arch/arm/cpu/armv7/exynos/spl_boot.c, ar line 312, and it's an empty function. OMAP has an s_init C implementation, though.
Regards, Simon
Amicalement,