diff options
Diffstat (limited to 'common/spl')
-rw-r--r-- | common/spl/Kconfig | 21 | ||||
-rw-r--r-- | common/spl/spl_ext.c | 8 | ||||
-rw-r--r-- | common/spl/spl_fat.c | 7 | ||||
-rw-r--r-- | common/spl/spl_fit.c | 2 | ||||
-rw-r--r-- | common/spl/spl_mmc.c | 1 | ||||
-rw-r--r-- | common/spl/spl_opensbi.c | 5 | ||||
-rw-r--r-- | common/spl/spl_spi.c | 9 |
7 files changed, 46 insertions, 7 deletions
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 97f542fcc8a..c08045f9c8d 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -80,11 +80,10 @@ config SPL_MAX_SIZE default 0x1b000 if AM33XX && !TI_SECURE_DEVICE default 0xec00 if OMAP34XX default 0x10000 if ARCH_MX6 && !MX6_OCRAM_256KB - default 0x7fa0 if SUNXI_SRAM_ADDRESS = 0x10000 - default 0x7fa0 if SUNXI_SRAM_ADDRESS = 0x20000 && !MACH_SUN50I_H616 default 0xbfa0 if MACH_SUN50I_H616 default 0x7000 if RCAR_GEN3 default 0x5fa0 if SUNXI_SRAM_ADDRESS = 0x0 + default 0x7fa0 if ARCH_SUNXI default 0x10000 if ASPEED_AST2600 default 0x27000 if IMX8MM && SPL_TEXT_BASE = 0x7E1000 default 0x30000 if ARCH_SC5XX && (SC59X_64 || SC59X) @@ -1450,6 +1449,24 @@ config SYS_SPI_U_BOOT_OFFS Address within SPI-Flash from where the u-boot payload is fetched from. +config SYS_SPI_KERNEL_OFFS + hex "Falcon mode: address of kernel payload in SPI flash" + depends on SPL_SPI_FLASH_SUPPORT && SPL_OS_BOOT + help + Address within SPI-Flash from where the kernel payload is fetched + in falcon boot. + +config SYS_SPI_ARGS_OFFS + hex "Falcon mode: address of args payload in SPI flash" + depends on SPL_SPI_FLASH_SUPPORT && SPL_OS_BOOT + help + Address within SPI-Flash from where the args payload (usually the + dtb) is fetched in falcon boot. + +config SYS_SPI_ARGS_SIZE + hex "Falcon mode: size of args payload in SPI flash" + depends on SPL_SPI_FLASH_SUPPORT && SPL_OS_BOOT + config SPL_THERMAL bool "Driver support for thermal devices" help diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c index c5478820a9b..7e0274a3058 100644 --- a/common/spl/spl_ext.c +++ b/common/spl/spl_ext.c @@ -11,12 +11,20 @@ static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset, ulong size, void *buf) { + struct legacy_img_hdr *header; int ret; loff_t actlen; ret = ext4fs_read(buf, file_offset, size, &actlen); if (ret) return ret; + + if (CONFIG_IS_ENABLED(OS_BOOT)) { + header = (struct legacy_img_hdr *)buf; + if (image_get_magic(header) != FDT_MAGIC) + return size; + } + return actlen; } diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c index fce451b7664..f426a068ff9 100644 --- a/common/spl/spl_fat.c +++ b/common/spl/spl_fat.c @@ -47,6 +47,7 @@ static int spl_register_fat_device(struct blk_desc *block_dev, int partition) static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset, ulong size, void *buf) { + struct legacy_img_hdr *header; loff_t actread; int ret; char *filename = load->priv; @@ -55,6 +56,12 @@ static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset, if (ret) return ret; + if (CONFIG_IS_ENABLED(OS_BOOT)) { + header = (struct legacy_img_hdr *)buf; + if (image_get_magic(header) != FDT_MAGIC) + return size; + } + return actread; } diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c index 49b4df60560..86506d6905c 100644 --- a/common/spl/spl_fit.c +++ b/common/spl/spl_fit.c @@ -397,7 +397,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image, * Use the address following the image as target address for the * device tree. */ - image_info.load_addr = spl_image->load_addr + spl_image->size; + image_info.load_addr = ALIGN(spl_image->load_addr + spl_image->size, 8); /* Figure out which device tree the board wants to use */ node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++); diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c index fe4230170a0..d06f9f0dee6 100644 --- a/common/spl/spl_mmc.c +++ b/common/spl/spl_mmc.c @@ -411,6 +411,7 @@ int spl_mmc_load(struct spl_image_info *spl_image, return 0; #endif /* If RAW mode fails, try FS mode. */ + fallthrough; #ifdef CONFIG_SYS_MMCSD_FS_BOOT case MMCSD_MODE_FS: debug("spl: mmc boot mode: fs\n"); diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c index 5a26d7c31a4..0ed6afeacc6 100644 --- a/common/spl/spl_opensbi.c +++ b/common/spl/spl_opensbi.c @@ -57,6 +57,11 @@ void __noreturn spl_invoke_opensbi(struct spl_image_info *spl_image) hang(); } + if (!IS_ALIGNED((uintptr_t)spl_image->fdt_addr, 8)) { + pr_err("SPL image loaded an improperly-aligned device tree\n"); + hang(); + } + /* * Originally, u-boot-spl will place DTB directly after the kernel, * but the size of the kernel did not include the BSS section, which diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index 691a431a926..00dbd3011f0 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -82,13 +82,14 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, #if CONFIG_IS_ENABLED(OS_BOOT) if (spl_start_uboot()) { int err = spl_load(spl_image, bootdev, &load, 0, - CFG_SYS_SPI_KERNEL_OFFS); + CONFIG_SYS_SPI_KERNEL_OFFS); if (!err) /* Read device tree. */ - return spi_flash_read(flash, CFG_SYS_SPI_ARGS_OFFS, - CFG_SYS_SPI_ARGS_SIZE, - (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR); + return spi_flash_read( + flash, CONFIG_SYS_SPI_ARGS_OFFS, + CONFIG_SYS_SPI_ARGS_SIZE, + (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR); } #endif |