diff options
author | Pali Rohár <pali@kernel.org> | 2023-01-21 13:47:45 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2023-03-01 06:39:17 +0100 |
commit | d4aa2104327fd8b6d46f7c51de1e35f5ec702c93 (patch) | |
tree | 4a315f9875083db307d14c06b6fc0669ae7e2d50 /arch/arm/mach-mvebu | |
parent | e1c4ed57d5190e3064ae10ae3a87cdc75d2786fc (diff) | |
download | u-boot-d4aa2104327fd8b6d46f7c51de1e35f5ec702c93.tar.gz u-boot-d4aa2104327fd8b6d46f7c51de1e35f5ec702c93.tar.bz2 u-boot-d4aa2104327fd8b6d46f7c51de1e35f5ec702c93.zip |
arm: mvebu: spl: Fix parsing SATA kwbimage
Despite the official specification, Marvell BootROM does not interpret
srcaddr from SATA image as number of sectors the beginning of the hard
drive, but as number of sectors relative to the main header.
To process SATA kwbimage and load U-Boot proper from it in the same way as
Marvell BootROM, it is needed to interpret srcaddr as relative offset to
the main header. This change fixes booting of U-Boot proper from SPL code
in SATA image.
Fixes: 2226ca173486 ("arm: mvebu: Load U-Boot proper binary in SPL code based on kwbimage header")
Signed-off-by: Pali Rohár <pali@kernel.org>
Diffstat (limited to 'arch/arm/mach-mvebu')
-rw-r--r-- | arch/arm/mach-mvebu/spl.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index b238ba2f5d..6a39861262 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -182,19 +182,10 @@ int spl_parse_board_header(struct spl_image_info *spl_image, /* * For SATA srcaddr is specified in number of sectors. - * The main header is must be stored at sector number 1. - * This expects that sector size is 512 bytes and recalculates - * data offset to bytes relative to the main header. + * This expects that sector size is 512 bytes. */ - if (IS_ENABLED(CONFIG_SPL_SATA) && mhdr->blockid == IBR_HDR_SATA_ID) { - if (spl_image->offset < 1) { - printf("ERROR: Wrong srcaddr (0x%08x) in SATA kwbimage\n", - spl_image->offset); - return -EINVAL; - } - spl_image->offset -= 1; + if (IS_ENABLED(CONFIG_SPL_SATA) && mhdr->blockid == IBR_HDR_SATA_ID) spl_image->offset *= 512; - } if (spl_image->offset % 4 != 0) { printf("ERROR: Wrong srcaddr (0x%08x) in kwbimage\n", |