treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / gt / uc / intel_uc.h
blob49c91352468627566e46d2f0afc8573c4f25ce93
1 /* SPDX-License-Identifier: MIT */
2 /*
3 * Copyright © 2014-2019 Intel Corporation
4 */
6 #ifndef _INTEL_UC_H_
7 #define _INTEL_UC_H_
9 #include "intel_guc.h"
10 #include "intel_huc.h"
11 #include "i915_params.h"
13 struct intel_uc;
15 struct intel_uc_ops {
16 int (*sanitize)(struct intel_uc *uc);
17 void (*init_fw)(struct intel_uc *uc);
18 void (*fini_fw)(struct intel_uc *uc);
19 void (*init)(struct intel_uc *uc);
20 void (*fini)(struct intel_uc *uc);
21 int (*init_hw)(struct intel_uc *uc);
22 void (*fini_hw)(struct intel_uc *uc);
25 struct intel_uc {
26 struct intel_uc_ops const *ops;
27 struct intel_guc guc;
28 struct intel_huc huc;
30 /* Snapshot of GuC log from last failed load */
31 struct drm_i915_gem_object *load_err_log;
34 void intel_uc_init_early(struct intel_uc *uc);
35 void intel_uc_driver_late_release(struct intel_uc *uc);
36 void intel_uc_init_mmio(struct intel_uc *uc);
37 void intel_uc_reset_prepare(struct intel_uc *uc);
38 void intel_uc_suspend(struct intel_uc *uc);
39 void intel_uc_runtime_suspend(struct intel_uc *uc);
40 int intel_uc_resume(struct intel_uc *uc);
41 int intel_uc_runtime_resume(struct intel_uc *uc);
43 static inline bool intel_uc_supports_guc(struct intel_uc *uc)
45 return intel_guc_is_supported(&uc->guc);
48 static inline bool intel_uc_uses_guc(struct intel_uc *uc)
50 return intel_guc_is_enabled(&uc->guc);
53 static inline bool intel_uc_supports_guc_submission(struct intel_uc *uc)
55 return intel_guc_is_submission_supported(&uc->guc);
58 static inline bool intel_uc_uses_guc_submission(struct intel_uc *uc)
60 return intel_guc_is_submission_supported(&uc->guc);
63 static inline bool intel_uc_supports_huc(struct intel_uc *uc)
65 return intel_uc_supports_guc(uc);
68 static inline bool intel_uc_uses_huc(struct intel_uc *uc)
70 return intel_huc_is_enabled(&uc->huc);
73 #define intel_uc_ops_function(_NAME, _OPS, _TYPE, _RET) \
74 static inline _TYPE intel_uc_##_NAME(struct intel_uc *uc) \
75 { \
76 if (uc->ops->_OPS) \
77 return uc->ops->_OPS(uc); \
78 return _RET; \
80 intel_uc_ops_function(sanitize, sanitize, int, 0);
81 intel_uc_ops_function(fetch_firmwares, init_fw, void, );
82 intel_uc_ops_function(cleanup_firmwares, fini_fw, void, );
83 intel_uc_ops_function(init, init, void, );
84 intel_uc_ops_function(fini, fini, void, );
85 intel_uc_ops_function(init_hw, init_hw, int, 0);
86 intel_uc_ops_function(fini_hw, fini_hw, void, );
87 #undef intel_uc_ops_function
89 #endif