0001
0002
0003
0004
0005
0006 #ifndef _INTEL_UC_H_
0007 #define _INTEL_UC_H_
0008
0009 #include "intel_guc.h"
0010 #include "intel_guc_rc.h"
0011 #include "intel_guc_submission.h"
0012 #include "intel_guc_slpc.h"
0013 #include "intel_huc.h"
0014 #include "i915_params.h"
0015
0016 struct intel_uc;
0017
0018 struct intel_uc_ops {
0019 int (*sanitize)(struct intel_uc *uc);
0020 void (*init_fw)(struct intel_uc *uc);
0021 void (*fini_fw)(struct intel_uc *uc);
0022 int (*init)(struct intel_uc *uc);
0023 void (*fini)(struct intel_uc *uc);
0024 int (*init_hw)(struct intel_uc *uc);
0025 void (*fini_hw)(struct intel_uc *uc);
0026 };
0027
0028 struct intel_uc {
0029 struct intel_uc_ops const *ops;
0030 struct intel_guc guc;
0031 struct intel_huc huc;
0032
0033
0034 struct drm_i915_gem_object *load_err_log;
0035
0036 bool reset_in_progress;
0037 };
0038
0039 void intel_uc_init_early(struct intel_uc *uc);
0040 void intel_uc_init_late(struct intel_uc *uc);
0041 void intel_uc_driver_late_release(struct intel_uc *uc);
0042 void intel_uc_driver_remove(struct intel_uc *uc);
0043 void intel_uc_init_mmio(struct intel_uc *uc);
0044 void intel_uc_reset_prepare(struct intel_uc *uc);
0045 void intel_uc_reset(struct intel_uc *uc, intel_engine_mask_t stalled);
0046 void intel_uc_reset_finish(struct intel_uc *uc);
0047 void intel_uc_cancel_requests(struct intel_uc *uc);
0048 void intel_uc_suspend(struct intel_uc *uc);
0049 void intel_uc_runtime_suspend(struct intel_uc *uc);
0050 int intel_uc_resume(struct intel_uc *uc);
0051 int intel_uc_runtime_resume(struct intel_uc *uc);
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072
0073
0074 #define __uc_state_checker(x, func, state, required) \
0075 static inline bool intel_uc_##state##_##func(struct intel_uc *uc) \
0076 { \
0077 return intel_##func##_is_##required(&uc->x); \
0078 }
0079
0080 #define uc_state_checkers(x, func) \
0081 __uc_state_checker(x, func, supports, supported) \
0082 __uc_state_checker(x, func, wants, wanted) \
0083 __uc_state_checker(x, func, uses, used)
0084
0085 uc_state_checkers(guc, guc);
0086 uc_state_checkers(huc, huc);
0087 uc_state_checkers(guc, guc_submission);
0088 uc_state_checkers(guc, guc_slpc);
0089 uc_state_checkers(guc, guc_rc);
0090
0091 #undef uc_state_checkers
0092 #undef __uc_state_checker
0093
0094 static inline int intel_uc_wait_for_idle(struct intel_uc *uc, long timeout)
0095 {
0096 return intel_guc_wait_for_idle(&uc->guc, timeout);
0097 }
0098
0099 #define intel_uc_ops_function(_NAME, _OPS, _TYPE, _RET) \
0100 static inline _TYPE intel_uc_##_NAME(struct intel_uc *uc) \
0101 { \
0102 if (uc->ops->_OPS) \
0103 return uc->ops->_OPS(uc); \
0104 return _RET; \
0105 }
0106 intel_uc_ops_function(sanitize, sanitize, int, 0);
0107 intel_uc_ops_function(fetch_firmwares, init_fw, void, );
0108 intel_uc_ops_function(cleanup_firmwares, fini_fw, void, );
0109 intel_uc_ops_function(init, init, int, 0);
0110 intel_uc_ops_function(fini, fini, void, );
0111 intel_uc_ops_function(init_hw, init_hw, int, 0);
0112 intel_uc_ops_function(fini_hw, fini_hw, void, );
0113 #undef intel_uc_ops_function
0114
0115 #endif