brintos

brintos / linux-shallow public Read only

0
0
Text · 2.4 KiB · d6228ba Raw
94 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2023 Intel Corporation4 */5 6#ifndef _XE_GT_PRINTK_H_7#define _XE_GT_PRINTK_H_8 9#include <drm/drm_print.h>10 11#include "xe_device_types.h"12 13#define xe_gt_printk(_gt, _level, _fmt, ...) \14	drm_##_level(&gt_to_xe(_gt)->drm, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__)15 16#define xe_gt_err_once(_gt, _fmt, ...) \17	xe_gt_printk((_gt), err_once, _fmt, ##__VA_ARGS__)18 19#define xe_gt_err(_gt, _fmt, ...) \20	xe_gt_printk((_gt), err, _fmt, ##__VA_ARGS__)21 22#define xe_gt_warn(_gt, _fmt, ...) \23	xe_gt_printk((_gt), warn, _fmt, ##__VA_ARGS__)24 25#define xe_gt_notice(_gt, _fmt, ...) \26	xe_gt_printk((_gt), notice, _fmt, ##__VA_ARGS__)27 28#define xe_gt_info(_gt, _fmt, ...) \29	xe_gt_printk((_gt), info, _fmt, ##__VA_ARGS__)30 31#define xe_gt_dbg(_gt, _fmt, ...) \32	xe_gt_printk((_gt), dbg, _fmt, ##__VA_ARGS__)33 34#define xe_gt_err_ratelimited(_gt, _fmt, ...) \35	xe_gt_printk((_gt), err_ratelimited, _fmt, ##__VA_ARGS__)36 37#define xe_gt_WARN(_gt, _condition, _fmt, ...) \38	drm_WARN(&gt_to_xe(_gt)->drm, _condition, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__)39 40#define xe_gt_WARN_ONCE(_gt, _condition, _fmt, ...) \41	drm_WARN_ONCE(&gt_to_xe(_gt)->drm, _condition, "GT%u: " _fmt, (_gt)->info.id, ##__VA_ARGS__)42 43#define xe_gt_WARN_ON(_gt, _condition) \44	xe_gt_WARN((_gt), _condition, "%s(%s)", "gt_WARN_ON", __stringify(_condition))45 46#define xe_gt_WARN_ON_ONCE(_gt, _condition) \47	xe_gt_WARN_ONCE((_gt), _condition, "%s(%s)", "gt_WARN_ON_ONCE", __stringify(_condition))48 49static inline void __xe_gt_printfn_err(struct drm_printer *p, struct va_format *vaf)50{51	struct xe_gt *gt = p->arg;52 53	xe_gt_err(gt, "%pV", vaf);54}55 56static inline void __xe_gt_printfn_info(struct drm_printer *p, struct va_format *vaf)57{58	struct xe_gt *gt = p->arg;59 60	xe_gt_info(gt, "%pV", vaf);61}62 63/**64 * xe_gt_err_printer - Construct a &drm_printer that outputs to xe_gt_err()65 * @gt: the &xe_gt pointer to use in xe_gt_err()66 *67 * Return: The &drm_printer object.68 */69static inline struct drm_printer xe_gt_err_printer(struct xe_gt *gt)70{71	struct drm_printer p = {72		.printfn = __xe_gt_printfn_err,73		.arg = gt,74	};75	return p;76}77 78/**79 * xe_gt_info_printer - Construct a &drm_printer that outputs to xe_gt_info()80 * @gt: the &xe_gt pointer to use in xe_gt_info()81 *82 * Return: The &drm_printer object.83 */84static inline struct drm_printer xe_gt_info_printer(struct xe_gt *gt)85{86	struct drm_printer p = {87		.printfn = __xe_gt_printfn_info,88		.arg = gt,89	};90	return p;91}92 93#endif94