diff options
author | Simon Glass <sjg@chromium.org> | 2016-09-24 18:19:53 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-10-06 14:48:17 -0400 |
commit | 71316c1d8c1799b444d14cfb00eaacb6cf1ce44a (patch) | |
tree | d7c0b1c644dfdeed26c7cfe5804a7dbdd8584026 /common/spl/spl.c | |
parent | d95ceb97c0ca158605372634a860651ca925915a (diff) | |
download | u-boot-71316c1d8c1799b444d14cfb00eaacb6cf1ce44a.tar.gz |
spl: Add a parameter to spl_parse_image_header()
Instead of using the global spl_image variable, pass the required struct in
as an argument.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common/spl/spl.c')
-rw-r--r-- | common/spl/spl.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c index b664cc7b21..7f67d41e49 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -91,33 +91,34 @@ void spl_set_header_raw_uboot(struct spl_image_info *spl_image) spl_image->name = "U-Boot"; } -int spl_parse_image_header(const struct image_header *header) +int spl_parse_image_header(struct spl_image_info *spl_image, + const struct image_header *header) { u32 header_size = sizeof(struct image_header); if (image_get_magic(header) == IH_MAGIC) { - if (spl_image.flags & SPL_COPY_PAYLOAD_ONLY) { + if (spl_image->flags & SPL_COPY_PAYLOAD_ONLY) { /* * On some system (e.g. powerpc), the load-address and * entry-point is located at address 0. We can't load * to 0-0x40. So skip header in this case. */ - spl_image.load_addr = image_get_load(header); - spl_image.entry_point = image_get_ep(header); - spl_image.size = image_get_data_size(header); + spl_image->load_addr = image_get_load(header); + spl_image->entry_point = image_get_ep(header); + spl_image->size = image_get_data_size(header); } else { - spl_image.entry_point = image_get_load(header); + spl_image->entry_point = image_get_load(header); /* Load including the header */ - spl_image.load_addr = spl_image.entry_point - + spl_image->load_addr = spl_image->entry_point - header_size; - spl_image.size = image_get_data_size(header) + + spl_image->size = image_get_data_size(header) + header_size; } - spl_image.os = image_get_os(header); - spl_image.name = image_get_name(header); + spl_image->os = image_get_os(header); + spl_image->name = image_get_name(header); debug("spl: payload image: %.*s load addr: 0x%x size: %d\n", - (int)sizeof(spl_image.name), spl_image.name, - spl_image.load_addr, spl_image.size); + (int)sizeof(spl_image->name), spl_image->name, + spl_image->load_addr, spl_image->size); } else { #ifdef CONFIG_SPL_PANIC_ON_RAW_IMAGE /* @@ -135,13 +136,13 @@ int spl_parse_image_header(const struct image_header *header) ulong start, end; if (!bootz_setup((ulong)header, &start, &end)) { - spl_image.name = "Linux"; - spl_image.os = IH_OS_LINUX; - spl_image.load_addr = CONFIG_SYS_LOAD_ADDR; - spl_image.entry_point = CONFIG_SYS_LOAD_ADDR; - spl_image.size = end - start; + spl_image->name = "Linux"; + spl_image->os = IH_OS_LINUX; + spl_image->load_addr = CONFIG_SYS_LOAD_ADDR; + spl_image->entry_point = CONFIG_SYS_LOAD_ADDR; + spl_image->size = end - start; debug("spl: payload zImage, load addr: 0x%x size: %d\n", - spl_image.load_addr, spl_image.size); + spl_image->load_addr, spl_image->size); return 0; } #endif @@ -153,7 +154,7 @@ int spl_parse_image_header(const struct image_header *header) /* Signature not found - assume u-boot.bin */ debug("mkimage signature not found - ih_magic = %x\n", header->ih_magic); - spl_set_header_raw_uboot(&spl_image); + spl_set_header_raw_uboot(spl_image); #endif } return 0; @@ -209,7 +210,7 @@ static int spl_ram_load_image(void) header = (struct image_header *) (CONFIG_SYS_TEXT_BASE - sizeof(struct image_header)); - spl_parse_image_header(header); + spl_parse_image_header(&spl_image, header); } return 0; |