lib: gunzip: add hw gunzip support
Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Change-Id: I52b6d090fdc7d535a4b0804826f5669c068464dc
This commit is contained in:
parent
0b61b557de
commit
f7a20b1263
11
lib/gunzip.c
11
lib/gunzip.c
|
|
@ -12,6 +12,7 @@
|
||||||
#include <image.h>
|
#include <image.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <memalign.h>
|
#include <memalign.h>
|
||||||
|
#include <misc.h>
|
||||||
#include <u-boot/zlib.h>
|
#include <u-boot/zlib.h>
|
||||||
#include <div64.h>
|
#include <div64.h>
|
||||||
|
|
||||||
|
|
@ -77,6 +78,16 @@ int gunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp)
|
||||||
if (offset < 0)
|
if (offset < 0)
|
||||||
return offset;
|
return offset;
|
||||||
|
|
||||||
|
#if defined(CONFIG_MISC_DECOMPRESS) && !defined(CONFIG_SPL_BUILD)
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = misc_decompress_process((ulong)dst, (ulong)src, *lenp,
|
||||||
|
DECOM_GZIP, true, (u64 *)lenp);
|
||||||
|
if (!ret)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
printf("hw gunzip failed(%d), fallback to soft gunzip\n", ret);
|
||||||
|
#endif
|
||||||
return zunzip(dst, dstlen, src, lenp, 1, offset);
|
return zunzip(dst, dstlen, src, lenp, 1, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue