fit: Rework SPL_LOAD_FIT_ADDRESS slightly
Options which deal with memory locations and have a default value of 0x0 are dangerous, as that is often not a valid memory location. Rework SPL_LOAD_FIT_ADDRESS as follows: - Add SPL_HAS_LOAD_FIT_ADDRESS to guard prompting the question as the case of loading a FIT image does not strictly require setting an address and allows for a malloc()'d area to be used. - For SPL_RAM_SUPPORT, select the new guard symbol if SPL_LOAD_FIT is enabled because in that case an address must be provided. - Update defconfigs for these new changes. Largely this means some defconfigs need to enable SPL_HAS_LOAD_FIT_ADDRESS to maintain their current status. In the case of sandbox, we also need to set SPL_LOAD_FIT_ADDRESS to 0x0. Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
+10
-2
@@ -245,16 +245,24 @@ config SPL_LOAD_FIT
|
||||
3. FDTs are only loaded for images with an "os" property of "u-boot".
|
||||
"linux" images are also supported with Falcon boot mode.
|
||||
|
||||
config SPL_HAS_LOAD_FIT_ADDRESS
|
||||
bool "Provide a static address to load the fit image to in SPL"
|
||||
depends on SPL_LOAD_FIT
|
||||
default y if ARCH_IMX8M || ARCH_K3 || ARCH_ROCKCHIP
|
||||
help
|
||||
By default, a buffer will be dynamically allocated via malloc to hold
|
||||
the FIT image. This option instead allows for a static location to be
|
||||
used and thus not need a large malloc pool to be defined.
|
||||
|
||||
config SPL_LOAD_FIT_ADDRESS
|
||||
hex "load address of fit image in SPL"
|
||||
depends on SPL_LOAD_FIT
|
||||
depends on SPL_HAS_LOAD_FIT_ADDRESS
|
||||
default 0x81000000 if ARCH_K3 && ARM64
|
||||
default 0x80080000 if ARCH_K3 && CPU_V7R
|
||||
default 0x44000000 if ARCH_IMX8M
|
||||
default 0x60080000 if ARCH_ROCKCHIP && SPL_TEXT_BASE = 0x60000000
|
||||
default 0x40200000 if ARCH_ROCKCHIP && SPL_TEXT_BASE = 0x40000000
|
||||
default 0x00200000 if ARCH_ROCKCHIP && SPL_TEXT_BASE = 0x00000000
|
||||
default 0x0
|
||||
help
|
||||
Specify the load address of the fit image that will be loaded
|
||||
by SPL.
|
||||
|
||||
@@ -1375,6 +1375,7 @@ config SPL_POWER_DOMAIN
|
||||
|
||||
config SPL_RAM_SUPPORT
|
||||
bool
|
||||
select SPL_HAS_LOAD_FIT_ADDRESS if SPL_LOAD_FIT
|
||||
|
||||
config SPL_RAM_DEVICE
|
||||
bool "Support booting from preloaded image in RAM"
|
||||
|
||||
@@ -593,9 +593,10 @@ static int spl_fit_image_get_os(const void *fit, int noffset, uint8_t *os)
|
||||
* The purpose of the FIT load buffer is to provide a memory location that is
|
||||
* independent of the load address of any FIT component.
|
||||
*/
|
||||
static void *spl_get_fit_load_buffer(size_t size)
|
||||
__weak void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
|
||||
{
|
||||
void *buf;
|
||||
size_t size = sectors * bl_len;
|
||||
|
||||
buf = malloc_cache_aligned(size);
|
||||
if (!buf) {
|
||||
@@ -611,11 +612,6 @@ static void *spl_get_fit_load_buffer(size_t size)
|
||||
return buf;
|
||||
}
|
||||
|
||||
__weak void *board_spl_fit_buffer_addr(ulong fit_size, int sectors, int bl_len)
|
||||
{
|
||||
return spl_get_fit_load_buffer(sectors * bl_len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Weak default function to allow customizing SPL fit loading for load-only
|
||||
* use cases by allowing to skip the parsing/processing of the FIT contents
|
||||
|
||||
@@ -9,6 +9,7 @@ CONFIG_SPL_TEXT_BASE=0x82000000
|
||||
CONFIG_SPL_STACK_R_ADDR=0x83f80000
|
||||
CONFIG_K3_OPTEE_LOAD_ADDR=0x80080000
|
||||
CONFIG_SPL_BSS_START_ADDR=0x82c00000
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x82f80000
|
||||
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x82b00000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am6254atl-sk"
|
||||
|
||||
@@ -6,5 +6,6 @@ CONFIG_SOC_K3_AM625=y
|
||||
CONFIG_TARGET_AM625_R5_EVM=y
|
||||
CONFIG_ENV_SOURCE_FILE="am6254atl"
|
||||
CONFIG_K3_OPTEE_LOAD_ADDR=0x80080000
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x82000000
|
||||
CONFIG_DEFAULT_DEVICE_TREE="k3-am6254atl-r5-sk"
|
||||
|
||||
@@ -38,6 +38,7 @@ CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
|
||||
CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
|
||||
CONFIG_SPL_IMX_ROMAPI_LOADADDR=0x48000000
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x44000000
|
||||
CONFIG_SPL_LOAD_FIT_APPLY_OVERLAY=y
|
||||
CONFIG_SPL_MAX_SIZE=0x26000
|
||||
|
||||
@@ -22,6 +22,7 @@ CONFIG_SPL_FS_LOAD_KERNEL_NAME="boot/fitImage"
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
|
||||
# Used as the 2MiB aligned load address for kernel
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SYS_LOAD_ADDR=0x82000000
|
||||
CONFIG_SPL_STACK_R_ADDR=0x88000000
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x82000000
|
||||
|
||||
@@ -38,6 +38,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
|
||||
CONFIG_SPL_SPI=y
|
||||
CONFIG_SPL_FIT_PRINT=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x48000000
|
||||
# CONFIG_SPL_BOARD_INIT is not set
|
||||
# CONFIG_SPL_LEGACY_IMAGE_FORMAT is not set
|
||||
|
||||
@@ -57,6 +57,7 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y
|
||||
CONFIG_SPL_SPI=y
|
||||
CONFIG_SPL_FIT_PRINT=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x48000000
|
||||
# CONFIG_SPL_BOARD_INIT is not set
|
||||
# CONFIG_SPL_LEGACY_IMAGE_FORMAT is not set
|
||||
|
||||
@@ -24,6 +24,8 @@ CONFIG_FIT=y
|
||||
CONFIG_FIT_SIGNATURE=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x0
|
||||
CONFIG_BOOTSTAGE=y
|
||||
CONFIG_BOOTSTAGE_REPORT=y
|
||||
CONFIG_BOOTSTAGE_FDT=y
|
||||
|
||||
@@ -19,6 +19,8 @@ CONFIG_FIT=y
|
||||
CONFIG_FIT_SIGNATURE=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x0
|
||||
CONFIG_BOOTSTAGE=y
|
||||
CONFIG_BOOTSTAGE_REPORT=y
|
||||
CONFIG_BOOTSTAGE_FDT=y
|
||||
|
||||
@@ -26,6 +26,8 @@ CONFIG_FIT=y
|
||||
CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_FIT_BEST_MATCH=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x0
|
||||
# CONFIG_TPL_BOOTMETH_VBE is not set
|
||||
# CONFIG_TPL_BOOTMETH_VBE_SIMPLE_FW is not set
|
||||
CONFIG_UPL=y
|
||||
|
||||
@@ -19,6 +19,7 @@ CONFIG_TARGET_SIFIVE_UNLEASHED=y
|
||||
CONFIG_ARCH_RV64I=y
|
||||
CONFIG_RISCV_SMODE=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x84000000
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_USE_PREBOOT=y
|
||||
|
||||
@@ -23,6 +23,7 @@ CONFIG_TARGET_SIFIVE_UNMATCHED=y
|
||||
CONFIG_ARCH_RV64I=y
|
||||
CONFIG_RISCV_SMODE=y
|
||||
CONFIG_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0x84000000
|
||||
CONFIG_BOOTSTD_DEFAULTS=y
|
||||
CONFIG_USE_PREBOOT=y
|
||||
|
||||
@@ -89,6 +89,7 @@ CONFIG_SPL_FOOTPRINT_LIMIT=y
|
||||
CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
|
||||
CONFIG_SPL_I2C=y
|
||||
CONFIG_SPL_LOAD_FIT=y
|
||||
CONFIG_SPL_HAS_LOAD_FIT_ADDRESS=y
|
||||
CONFIG_SPL_LOAD_FIT_ADDRESS=0xc1000000
|
||||
CONFIG_SPL_MAX_FOOTPRINT=0x3db00
|
||||
CONFIG_SPL_MTD=y
|
||||
|
||||
Reference in New Issue
Block a user