Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.9.4.
 1/* SPDX-License-Identifier: MIT */
 2/*
 3 * Copyright © 2024 Intel Corporation
 4 */
 5
 6#ifndef _XE_GUC_KLV_HELPERS_H_
 7#define _XE_GUC_KLV_HELPERS_H_
 8
 9#include <linux/args.h>
10#include <linux/types.h>
11
12struct drm_printer;
13
14const char *xe_guc_klv_key_to_string(u16 key);
15
16void xe_guc_klv_print(const u32 *klvs, u32 num_dwords, struct drm_printer *p);
17int xe_guc_klv_count(const u32 *klvs, u32 num_dwords);
18
19/**
20 * PREP_GUC_KLV - Prepare KLV header value based on provided key and len.
21 * @key: KLV key
22 * @len: KLV length
23 *
24 * Return: value of the KLV header (u32).
25 */
26#define PREP_GUC_KLV(key, len) \
27	(FIELD_PREP(GUC_KLV_0_KEY, (key)) | \
28	 FIELD_PREP(GUC_KLV_0_LEN, (len)))
29
30/**
31 * PREP_GUC_KLV_CONST - Prepare KLV header value based on const key and len.
32 * @key: const KLV key
33 * @len: const KLV length
34 *
35 * Return: value of the KLV header (u32).
36 */
37#define PREP_GUC_KLV_CONST(key, len) \
38	(FIELD_PREP_CONST(GUC_KLV_0_KEY, (key)) | \
39	 FIELD_PREP_CONST(GUC_KLV_0_LEN, (len)))
40
41/**
42 * MAKE_GUC_KLV_KEY - Prepare KLV KEY name based on unique KLV definition tag.
43 * @TAG: unique tag of the KLV definition
44 */
45#define MAKE_GUC_KLV_KEY(TAG) CONCATENATE(CONCATENATE(GUC_KLV_, TAG), _KEY)
46
47/**
48 * MAKE_GUC_KLV_LEN - Prepare KLV LEN name based on unique KLV definition tag.
49 * @TAG: unique tag of the KLV definition
50 */
51#define MAKE_GUC_KLV_LEN(TAG) CONCATENATE(CONCATENATE(GUC_KLV_, TAG), _LEN)
52
53/**
54 * PREP_GUC_KLV_TAG - Prepare KLV header value based on unique KLV definition tag.
55 * @TAG: unique tag of the KLV definition
56 *
57 * Combine separate KEY and LEN definitions of the KLV identified by the TAG.
58 *
59 * Return: value of the KLV header (u32).
60 */
61#define PREP_GUC_KLV_TAG(TAG) \
62	PREP_GUC_KLV_CONST(MAKE_GUC_KLV_KEY(TAG), MAKE_GUC_KLV_LEN(TAG))
63
64#endif