common: Move bootm_decomp_image() to image.c (as image_decomp())

Upcoming patches want to add decompression to use cases that are no
longer directly related to booting. It makes sense to retain a single
decompression routine, but it should no longer be in bootm.c (which is
not compiled for all configurations). This patch moves
bootm_decomp_image() to image.c and renames it to image_decomp() in
preparation of those upcoming patches.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
[trini: Fix warning around handle_decomp_error being unused]
Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Julius Werner 2019-07-24 19:37:54 -07:00 committed by Tom Rini
parent 75551c8bfc
commit 2090854cd2
5 changed files with 162 additions and 157 deletions

View file

@ -471,15 +471,15 @@ static int run_bootm_test(struct unit_test_state *uts, int comp_type,
unc_len = strlen(plain);
compress(uts, (void *)plain, unc_len, compress_buff, compress_size,
&compress_size);
err = bootm_decomp_image(comp_type, load_addr, image_start,
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
compress_buff, compress_size, unc_len,
&load_end);
err = image_decomp(comp_type, load_addr, image_start,
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
compress_buff, compress_size, unc_len,
&load_end);
ut_assertok(err);
err = bootm_decomp_image(comp_type, load_addr, image_start,
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
compress_buff, compress_size, unc_len - 1,
&load_end);
err = image_decomp(comp_type, load_addr, image_start,
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
compress_buff, compress_size, unc_len - 1,
&load_end);
ut_assert(err);
/* We can't detect corruption when not decompressing */
@ -487,10 +487,10 @@ static int run_bootm_test(struct unit_test_state *uts, int comp_type,
return 0;
memset(compress_buff + compress_size / 2, '\x49',
compress_size / 2);
err = bootm_decomp_image(comp_type, load_addr, image_start,
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
compress_buff, compress_size, 0x10000,
&load_end);
err = image_decomp(comp_type, load_addr, image_start,
IH_TYPE_KERNEL, map_sysmem(load_addr, 0),
compress_buff, compress_size, 0x10000,
&load_end);
ut_assert(err);
return 0;