1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5 
6 #ifndef _INTEL_GSC_UC_H_
7 #define _INTEL_GSC_UC_H_
8 
9 #include "intel_uc_fw.h"
10 
11 struct i915_vma;
12 struct intel_context;
13 
14 struct intel_gsc_uc {
15 	/* Generic uC firmware management */
16 	struct intel_uc_fw fw;
17 
18 	/* GSC-specific additions */
19 	struct i915_vma *local; /* private memory for GSC usage */
20 	struct intel_context *ce; /* for submission to GSC FW via GSC engine */
21 
22 	struct work_struct work; /* for delayed load */
23 };
24 
25 void intel_gsc_uc_init_early(struct intel_gsc_uc *gsc);
26 int intel_gsc_uc_init(struct intel_gsc_uc *gsc);
27 void intel_gsc_uc_fini(struct intel_gsc_uc *gsc);
28 void intel_gsc_uc_suspend(struct intel_gsc_uc *gsc);
29 void intel_gsc_uc_load_start(struct intel_gsc_uc *gsc);
30 
31 static inline bool intel_gsc_uc_is_supported(struct intel_gsc_uc *gsc)
32 {
33 	return intel_uc_fw_is_supported(&gsc->fw);
34 }
35 
36 static inline bool intel_gsc_uc_is_wanted(struct intel_gsc_uc *gsc)
37 {
38 	return intel_uc_fw_is_enabled(&gsc->fw);
39 }
40 
41 static inline bool intel_gsc_uc_is_used(struct intel_gsc_uc *gsc)
42 {
43 	GEM_BUG_ON(__intel_uc_fw_status(&gsc->fw) == INTEL_UC_FIRMWARE_SELECTED);
44 	return intel_uc_fw_is_available(&gsc->fw);
45 }
46 
47 #endif
48