]> git.ipfire.org Git - people/ms/u-boot.git/commit
rockchip: spl: make boot0 hook TPL safe
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tue, 11 Jul 2017 19:04:45 +0000 (21:04 +0200)
committerPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Thu, 27 Jul 2017 12:59:02 +0000 (14:59 +0200)
commit700f3108d3970a0f8ea8b05e1a6c1907ea75dfc8
tree1e672eff545541749255c7b92460539c22736b4f
parent06f4e36baf7833c2fa40af34b240e4132898689b
rockchip: spl: make boot0 hook TPL safe

When building for a TPL/SPL setup (e.g. on the RK3368), we need the
TPL stage to have the extra space for for the 'Rockchip SPL name'
(i.e. 'RK33' word).  Yet, the SPL will start execution at its first
word (i.e. the first word in the SPL binary needs to be a valid
instruction).  To make things a bit more involved, CONFIG_SPL_BUILD
is defined both for the SPL and the TPL stage.

To avoid having to explicitly test for the first stage (TPL, if and
only if TPL and SPL are built, SPL otherwise), this commit modifies
the sequence to repeat the 'b reset' (instead of reserving 4 bytes
of undefined space) at the start of the boot0 hook: if overwritten
(and execution starts at the second word), the first instruction is
still a 'b reset'... if not overwritten, we start on a 'b reset' as
well.

This solution wouldn't even require the check whether we are in the
SPL/TPL build (i.e. CONFIG_SPL_BUILD), but we leave this check in for
documentation purposes.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/arm/include/asm/arch-rockchip/boot0.h