mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-17 02:08:38 +00:00
arm: mvebu: Check that kwbimage blockid matches boot mode
Each boot mode has its own kwbimage specified by blockid. So check that kwbimage is valid by blockid. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
2e0429bcc1
commit
f830703f42
1 changed files with 31 additions and 14 deletions
|
@ -117,23 +117,40 @@ int spl_parse_board_header(struct spl_image_info *spl_image,
|
||||||
* (including SPL content) which is not included in U-Boot image_header.
|
* (including SPL content) which is not included in U-Boot image_header.
|
||||||
*/
|
*/
|
||||||
if (mhdr->version != 1 ||
|
if (mhdr->version != 1 ||
|
||||||
((mhdr->headersz_msb << 16) | mhdr->headersz_lsb) < sizeof(*mhdr) ||
|
((mhdr->headersz_msb << 16) | mhdr->headersz_lsb) < sizeof(*mhdr)) {
|
||||||
(
|
printf("ERROR: Invalid kwbimage v1\n");
|
||||||
#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT
|
|
||||||
mhdr->blockid != IBR_HDR_SPI_ID &&
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_SPL_SATA
|
|
||||||
mhdr->blockid != IBR_HDR_SATA_ID &&
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_SPL_MMC
|
|
||||||
mhdr->blockid != IBR_HDR_SDIO_ID &&
|
|
||||||
#endif
|
|
||||||
1
|
|
||||||
)) {
|
|
||||||
printf("ERROR: Not valid SPI/NAND/SATA/SDIO kwbimage v1\n");
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPL_SPI_FLASH_SUPPORT
|
||||||
|
if (bootdev->boot_device == BOOT_DEVICE_SPI &&
|
||||||
|
mhdr->blockid != IBR_HDR_SPI_ID) {
|
||||||
|
printf("ERROR: Wrong blockid (0x%x) in SPI kwbimage\n",
|
||||||
|
mhdr->blockid);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPL_SATA
|
||||||
|
if (bootdev->boot_device == BOOT_DEVICE_SATA &&
|
||||||
|
mhdr->blockid != IBR_HDR_SATA_ID) {
|
||||||
|
printf("ERROR: Wrong blockid (0x%x) in SATA kwbimage\n",
|
||||||
|
mhdr->blockid);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_SPL_MMC
|
||||||
|
if ((bootdev->boot_device == BOOT_DEVICE_MMC1 ||
|
||||||
|
bootdev->boot_device == BOOT_DEVICE_MMC2 ||
|
||||||
|
bootdev->boot_device == BOOT_DEVICE_MMC2_2) &&
|
||||||
|
mhdr->blockid != IBR_HDR_SDIO_ID) {
|
||||||
|
printf("ERROR: Wrong blockid (0x%x) in SDIO kwbimage\n",
|
||||||
|
mhdr->blockid);
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
spl_image->offset = mhdr->srcaddr;
|
spl_image->offset = mhdr->srcaddr;
|
||||||
|
|
||||||
#ifdef CONFIG_SPL_SATA
|
#ifdef CONFIG_SPL_SATA
|
||||||
|
|
Loading…
Reference in a new issue