65 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2024 Intel Corporation4 */5 6#ifndef _XE_GUC_KLV_THRESHOLDS_SET_H_7#define _XE_GUC_KLV_THRESHOLDS_SET_H_8 9#include "abi/guc_klvs_abi.h"10#include "xe_guc_klv_helpers.h"11#include "xe_guc_klv_thresholds_set_types.h"12 13/**14 * MAKE_GUC_KLV_VF_CFG_THRESHOLD_KEY - Prepare the name of the KLV key constant.15 * @TAG: unique tag of the GuC threshold KLV key.16 */17#define MAKE_GUC_KLV_VF_CFG_THRESHOLD_KEY(TAG) \18 MAKE_GUC_KLV_KEY(CONCATENATE(VF_CFG_THRESHOLD_, TAG))19 20/**21 * xe_guc_klv_threshold_key_to_index - Find index of the tracked GuC threshold.22 * @key: GuC threshold KLV key.23 *24 * This translation is automatically generated using &MAKE_XE_GUC_KLV_THRESHOLDS_SET.25 * Return: index of the GuC threshold KLV or -1 if not found.26 */27static inline int xe_guc_klv_threshold_key_to_index(u32 key)28{29 switch (key) {30#define define_xe_guc_klv_threshold_key_to_index_case(TAG, ...) \31 \32 case MAKE_GUC_KLV_VF_CFG_THRESHOLD_KEY(TAG): \33 return MAKE_XE_GUC_KLV_THRESHOLD_INDEX(TAG);34 35 /* private: auto-generated case statements */36 MAKE_XE_GUC_KLV_THRESHOLDS_SET(define_xe_guc_klv_threshold_key_to_index_case)37 }38 return -1;39#undef define_xe_guc_klv_threshold_key_to_index_case40}41 42/**43 * xe_guc_klv_threshold_index_to_key - Get tracked GuC threshold KLV key.44 * @index: GuC threshold KLV index.45 *46 * This translation is automatically generated using &MAKE_XE_GUC_KLV_THRESHOLDS_SET.47 * Return: key of the GuC threshold KLV or 0 on malformed index.48 */49static inline u32 xe_guc_klv_threshold_index_to_key(enum xe_guc_klv_threshold_index index)50{51 switch (index) {52#define define_xe_guc_klv_threshold_index_to_key_case(TAG, ...) \53 \54 case MAKE_XE_GUC_KLV_THRESHOLD_INDEX(TAG): \55 return MAKE_GUC_KLV_VF_CFG_THRESHOLD_KEY(TAG);56 57 /* private: auto-generated case statements */58 MAKE_XE_GUC_KLV_THRESHOLDS_SET(define_xe_guc_klv_threshold_index_to_key_case)59 }60 return 0; /* unreachable */61#undef define_xe_guc_klv_threshold_index_to_key_case62}63 64#endif65