1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright �� 2023 Intel Corporation
4 */
5
6#ifndef _XE_ENGINE_CLASS_SYSFS_H_
7#define _XE_ENGINE_CLASS_SYSFS_H_
8
9#include <linux/kobject.h>
10
11struct xe_gt;
12struct xe_hw_engine_class_intf;
13
14int xe_hw_engine_class_sysfs_init(struct xe_gt *gt);
15bool xe_hw_engine_timeout_in_range(u64 timeout, u64 min, u64 max);
16
17/**
18 * struct kobj_eclass - A eclass's kobject struct that connects the kobject and the
19 * eclass.
20 *
21 * When dealing with multiple eclass, this struct helps to understand which eclass
22 * needs to be addressed on a given sysfs call.
23 */
24struct kobj_eclass {
25	/** @base: The actual kobject */
26	struct kobject base;
27	/** @eclass: A pointer to the hw engine class interface */
28	struct xe_hw_engine_class_intf *eclass;
29};
30
31static inline struct xe_hw_engine_class_intf *kobj_to_eclass(struct kobject *kobj)
32{
33	return container_of(kobj, struct kobj_eclass, base)->eclass;
34}
35
36#endif
37