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 struct i915_gsc_proxy_component; 14 15 struct intel_gsc_uc { 16 /* Generic uC firmware management */ 17 struct intel_uc_fw fw; 18 19 /* GSC-specific additions */ 20 struct i915_vma *local; /* private memory for GSC usage */ 21 struct intel_context *ce; /* for submission to GSC FW via GSC engine */ 22 23 /* for delayed load and proxy handling */ 24 struct workqueue_struct *wq; 25 struct work_struct work; 26 u32 gsc_work_actions; /* protected by gt->irq_lock */ 27 #define GSC_ACTION_FW_LOAD BIT(0) 28 #define GSC_ACTION_SW_PROXY BIT(1) 29 30 struct { 31 struct i915_gsc_proxy_component *component; 32 bool component_added; 33 struct i915_vma *vma; 34 void *to_gsc; 35 void *to_csme; 36 struct mutex mutex; /* protects the tee channel binding */ 37 } proxy; 38 }; 39 40 void intel_gsc_uc_init_early(struct intel_gsc_uc *gsc); 41 int intel_gsc_uc_init(struct intel_gsc_uc *gsc); 42 void intel_gsc_uc_fini(struct intel_gsc_uc *gsc); 43 void intel_gsc_uc_suspend(struct intel_gsc_uc *gsc); 44 void intel_gsc_uc_resume(struct intel_gsc_uc *gsc); 45 void intel_gsc_uc_flush_work(struct intel_gsc_uc *gsc); 46 void intel_gsc_uc_load_start(struct intel_gsc_uc *gsc); 47 48 static inline bool intel_gsc_uc_is_supported(struct intel_gsc_uc *gsc) 49 { 50 return intel_uc_fw_is_supported(&gsc->fw); 51 } 52 53 static inline bool intel_gsc_uc_is_wanted(struct intel_gsc_uc *gsc) 54 { 55 return intel_uc_fw_is_enabled(&gsc->fw); 56 } 57 58 static inline bool intel_gsc_uc_is_used(struct intel_gsc_uc *gsc) 59 { 60 GEM_BUG_ON(__intel_uc_fw_status(&gsc->fw) == INTEL_UC_FIRMWARE_SELECTED); 61 return intel_uc_fw_is_available(&gsc->fw); 62 } 63 64 #endif 65