summaryrefslogtreecommitdiff
path: root/common/spl
diff options
context:
space:
mode:
Diffstat (limited to 'common/spl')
-rw-r--r--common/spl/Kconfig50
-rw-r--r--common/spl/Kconfig.tpl19
-rw-r--r--common/spl/Kconfig.vpl14
-rw-r--r--common/spl/spl_ext.c8
-rw-r--r--common/spl/spl_fat.c7
-rw-r--r--common/spl/spl_fit.c2
-rw-r--r--common/spl/spl_opensbi.c5
-rw-r--r--common/spl/spl_spi.c9
8 files changed, 93 insertions, 21 deletions
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 94e118f8465..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)
@@ -387,11 +386,29 @@ config SPL_SHARES_INIT_SP_ADDR
both SPL and U-Boot itself. If you need to specify a different address
however, say N here and then set a different value in CONFIG_SPL_STACK.
-config SPL_STACK
- hex "Initial stack pointer location"
+config SPL_HAVE_INIT_STACK
+ bool "SPL requires a initial, fixed, stack-pointer location"
depends on (ARM || ARCH_JZ47XX || MICROBLAZE || RISCV) && \
SPL_FRAMEWORK || ROCKCHIP_RK3036
depends on !SPL_SHARES_INIT_SP_ADDR
+ default y if ARCH_MX7
+ default y if ARCH_MX6 && MX6_OCRAM_256KB
+ default y if ARCH_MX6 && !MX6_OCRAM_256KB
+ default y if MACH_SUN50I_H6 || MACH_SUN50I_H616 || MACH_SUN8I_R528
+ default y if MACH_SUN50I || MACH_SUN50I_H5
+ default y if MACH_SUN9I
+ default y if ARCH_SUNXI
+ default y if ARCH_SC5XX && (SC59X_64 || SC59X)
+ default y if ARCH_SC5XX && SC58X
+ default y if ARCH_SC5XX && SC57X
+ help
+ Enable if the SPL phase should not use inherit its initial
+ stack-pointer from the settings for U-Boot proper, but should set
+ its own value.
+
+config SPL_STACK
+ hex "Address of the initial stack-pointer for the SPL phase"
+ depends on SPL_HAVE_INIT_STACK
default 0x946bb8 if ARCH_MX7
default 0x93ffb8 if ARCH_MX6 && MX6_OCRAM_256KB
default 0x91ffb8 if ARCH_MX6 && !MX6_OCRAM_256KB
@@ -401,9 +418,9 @@ config SPL_STACK
default 0x54000 if MACH_SUN50I || MACH_SUN50I_H5
default 0x18000 if MACH_SUN9I
default 0x8000 if ARCH_SUNXI
- default 0x200E4000 if ARCH_SC5XX && (SC59X_64 || SC59X)
- default 0x200B0000 if ARCH_SC5XX && SC58X
- default 0x200D0000 if ARCH_SC5XX && SC57X
+ default 0x200e4000 if ARCH_SC5XX && (SC59X_64 || SC59X)
+ default 0x200b0000 if ARCH_SC5XX && SC58X
+ default 0x200d0000 if ARCH_SC5XX && SC57X
help
Address of the start of the stack SPL will use before SDRAM is
initialized.
@@ -1287,6 +1304,7 @@ config SPL_RAM_DEVICE
config SPL_REMOTEPROC
bool "Support REMOTEPROCS"
+ default y if (CPU_V7R && ARCH_K3)
help
Enable support for REMOTEPROCs in SPL. This permits to load
a remote processor firmware in SPL.
@@ -1431,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/Kconfig.tpl b/common/spl/Kconfig.tpl
index 22ca7016453..a535b61ecd3 100644
--- a/common/spl/Kconfig.tpl
+++ b/common/spl/Kconfig.tpl
@@ -106,12 +106,6 @@ config TPL_LDSCRIPT
May be left empty to trigger the Makefile infrastructure to
fall back to the linker-script used for the SPL stage.
-config TPL_NEEDS_SEPARATE_STACK
- bool "TPL needs a separate initial stack-pointer"
- help
- Enable, if the TPL stage should not inherit its initial
- stack-pointer from the settings for the SPL stage.
-
config TPL_POWER
bool "Support power drivers"
help
@@ -140,11 +134,18 @@ config TPL_MAX_SIZE
help
The maximum size (in bytes) of the TPL stage.
+config TPL_HAVE_INIT_STACK
+ bool "TPL requires a initial, fixed, stack-pointer location"
+ help
+ Enable if the TPL phase should not inherit its initial
+ stack-pointer from the settings for U-Boot proper, but should set its
+ own value.
+
config TPL_STACK
- hex "Address of the initial stack-pointer for the TPL stage"
- depends on TPL_NEEDS_SEPARATE_STACK
+ hex "Address of the initial stack-pointer for the TPL phase"
+ depends on TPL_HAVE_INIT_STACK
help
- The address of the initial stack-pointer for the TPL stage.
+ The address of the initial stack-pointer for the TPL phase
Usually this will be the (aligned) top-of-stack.
config TPL_READ_ONLY
diff --git a/common/spl/Kconfig.vpl b/common/spl/Kconfig.vpl
index cf6b36c8e38..434562443ac 100644
--- a/common/spl/Kconfig.vpl
+++ b/common/spl/Kconfig.vpl
@@ -266,6 +266,20 @@ config VPL_MAX_SIZE
The maximum size (in bytes) of the TPL stage. This size is determined
by the amount of internal SRAM memory.
+config VPL_HAVE_INIT_STACK
+ bool "VPL requires a initial, fixed, stack-pointer location"
+ help
+ Enable if the VPL phase should not use inherit its initial
+ stack-pointer from the settings for U-Boot proper, but should set
+ its own value.
+
+config VPL_STACK
+ hex "Address of the initial stack-pointer for the VPL phase"
+ depends on VPL_HAVE_INIT_STACK
+ help
+ The address of the initial stack-pointer for the VPL phase
+ Usually this will be the (aligned) top-of-stack.
+
config VPL_BINMAN_SYMBOLS
bool "Declare binman symbols in VPL"
depends on VPL_FRAMEWORK && BINMAN
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_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