forked from Minki/linux
c65e6815db
Add the new kernel command line parameter 'dfltcc=' to configure s390 zlib hardware support. Format: { on | off | def_only | inf_only | always } on: s390 zlib hardware support for compression on level 1 and decompression (default) off: No s390 zlib hardware support def_only: s390 zlib hardware support for deflate only (compression on level 1) inf_only: s390 zlib hardware support for inflate only (decompression) always: Same as 'on' but ignores the selected compression level always using hardware support (used for debugging) Link: http://lkml.kernel.org/r/20200103223334.20669-5-zaslonko@linux.ibm.com Signed-off-by: Mikhail Zaslonko <zaslonko@linux.ibm.com> Cc: Chris Mason <clm@fb.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: David Sterba <dsterba@suse.com> Cc: Eduard Shishkin <edward6@linux.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Ilya Leoshkevich <iii@linux.ibm.com> Cc: Josef Bacik <josef@toxicpanda.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
56 lines
1.6 KiB
C
56 lines
1.6 KiB
C
// SPDX-License-Identifier: Zlib
|
|
/* dfltcc.c - SystemZ DEFLATE CONVERSION CALL support. */
|
|
|
|
#include <linux/zutil.h>
|
|
#include "dfltcc_util.h"
|
|
#include "dfltcc.h"
|
|
|
|
char *oesc_msg(
|
|
char *buf,
|
|
int oesc
|
|
)
|
|
{
|
|
if (oesc == 0x00)
|
|
return NULL; /* Successful completion */
|
|
else {
|
|
#ifdef STATIC
|
|
return NULL; /* Ignore for pre-boot decompressor */
|
|
#else
|
|
sprintf(buf, "Operation-Ending-Supplemental Code is 0x%.2X", oesc);
|
|
return buf;
|
|
#endif
|
|
}
|
|
}
|
|
|
|
void dfltcc_reset(
|
|
z_streamp strm,
|
|
uInt size
|
|
)
|
|
{
|
|
struct dfltcc_state *dfltcc_state =
|
|
(struct dfltcc_state *)((char *)strm->state + size);
|
|
struct dfltcc_qaf_param *param =
|
|
(struct dfltcc_qaf_param *)&dfltcc_state->param;
|
|
|
|
/* Initialize available functions */
|
|
if (is_dfltcc_enabled()) {
|
|
dfltcc(DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL);
|
|
memmove(&dfltcc_state->af, param, sizeof(dfltcc_state->af));
|
|
} else
|
|
memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af));
|
|
|
|
/* Initialize parameter block */
|
|
memset(&dfltcc_state->param, 0, sizeof(dfltcc_state->param));
|
|
dfltcc_state->param.nt = 1;
|
|
|
|
/* Initialize tuning parameters */
|
|
if (zlib_dfltcc_support == ZLIB_DFLTCC_FULL_DEBUG)
|
|
dfltcc_state->level_mask = DFLTCC_LEVEL_MASK_DEBUG;
|
|
else
|
|
dfltcc_state->level_mask = DFLTCC_LEVEL_MASK;
|
|
dfltcc_state->block_size = DFLTCC_BLOCK_SIZE;
|
|
dfltcc_state->block_threshold = DFLTCC_FIRST_FHT_BLOCK_SIZE;
|
|
dfltcc_state->dht_threshold = DFLTCC_DHT_MIN_SAMPLE_SIZE;
|
|
dfltcc_state->param.ribm = DFLTCC_RIBM;
|
|
}
|