Message ID | 20211111155953.31526-5-kabel@kernel.org |
---|---|
State | Superseded |
Delegated to: | Stefan Roese |
Headers | show |
Series | More verifications for kwbimage in SPL | expand |
On 11/11/21 16:59, Marek Behún wrote: > From: Pali Rohár <pali@kernel.org> > > Commit 9baab60b8054 ("SPL: Add support for parsing board / BootROM specific > image types") added support for loading board specific image types. > > This commit adds support for a new weak function spl_parse_board_header() > which is called after loading boot image. Board may implement this function > for checking if loaded board specific image is valid. > > Signed-off-by: Pali Rohár <pali@kernel.org> > Signed-off-by: Marek Behún <marek.behun@nic.cz> > --- > common/spl/spl.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/common/spl/spl.c b/common/spl/spl.c > index bf2139a058..cc3b3b3438 100644 > --- a/common/spl/spl.c > +++ b/common/spl/spl.c > @@ -589,6 +589,12 @@ static struct spl_image_loader *spl_ll_find_loader(uint boot_device) > return NULL; > } > > +__weak int spl_check_board_image(struct spl_image_info *spl_image, > + const struct spl_boot_device *bootdev) > +{ > + return 0; > +} > + > static int spl_load_image(struct spl_image_info *spl_image, > struct spl_image_loader *loader) > { > @@ -610,6 +616,9 @@ static int spl_load_image(struct spl_image_info *spl_image, > } > } > #endif > + if (!ret) > + ret = spl_check_board_image(spl_image, &bootdev); > + I'm not a big fan of new __weak functions. But we already have some of them here in the SPL interface and I don't a clear idea on how to change this now. So: Reviewed-by: Stefan Roese <sr@denx.de> Thanks, Stefan
diff --git a/common/spl/spl.c b/common/spl/spl.c index bf2139a058..cc3b3b3438 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -589,6 +589,12 @@ static struct spl_image_loader *spl_ll_find_loader(uint boot_device) return NULL; } +__weak int spl_check_board_image(struct spl_image_info *spl_image, + const struct spl_boot_device *bootdev) +{ + return 0; +} + static int spl_load_image(struct spl_image_info *spl_image, struct spl_image_loader *loader) { @@ -610,6 +616,9 @@ static int spl_load_image(struct spl_image_info *spl_image, } } #endif + if (!ret) + ret = spl_check_board_image(spl_image, &bootdev); + return ret; }