summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/Kconfig8
-rw-r--r--common/bloblist.c13
-rw-r--r--common/board_f.c7
-rw-r--r--common/board_info.c8
-rw-r--r--common/board_r.c11
-rw-r--r--common/console.c6
-rw-r--r--common/hash.c8
-rw-r--r--common/malloc_simple.c3
-rw-r--r--common/memtop.c4
-rw-r--r--common/spl/Kconfig1
-rw-r--r--common/spl/Kconfig.vpl17
-rw-r--r--common/spl/spl.c15
-rw-r--r--common/spl/spl_atf.c36
-rw-r--r--common/spl/spl_fit.c12
-rw-r--r--common/spl/spl_legacy.c8
-rw-r--r--common/spl/spl_mmc.c6
16 files changed, 101 insertions, 62 deletions
diff --git a/common/Kconfig b/common/Kconfig
index e8d89bf6eb9..0e8c44f3f74 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -845,6 +845,14 @@ config HASH
and the algorithms it supports are defined in common/hash.c. See
also CMD_HASH for command-line access.
+config HASH_CRC8
+ bool "Make crc8 available via the hash API"
+ depends on HASH && CRC8
+ help
+ Most times, the crc8() function is called directly. To make it also
+ available via the hash API, e.g. in hash_block(), enable this
+ option.
+
config AVB_VERIFY
bool "Build Android Verified Boot operations"
depends on LIBAVB
diff --git a/common/bloblist.c b/common/bloblist.c
index ec6ff7a5a93..110bb9dc44a 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -576,14 +576,17 @@ int bloblist_maybe_init(void)
int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig)
{
- ulong version = BLOBLIST_REGCONV_VER;
+ u64 version = BLOBLIST_REGCONV_VER;
ulong sigval;
- sigval = (IS_ENABLED(CONFIG_64BIT)) ?
- ((BLOBLIST_MAGIC & ((1UL << BLOBLIST_REGCONV_SHIFT_64) - 1)) |
- ((version & BLOBLIST_REGCONV_MASK) << BLOBLIST_REGCONV_SHIFT_64)) :
- ((BLOBLIST_MAGIC & ((1UL << BLOBLIST_REGCONV_SHIFT_32) - 1)) |
+ if ((IS_ENABLED(CONFIG_64BIT) && !IS_ENABLED(CONFIG_SPL_BUILD)) ||
+ (IS_ENABLED(CONFIG_SPL_64BIT) && IS_ENABLED(CONFIG_SPL_BUILD))) {
+ sigval = ((BLOBLIST_MAGIC & ((1ULL << BLOBLIST_REGCONV_SHIFT_64) - 1)) |
+ ((version & BLOBLIST_REGCONV_MASK) << BLOBLIST_REGCONV_SHIFT_64));
+ } else {
+ sigval = ((BLOBLIST_MAGIC & ((1UL << BLOBLIST_REGCONV_SHIFT_32) - 1)) |
((version & BLOBLIST_REGCONV_MASK) << BLOBLIST_REGCONV_SHIFT_32));
+ }
if (rzero || rsig != sigval ||
rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) {
diff --git a/common/board_f.c b/common/board_f.c
index 939697d13d8..54c48d42ee9 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -648,13 +648,6 @@ __weak int arch_setup_bdinfo(void)
int setup_bdinfo(void)
{
- struct bd_info *bd = gd->bd;
-
- if (IS_ENABLED(CONFIG_SYS_HAS_SRAM)) {
- bd->bi_sramstart = CONFIG_SYS_SRAM_BASE; /* start of SRAM */
- bd->bi_sramsize = CONFIG_SYS_SRAM_SIZE; /* size of SRAM */
- }
-
return arch_setup_bdinfo();
}
diff --git a/common/board_info.c b/common/board_info.c
index 33c260b404e..dc26e1a33dd 100644
--- a/common/board_info.c
+++ b/common/board_info.c
@@ -18,9 +18,9 @@ static const struct to_show {
const char *name;
enum sysinfo_id id;
} to_show[] = {
- { "Manufacturer", SYSINFO_ID_BOARD_MANUFACTURER},
- { "Prior-stage version", SYSINFO_ID_PRIOR_STAGE_VERSION },
- { "Prior-stage date", SYSINFO_ID_PRIOR_STAGE_DATE },
+ { "Manufacturer", SYSID_BOARD_MANUFACTURER},
+ { "Prior-stage version", SYSID_PRIOR_STAGE_VERSION },
+ { "Prior-stage date", SYSID_PRIOR_STAGE_DATE },
{ /* sentinel */ }
};
@@ -39,7 +39,7 @@ static int try_sysinfo(void)
if (ret)
return ret;
- ret = sysinfo_get_str(dev, SYSINFO_ID_BOARD_MODEL, sizeof(str), str);
+ ret = sysinfo_get_str(dev, SYSID_BOARD_MODEL, sizeof(str), str);
if (ret)
return ret;
printf("Model: %s\n", str);
diff --git a/common/board_r.c b/common/board_r.c
index 88dc756b2a5..f63c6aed4d5 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -155,11 +155,11 @@ static int initr_reloc_global_data(void)
/*
* For CONFIG_OF_EMBED case the FDT is embedded into ELF, available by
- * __dtb_dt_begin. After U-boot ELF self-relocation to RAM top address
+ * __dtb_dt_begin. After U-Boot ELF self-relocation to RAM top address
* it is worth to update fdt_blob in global_data
*/
if (IS_ENABLED(CONFIG_OF_EMBED))
- gd->fdt_blob = dtb_dt_embedded();
+ fdtdec_setup_embed();
#ifdef CONFIG_EFI_LOADER
/*
@@ -296,13 +296,10 @@ static int initr_announce(void)
return 0;
}
-static int initr_binman(void)
+static int __maybe_unused initr_binman(void)
{
int ret;
- if (!CONFIG_IS_ENABLED(BINMAN_FDT))
- return 0;
-
ret = binman_init();
if (ret)
printf("binman_init failed:%d\n", ret);
@@ -644,7 +641,9 @@ static init_fnc_t init_sequence_r[] = {
#ifdef CONFIG_EFI_LOADER
efi_memory_init,
#endif
+#ifdef CONFIG_BINMAN_FDT
initr_binman,
+#endif
#ifdef CONFIG_FSP_VERSION2
arch_fsp_init_r,
#endif
diff --git a/common/console.c b/common/console.c
index 22224701e45..863ac6aa9dc 100644
--- a/common/console.c
+++ b/common/console.c
@@ -745,11 +745,7 @@ void puts(const char *s)
}
if (IS_ENABLED(CONFIG_DEBUG_UART) && !(gd->flags & GD_FLG_SERIAL_READY)) {
- while (*s) {
- int ch = *s++;
-
- printch(ch);
- }
+ printascii(s);
return;
}
diff --git a/common/hash.c b/common/hash.c
index db6925d6782..8dd9da85768 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -304,6 +304,14 @@ static struct hash_algo hash_algo[] = {
.hash_update = hash_update_crc16_ccitt,
.hash_finish = hash_finish_crc16_ccitt,
},
+#if CONFIG_IS_ENABLED(CRC8) && IS_ENABLED(CONFIG_HASH_CRC8)
+ {
+ .name = "crc8",
+ .digest_size = 1,
+ .chunk_size = CHUNKSZ_CRC32,
+ .hash_func_ws = crc8_wd_buf,
+ },
+#endif
#if CONFIG_IS_ENABLED(CRC32)
{
.name = "crc32",
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index 5a8ec538f8f..f0f90a095bd 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -26,7 +26,8 @@ static void *alloc_simple(size_t bytes, int align)
log_debug("size=%lx, ptr=%lx, limit=%x: ", (ulong)bytes, new_ptr,
gd->malloc_limit);
if (new_ptr > gd->malloc_limit) {
- log_err("alloc space exhausted\n");
+ log_err("alloc space exhausted ptr %lx limit %x\n", new_ptr,
+ gd->malloc_limit);
return NULL;
}
diff --git a/common/memtop.c b/common/memtop.c
index 841d89e0799..bff27d8211e 100644
--- a/common/memtop.c
+++ b/common/memtop.c
@@ -121,8 +121,8 @@ static long region_overlap_check(struct mem_region *mem_rgn, phys_addr_t base,
return (i < mem_rgn->count) ? i : -1;
}
-static int find_ram_top(struct mem_region *free_mem,
- struct mem_region *reserved_mem, phys_size_t size)
+static phys_addr_t find_ram_top(struct mem_region *free_mem,
+ struct mem_region *reserved_mem, phys_size_t size)
{
long i, rgn;
phys_addr_t base = 0;
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 240543c9c7e..4e56d9909c8 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -751,6 +751,7 @@ config SPL_FS_LOAD_PAYLOAD_NAME
depends on SPL_FS_EXT4 || SPL_FS_FAT || SPL_FS_SQUASHFS || SPL_SEMIHOSTING
default "tispl.bin" if SYS_K3_SPL_ATF
default "u-boot.itb" if SPL_LOAD_FIT
+ default "linux.itb" if SPL_LOAD_FIT_OPENSBI_OS_BOOT
default "u-boot.img"
help
Filename to read to load U-Boot when reading from filesystem.
diff --git a/common/spl/Kconfig.vpl b/common/spl/Kconfig.vpl
index d06f36d4ee4..eb57dfabea5 100644
--- a/common/spl/Kconfig.vpl
+++ b/common/spl/Kconfig.vpl
@@ -222,12 +222,29 @@ config VPL_SPI_FLASH_SUPPORT
lines). This enables the drivers in drivers/mtd/spi as part of a
VPL build. This normally requires VPL_SPI_SUPPORT.
+config VPL_SYS_MALLOC_SIMPLE
+ bool "Only use malloc_simple functions in the VPL"
+ default y
+ help
+ Say Y here to only use the *_simple malloc functions from
+ malloc_simple.c, rather then using the versions from dlmalloc.c;
+ this will make the VPL binary smaller at the cost of more heap
+ usage as the *_simple malloc functions do not re-use free-ed mem.
+
config VPL_TEXT_BASE
hex "VPL Text Base"
default 0x0
help
The address in memory that VPL will be running from.
+config VPL_MAX_SIZE
+ hex "Maximum size (in bytes) for the VPL stage"
+ default 0x2e000 if ROCKCHIP_RK3399
+ default 0x0
+ help
+ The maximum size (in bytes) of the TPL stage. This size is determined
+ by the amount of internal SRAM memory.
+
config VPL_BINMAN_SYMBOLS
bool "Declare binman symbols in VPL"
depends on VPL_FRAMEWORK && BINMAN
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 1ceb63daf31..ad31a2f8b6c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -631,10 +631,13 @@ static int boot_from_devices(struct spl_image_info *spl_image,
"Unsupported Boot Device!\n");
}
}
- if (loader &&
- !spl_load_image(spl_image, loader)) {
- spl_image->boot_device = bootdev;
- return 0;
+ if (loader) {
+ ret = spl_load_image(spl_image, loader);
+ if (!ret) {
+ spl_image->boot_device = bootdev;
+ return 0;
+ }
+ printf("Error: %d\n", ret);
}
}
}
@@ -833,7 +836,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
*/
void preloader_console_init(void)
{
-#ifdef CONFIG_SPL_SERIAL
+#if CONFIG_IS_ENABLED(SERIAL)
gd->baudrate = CONFIG_BAUDRATE;
serial_init(); /* serial communications setup */
@@ -892,7 +895,7 @@ __weak void spl_relocate_stack_check(void)
*/
ulong spl_relocate_stack_gd(void)
{
-#ifdef CONFIG_SPL_STACK_R
+#if CONFIG_IS_ENABLED(STACK_R)
gd_t *new_gd;
ulong ptr = CONFIG_SPL_STACK_R_ADDR;
diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c
index 0397b86a33b..8bc5db77395 100644
--- a/common/spl/spl_atf.c
+++ b/common/spl/spl_atf.c
@@ -41,9 +41,9 @@ struct bl2_to_bl31_params_mem_v2 {
struct entry_point_info bl31_ep_info;
};
-struct bl31_params *bl2_plat_get_bl31_params_default(uintptr_t bl32_entry,
- uintptr_t bl33_entry,
- uintptr_t fdt_addr)
+struct bl31_params *bl2_plat_get_bl31_params_default(ulong bl32_entry,
+ ulong bl33_entry,
+ ulong fdt_addr)
{
static struct bl2_to_bl31_params_mem bl31_params_mem;
struct bl31_params *bl2_to_bl31_params;
@@ -100,17 +100,17 @@ struct bl31_params *bl2_plat_get_bl31_params_default(uintptr_t bl32_entry,
return bl2_to_bl31_params;
}
-__weak struct bl31_params *bl2_plat_get_bl31_params(uintptr_t bl32_entry,
- uintptr_t bl33_entry,
- uintptr_t fdt_addr)
+__weak struct bl31_params *bl2_plat_get_bl31_params(ulong bl32_entry,
+ ulong bl33_entry,
+ ulong fdt_addr)
{
return bl2_plat_get_bl31_params_default(bl32_entry, bl33_entry,
fdt_addr);
}
-struct bl_params *bl2_plat_get_bl31_params_v2_default(uintptr_t bl32_entry,
- uintptr_t bl33_entry,
- uintptr_t fdt_addr)
+struct bl_params *bl2_plat_get_bl31_params_v2_default(ulong bl32_entry,
+ ulong bl33_entry,
+ ulong fdt_addr)
{
static struct bl2_to_bl31_params_mem_v2 bl31_params_mem;
struct bl_params *bl_params;
@@ -173,9 +173,9 @@ struct bl_params *bl2_plat_get_bl31_params_v2_default(uintptr_t bl32_entry,
return bl_params;
}
-__weak struct bl_params *bl2_plat_get_bl31_params_v2(uintptr_t bl32_entry,
- uintptr_t bl33_entry,
- uintptr_t fdt_addr)
+__weak struct bl_params *bl2_plat_get_bl31_params_v2(ulong bl32_entry,
+ ulong bl33_entry,
+ ulong fdt_addr)
{
return bl2_plat_get_bl31_params_v2_default(bl32_entry, bl33_entry,
fdt_addr);
@@ -188,8 +188,8 @@ static inline void raw_write_daif(unsigned int daif)
typedef void __noreturn (*atf_entry_t)(struct bl31_params *params, void *plat_params);
-static void __noreturn bl31_entry(uintptr_t bl31_entry, uintptr_t bl32_entry,
- uintptr_t bl33_entry, uintptr_t fdt_addr)
+static void __noreturn bl31_entry(ulong bl31_entry, ulong bl32_entry,
+ ulong bl33_entry, ulong fdt_addr)
{
atf_entry_t atf_entry = (atf_entry_t)bl31_entry;
void *bl31_params;
@@ -238,7 +238,7 @@ static int spl_fit_images_find(void *blob, int os)
return -FDT_ERR_NOTFOUND;
}
-uintptr_t spl_fit_images_get_entry(void *blob, int node)
+ulong spl_fit_images_get_entry(void *blob, int node)
{
ulong val;
int ret;
@@ -253,10 +253,10 @@ uintptr_t spl_fit_images_get_entry(void *blob, int node)
void __noreturn spl_invoke_atf(struct spl_image_info *spl_image)
{
- uintptr_t bl32_entry = 0;
- uintptr_t bl33_entry = CONFIG_TEXT_BASE;
+ ulong bl32_entry = 0;
+ ulong bl33_entry = CONFIG_TEXT_BASE;
void *blob = spl_image->fdt_addr;
- uintptr_t platform_param = (uintptr_t)blob;
+ ulong platform_param = (ulong)blob;
int node;
/*
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index 3160f573bfb..ac8462577ff 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -190,7 +190,7 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size,
/**
* load_simple_fit(): load the image described in a certain FIT node
* @info: points to information about the device to load data from
- * @sector: the start sector of the FIT image on the device
+ * @fit_offset: the offset of the FIT image on the device
* @ctx: points to the FIT context structure
* @node: offset of the DT node describing the image to load (relative
* to @fit)
@@ -243,11 +243,14 @@ static int load_simple_fit(struct spl_load_info *info, ulong fit_offset,
if (!fit_image_get_data_position(fit, node, &offset)) {
external_data = true;
} else if (!fit_image_get_data_offset(fit, node, &offset)) {
+ log_debug("read offset %x = offset from fit %lx\n",
+ offset, (ulong)offset + ctx->ext_data_offset);
offset += ctx->ext_data_offset;
external_data = true;
}
if (external_data) {
+ ulong read_offset;
void *src_ptr;
/* External data */
@@ -270,6 +273,10 @@ static int load_simple_fit(struct spl_load_info *info, ulong fit_offset,
overhead = get_aligned_image_overhead(info, offset);
size = get_aligned_image_size(info, length, offset);
+ read_offset = fit_offset + get_aligned_image_offset(info,
+ offset);
+ log_debug("reading from offset %x / %lx size %lx to %p: ",
+ offset, read_offset, size, src_ptr);
if (info->read(info,
fit_offset +
@@ -336,6 +343,7 @@ static int load_simple_fit(struct spl_load_info *info, ulong fit_offset,
else
image_info->entry_point = FDT_ERROR;
}
+ log_debug("- done loading\n");
upl_add_image(fit, node, load_addr, length);
@@ -862,7 +870,7 @@ int spl_load_fit_image(struct spl_image_info *spl_image,
{
struct bootm_headers images;
const char *fit_uname_config = NULL;
- uintptr_t fdt_hack;
+ ulong fdt_hack;
const char *uname;
ulong fw_data = 0, dt_data = 0, img_data = 0;
ulong fw_len = 0, dt_len = 0, img_len = 0;
diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index 9252b3a3de0..b3efb3e630e 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -16,11 +16,11 @@
#define LZMA_LEN (1 << 20)
-static void spl_parse_legacy_validate(uintptr_t start, uintptr_t size)
+static void spl_parse_legacy_validate(ulong start, ulong size)
{
- uintptr_t spl_start = (uintptr_t)_start;
- uintptr_t spl_end = (uintptr_t)&_image_binary_end;
- uintptr_t end = start + size;
+ ulong spl_start = (ulong)_start;
+ ulong spl_end = (ulong)&_image_binary_end;
+ ulong end = start + size;
if ((start >= spl_start && start < spl_end) ||
(end > spl_start && end <= spl_end) ||
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 1f696593216..fe4230170a0 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -81,8 +81,10 @@ static int spl_mmc_find_device(struct mmc **mmcp, int mmc_dev)
struct uclass *uc;
log_debug("Selecting MMC dev %d; seqs:\n", mmc_dev);
- uclass_id_foreach_dev(UCLASS_MMC, dev, uc)
- log_debug("%d: %s\n", dev_seq(dev), dev->name);
+ if (_LOG_DEBUG) {
+ uclass_id_foreach_dev(UCLASS_MMC, dev, uc)
+ log_debug("%d: %s\n", dev_seq(dev), dev->name);
+ }
ret = mmc_init_device(mmc_dev);
#else
ret = mmc_initialize(NULL);