1
2
3
4
5
6#ifndef _INTEL_UC_H_
7#define _INTEL_UC_H_
8
9#include "intel_guc.h"
10#include "intel_guc_rc.h"
11#include "intel_guc_submission.h"
12#include "intel_guc_slpc.h"
13#include "intel_huc.h"
14#include "i915_params.h"
15
16struct intel_uc;
17
18struct intel_uc_ops {
19 int (*sanitize)(struct intel_uc *uc);
20 void (*init_fw)(struct intel_uc *uc);
21 void (*fini_fw)(struct intel_uc *uc);
22 int (*init)(struct intel_uc *uc);
23 void (*fini)(struct intel_uc *uc);
24 int (*init_hw)(struct intel_uc *uc);
25 void (*fini_hw)(struct intel_uc *uc);
26};
27
28struct intel_uc {
29 struct intel_uc_ops const *ops;
30 struct intel_guc guc;
31 struct intel_huc huc;
32
33
34 struct drm_i915_gem_object *load_err_log;
35
36 bool reset_in_progress;
37};
38
39void intel_uc_init_early(struct intel_uc *uc);
40void intel_uc_init_late(struct intel_uc *uc);
41void intel_uc_driver_late_release(struct intel_uc *uc);
42void intel_uc_driver_remove(struct intel_uc *uc);
43void intel_uc_init_mmio(struct intel_uc *uc);
44void intel_uc_reset_prepare(struct intel_uc *uc);
45void intel_uc_reset(struct intel_uc *uc, bool stalled);
46void intel_uc_reset_finish(struct intel_uc *uc);
47void intel_uc_cancel_requests(struct intel_uc *uc);
48void intel_uc_suspend(struct intel_uc *uc);
49void intel_uc_runtime_suspend(struct intel_uc *uc);
50int intel_uc_resume(struct intel_uc *uc);
51int intel_uc_runtime_resume(struct intel_uc *uc);
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74#define __uc_state_checker(x, func, state, required) \
75static inline bool intel_uc_##state##_##func(struct intel_uc *uc) \
76{ \
77 return intel_##func##_is_##required(&uc->x); \
78}
79
80#define uc_state_checkers(x, func) \
81__uc_state_checker(x, func, supports, supported) \
82__uc_state_checker(x, func, wants, wanted) \
83__uc_state_checker(x, func, uses, used)
84
85uc_state_checkers(guc, guc);
86uc_state_checkers(huc, huc);
87uc_state_checkers(guc, guc_submission);
88uc_state_checkers(guc, guc_slpc);
89uc_state_checkers(guc, guc_rc);
90
91#undef uc_state_checkers
92#undef __uc_state_checker
93
94static inline int intel_uc_wait_for_idle(struct intel_uc *uc, long timeout)
95{
96 return intel_guc_wait_for_idle(&uc->guc, timeout);
97}
98
99#define intel_uc_ops_function(_NAME, _OPS, _TYPE, _RET) \
100static inline _TYPE intel_uc_##_NAME(struct intel_uc *uc) \
101{ \
102 if (uc->ops->_OPS) \
103 return uc->ops->_OPS(uc); \
104 return _RET; \
105}
106intel_uc_ops_function(sanitize, sanitize, int, 0);
107intel_uc_ops_function(fetch_firmwares, init_fw, void, );
108intel_uc_ops_function(cleanup_firmwares, fini_fw, void, );
109intel_uc_ops_function(init, init, int, 0);
110intel_uc_ops_function(fini, fini, void, );
111intel_uc_ops_function(init_hw, init_hw, int, 0);
112intel_uc_ops_function(fini_hw, fini_hw, void, );
113#undef intel_uc_ops_function
114
115#endif
116