spl: Support selecting images based on phase in simple FIT
authorSimon Glass <sjg@chromium.org>
Sun, 26 Jan 2025 18:43:17 +0000 (11:43 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 3 Feb 2025 22:01:36 +0000 (16:01 -0600)
commit873112db9ce68c38984ff25808dde726f8dd5573
tree2fb4b52a9724f54fa997b97ea15734eb5f11fc02
parentc38b372f354082c4902c492ee849392c3fd6cd51
spl: Support selecting images based on phase in simple FIT

At present the simple FIT-loader always loads images, ignoring whether
they are intended for the next phase or not.

VBE packages up several images in the same FIT, some destined for VPL
and some for SPL. Add logic to check the phase before loading the
image. Return -EPERM in that case and handle it gracefully.

Fix a unnecessary re-computation of read_offset while here.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/spl/spl_fit.c