Linux Audio
Check our new training course
Embedded Linux Audio
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
/* SPDX-License-Identifier: MIT */ /* * Copyright © 2014-2019 Intel Corporation */ #ifndef _INTEL_HUC_H_ #define _INTEL_HUC_H_ #include "i915_reg_defs.h" #include "i915_sw_fence.h" #include "intel_uc_fw.h" #include "intel_huc_fw.h" #include <linux/notifier.h> #include <linux/hrtimer.h> struct bus_type; enum intel_huc_delayed_load_status { INTEL_HUC_WAITING_ON_GSC = 0, INTEL_HUC_WAITING_ON_PXP, INTEL_HUC_DELAYED_LOAD_ERROR, }; struct intel_huc { /* Generic uC firmware management */ struct intel_uc_fw fw; /* HuC-specific additions */ struct { i915_reg_t reg; u32 mask; u32 value; } status; struct { struct i915_sw_fence fence; struct hrtimer timer; struct notifier_block nb; enum intel_huc_delayed_load_status status; } delayed_load; }; void intel_huc_init_early(struct intel_huc *huc); int intel_huc_init(struct intel_huc *huc); void intel_huc_fini(struct intel_huc *huc); void intel_huc_suspend(struct intel_huc *huc); int intel_huc_auth(struct intel_huc *huc); int intel_huc_wait_for_auth_complete(struct intel_huc *huc); int intel_huc_check_status(struct intel_huc *huc); void intel_huc_update_auth_status(struct intel_huc *huc); bool intel_huc_is_authenticated(struct intel_huc *huc); void intel_huc_register_gsc_notifier(struct intel_huc *huc, struct bus_type *bus); void intel_huc_unregister_gsc_notifier(struct intel_huc *huc, struct bus_type *bus); static inline int intel_huc_sanitize(struct intel_huc *huc) { intel_uc_fw_sanitize(&huc->fw); return 0; } static inline bool intel_huc_is_supported(struct intel_huc *huc) { return intel_uc_fw_is_supported(&huc->fw); } static inline bool intel_huc_is_wanted(struct intel_huc *huc) { return intel_uc_fw_is_enabled(&huc->fw); } static inline bool intel_huc_is_used(struct intel_huc *huc) { GEM_BUG_ON(__intel_uc_fw_status(&huc->fw) == INTEL_UC_FIRMWARE_SELECTED); return intel_uc_fw_is_available(&huc->fw); } static inline bool intel_huc_is_loaded_by_gsc(const struct intel_huc *huc) { return huc->fw.loaded_via_gsc; } static inline bool intel_huc_wait_required(struct intel_huc *huc) { return intel_huc_is_used(huc) && intel_huc_is_loaded_by_gsc(huc) && !intel_huc_is_authenticated(huc); } void intel_huc_load_status(struct intel_huc *huc, struct drm_printer *p); #endif