diff options
author | Marian Balakowicz <m8@semihalf.com> | 2008-02-29 16:00:06 +0100 |
---|---|---|
committer | Marian Balakowicz <m8@semihalf.com> | 2008-02-29 16:00:06 +0100 |
commit | df6f1b895c997978f03afe04502ee76b7ba34ab9 (patch) | |
tree | 5d52f93b01448828e3a624b2469c253a2bc9de2a /common/image.c | |
parent | 570abb0ad120f6002bcaa3cf6f32bd4ca2e1b248 (diff) | |
download | u-boot-imx-df6f1b895c997978f03afe04502ee76b7ba34ab9.zip u-boot-imx-df6f1b895c997978f03afe04502ee76b7ba34ab9.tar.gz u-boot-imx-df6f1b895c997978f03afe04502ee76b7ba34ab9.tar.bz2 |
[new uImage] Fix component handling for legacy multi component images
Use uint32_t when accessing size table in image_multi_count() and
image_multi_getimg() for multi component images.
Add missing uimage_to_cpu() endianness conversion.
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
Diffstat (limited to 'common/image.c')
-rw-r--r-- | common/image.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/common/image.c b/common/image.c index 421a474..3911b2f 100644 --- a/common/image.c +++ b/common/image.c @@ -224,11 +224,11 @@ int image_check_dcrc_wd (image_header_t *hdr, ulong chunksz) ulong image_multi_count (image_header_t *hdr) { ulong i, count = 0; - ulong *size; + uint32_t *size; /* get start of the image payload, which in case of multi * component images that points to a table of component sizes */ - size = (ulong *)image_get_data (hdr); + size = (uint32_t *)image_get_data (hdr); /* count non empty slots */ for (i = 0; size[i]; ++i) @@ -258,7 +258,7 @@ void image_multi_getimg (image_header_t *hdr, ulong idx, ulong *data, ulong *len) { int i; - ulong *size; + uint32_t *size; ulong offset, tail, count, img_data; /* get number of component */ @@ -266,24 +266,24 @@ void image_multi_getimg (image_header_t *hdr, ulong idx, /* get start of the image payload, which in case of multi * component images that points to a table of component sizes */ - size = (ulong *)image_get_data (hdr); + size = (uint32_t *)image_get_data (hdr); /* get address of the proper component data start, which means * skipping sizes table (add 1 for last, null entry) */ - img_data = image_get_data (hdr) + (count + 1) * sizeof (ulong); + img_data = image_get_data (hdr) + (count + 1) * sizeof (uint32_t); if (idx < count) { - *len = size[idx]; + *len = uimage_to_cpu (size[idx]); offset = 0; tail = 0; /* go over all indices preceding requested component idx */ for (i = 0; i < idx; i++) { /* add up i-th component size */ - offset += size[i]; + offset += uimage_to_cpu (size[i]); /* add up alignment for i-th component */ - tail += (4 - size[i] % 4); + tail += (4 - uimage_to_cpu (size[i]) % 4); } /* calculate idx-th component data address */ |