xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/i915/gt/uc/intel_huc.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: intel_huc.h,v 1.2 2021/12/18 23:45:31 riastradh Exp $	*/
2 
3 /* SPDX-License-Identifier: MIT */
4 /*
5  * Copyright © 2014-2019 Intel Corporation
6  */
7 
8 #ifndef _INTEL_HUC_H_
9 #define _INTEL_HUC_H_
10 
11 #include "i915_reg.h"
12 #include "intel_uc_fw.h"
13 #include "intel_huc_fw.h"
14 
15 struct intel_huc {
16 	/* Generic uC firmware management */
17 	struct intel_uc_fw fw;
18 
19 	/* HuC-specific additions */
20 	struct i915_vma *rsa_data;
21 
22 	struct {
23 		i915_reg_t reg;
24 		u32 mask;
25 		u32 value;
26 	} status;
27 };
28 
29 void intel_huc_init_early(struct intel_huc *huc);
30 int intel_huc_init(struct intel_huc *huc);
31 void intel_huc_fini(struct intel_huc *huc);
32 int intel_huc_auth(struct intel_huc *huc);
33 int intel_huc_check_status(struct intel_huc *huc);
34 
intel_huc_sanitize(struct intel_huc * huc)35 static inline int intel_huc_sanitize(struct intel_huc *huc)
36 {
37 	intel_uc_fw_sanitize(&huc->fw);
38 	return 0;
39 }
40 
intel_huc_is_supported(struct intel_huc * huc)41 static inline bool intel_huc_is_supported(struct intel_huc *huc)
42 {
43 	return intel_uc_fw_is_supported(&huc->fw);
44 }
45 
intel_huc_is_enabled(struct intel_huc * huc)46 static inline bool intel_huc_is_enabled(struct intel_huc *huc)
47 {
48 	return intel_uc_fw_is_enabled(&huc->fw);
49 }
50 
intel_huc_is_authenticated(struct intel_huc * huc)51 static inline bool intel_huc_is_authenticated(struct intel_huc *huc)
52 {
53 	return intel_uc_fw_is_running(&huc->fw);
54 }
55 
56 #endif
57