diff options
author | Marek Vasut <marex@denx.de> | 2018-08-14 11:27:02 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-09-25 21:48:43 -0400 |
commit | 04ce5427bd3914cab8be78513275a20ab878520a (patch) | |
tree | c13456e3916f3c9cc0b9b025c4da0e1c6b6e7c98 /common/spl/spl_spi.c | |
parent | 4c834b965aa3cde447e733b1cd338c02ffd04cd2 (diff) | |
download | u-boot-04ce5427bd3914cab8be78513275a20ab878520a.zip u-boot-04ce5427bd3914cab8be78513275a20ab878520a.tar.gz u-boot-04ce5427bd3914cab8be78513275a20ab878520a.tar.bz2 |
spl: Weed out CONFIG_SYS_TEXT_BASE usage
The SPL loaders assume that the CONFIG_SYS_TEXT_BASE memory location
is available and can be corrupted by loading ie. uImage or fitImage
headers there. Sometimes it could be beneficial to load the headers
elsewhere, ie. if CONFIG_SYS_TEXT_BASE is not yet writable while we
still want to parse the image headers in some local onchip memory to
ie. extract firmware from that image.
Add the possibility to override the location where the headers get
loaded by introducing new function, spl_get_load_buffer() which takes
two arguments -- offset from the CONFIG_SYS_TEXT_BASE and size of the
data that are to be loaded there -- and returns a valid buffer address
or hangs the system. The default behavior is the same as before, add
the offset to CONFIG_SYS_TEXT_BASE and return that address. User can
override the weak spl_get_load_buffer() function though.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
Diffstat (limited to 'common/spl/spl_spi.c')
-rw-r--r-- | common/spl/spl_spi.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c index ba60a3a..e10cf01 100644 --- a/common/spl/spl_spi.c +++ b/common/spl/spl_spi.c @@ -88,8 +88,7 @@ static int spl_spi_load_image(struct spl_image_info *spl_image, return -ENODEV; } - /* use CONFIG_SYS_TEXT_BASE as temporary storage area */ - header = (struct image_header *)(CONFIG_SYS_TEXT_BASE); + header = spl_get_load_buffer(-sizeof(*header), 0x40); #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) payload_offs = fdtdec_get_config_int(gd->fdt_blob, |