File Index
Files and directories
Sign in
FILE

adf_pm_dbgfs_utils.c

File preview with syntax highlighting.

linux-6.19.14/drivers/crypto/intel/qat/qat_common/adf_pm_dbgfs_utils.c C
 1// SPDX-License-Identifier: GPL-2.0-only
 2/* Copyright(c) 2025 Intel Corporation */
 3#include <linux/bitfield.h>
 4#include <linux/bitops.h>
 5#include <linux/sprintf.h>
 6#include <linux/string_helpers.h>
 7
 8#include "adf_pm_dbgfs_utils.h"
 9
10#define PM_INFO_MAX_KEY_LEN	21
11
12static int pm_scnprint_table(char *buff, const struct pm_status_row *table,
13			     u32 *pm_info_regs, size_t buff_size, int table_len,
14			     bool lowercase)
15{
16	char key[PM_INFO_MAX_KEY_LEN];
17	int wr = 0;
18	int i;
19
20	for (i = 0; i < table_len; i++) {
21		if (lowercase)
22			string_lower(key, table[i].key);
23		else
24			string_upper(key, table[i].key);
25
26		wr += scnprintf(&buff[wr], buff_size - wr, "%s: %#x\n", key,
27				field_get(table[i].field_mask,
28					  pm_info_regs[table[i].reg_offset]));
29	}
30
31	return wr;
32}
33
34int adf_pm_scnprint_table_upper_keys(char *buff, const struct pm_status_row *table,
35				     u32 *pm_info_regs, size_t buff_size, int table_len)
36{
37	return pm_scnprint_table(buff, table, pm_info_regs, buff_size,
38				 table_len, false);
39}
40
41int adf_pm_scnprint_table_lower_keys(char *buff, const struct pm_status_row *table,
42				     u32 *pm_info_regs, size_t buff_size, int table_len)
43{
44	return pm_scnprint_table(buff, table, pm_info_regs, buff_size,
45				 table_len, true);
46}
~/ Read-only file preview.