diff options
author | Andre Przywara <osp@andrep.de> | 2020-12-29 03:00:01 +0300 |
---|---|---|
committer | Andre Przywara <osp@andrep.de> | 2020-12-31 21:13:51 +0300 |
commit | 4c6a1a0150adc7a966613e9ea52bc62694928927 (patch) | |
tree | d8e193bdba4555cdb354d5f5293b0996023e2a77 /fel.c | |
parent | 276a97da6c580dd33b8e498ae94cc27a9887e5d7 (diff) |
fel: Observe SRAM size to extend SPL load size
At the moment we limit the maximum SPL load size to 32 KB, because this
was a BROM limit in previous SoCs.
Newer SoCs (H6 and later) lift this limit, but also this tool is not
bound by the BROM limit, since we can load any size.
Use the just introduced SRAM size to establish an upper limit for the
SPL size, then limit this as we go if any part of the memory is used for
the FEL backup buffers.
Given the buffer addresses chosen wisely, this can drastically increase
the maximum SPL load size, even on those SoCs with a 32KB BROM limit.
Signed-off-by: Andre Przywara <osp@andrep.de>
Diffstat (limited to 'fel.c')
-rw-r--r-- | fel.c | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -715,11 +715,8 @@ void aw_restore_and_enable_mmu(feldev_handle *dev, free(tt); } -/* - * Maximum size of SPL, at the same time this is the start offset - * of the main U-Boot image within u-boot-sunxi-with-spl.bin - */ -#define SPL_LEN_LIMIT 0x8000 +/* Minimum offset of the main U-Boot image within u-boot-sunxi-with-spl.bin. */ +#define SPL_MIN_OFFSET 0x8000 uint32_t aw_fel_write_and_execute_spl(feldev_handle *dev, uint8_t *buf, size_t len) { @@ -729,7 +726,7 @@ uint32_t aw_fel_write_and_execute_spl(feldev_handle *dev, uint8_t *buf, size_t l size_t i, thunk_size; uint32_t *thunk_buf; uint32_t sp, sp_irq; - uint32_t spl_checksum, spl_len, spl_len_limit = SPL_LEN_LIMIT; + uint32_t spl_checksum, spl_len, spl_len_limit; uint32_t *buf32 = (uint32_t *)buf; uint32_t cur_addr = soc_info->spl_addr; uint32_t *tt = NULL; @@ -782,6 +779,8 @@ uint32_t aw_fel_write_and_execute_spl(feldev_handle *dev, uint8_t *buf, size_t l tt = aw_generate_mmu_translation_table(); } + spl_len_limit = soc_info->sram_size; + swap_buffers = soc_info->swap_buffers; for (i = 0; swap_buffers[i].size; i++) { if ((swap_buffers[i].buf2 >= soc_info->spl_addr) && @@ -939,8 +938,8 @@ void aw_fel_process_spl_and_uboot(feldev_handle *dev, const char *filename) /* check for optional main U-Boot binary (and transfer it, if applicable) */ if (size > offset) { /* U-Boot pads to at least 32KB */ - if (offset < 32768) - offset = 32768; + if (offset < SPL_MIN_OFFSET) + offset = SPL_MIN_OFFSET; aw_fel_write_uboot_image(dev, buf + offset, size - offset); } free(buf); |