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_resume(struct intel_gsc_uc *gsc); 30 void intel_gsc_uc_flush_work(struct intel_gsc_uc *gsc); 31 void intel_gsc_uc_load_start(struct intel_gsc_uc *gsc); 32 33 static inline bool intel_gsc_uc_is_supported(struct intel_gsc_uc *gsc) 34 { 35 return intel_uc_fw_is_supported(&gsc->fw); 36 } 37 38 static inline bool intel_gsc_uc_is_wanted(struct intel_gsc_uc *gsc) 39 { 40 return intel_uc_fw_is_enabled(&gsc->fw); 41 } 42 43 static inline bool intel_gsc_uc_is_used(struct intel_gsc_uc *gsc) 44 { 45 GEM_BUG_ON(__intel_uc_fw_status(&gsc->fw) == INTEL_UC_FIRMWARE_SELECTED); 46 return intel_uc_fw_is_available(&gsc->fw); 47 } 48 49 #endif 50