OSDN Git Service

Merge tag 'drm-misc-next-2020-02-10' of git://anongit.freedesktop.org/drm/drm-misc...
[tomoyo/tomoyo-test1.git] / drivers / gpu / drm / i915 / gt / uc / intel_uc.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2014-2019 Intel Corporation
4  */
5
6 #ifndef _INTEL_UC_H_
7 #define _INTEL_UC_H_
8
9 #include "intel_guc.h"
10 #include "intel_huc.h"
11 #include "i915_params.h"
12
13 struct intel_uc;
14
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);
23 };
24
25 struct intel_uc {
26         struct intel_uc_ops const *ops;
27         struct intel_guc guc;
28         struct intel_huc huc;
29
30         /* Snapshot of GuC log from last failed load */
31         struct drm_i915_gem_object *load_err_log;
32 };
33
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);
42
43 static inline bool intel_uc_supports_guc(struct intel_uc *uc)
44 {
45         return intel_guc_is_supported(&uc->guc);
46 }
47
48 static inline bool intel_uc_uses_guc(struct intel_uc *uc)
49 {
50         return intel_guc_is_enabled(&uc->guc);
51 }
52
53 static inline bool intel_uc_supports_guc_submission(struct intel_uc *uc)
54 {
55         return intel_guc_is_submission_supported(&uc->guc);
56 }
57
58 static inline bool intel_uc_uses_guc_submission(struct intel_uc *uc)
59 {
60         return intel_guc_is_submission_supported(&uc->guc);
61 }
62
63 static inline bool intel_uc_supports_huc(struct intel_uc *uc)
64 {
65         return intel_uc_supports_guc(uc);
66 }
67
68 static inline bool intel_uc_uses_huc(struct intel_uc *uc)
69 {
70         return intel_huc_is_enabled(&uc->huc);
71 }
72
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; \
79 }
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
88
89 #endif