2 * Copyright © 2014-2017 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 #ifndef _INTEL_UC_FW_H_
26 #define _INTEL_UC_FW_H_
29 struct drm_i915_private
;
32 /* Home of GuC, HuC and DMC firmwares */
33 #define INTEL_UC_FIRMWARE_URL "https://01.org/linuxgraphics/downloads/firmware"
35 enum intel_uc_fw_status
{
36 INTEL_UC_FIRMWARE_FAIL
= -1,
37 INTEL_UC_FIRMWARE_NONE
= 0,
38 INTEL_UC_FIRMWARE_PENDING
,
39 INTEL_UC_FIRMWARE_SUCCESS
42 enum intel_uc_fw_type
{
48 * This structure encapsulates all the data needed during the process
49 * of fetching, caching, and loading the firmware image into the uC.
54 struct drm_i915_gem_object
*obj
;
55 enum intel_uc_fw_status fetch_status
;
56 enum intel_uc_fw_status load_status
;
59 * The firmware build process will generate a version header file with major and
60 * minor version defined. The versions are built into CSS header of firmware.
61 * i915 kernel driver set the minimal firmware version required per platform.
68 enum intel_uc_fw_type type
;
78 const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status
)
81 case INTEL_UC_FIRMWARE_FAIL
:
83 case INTEL_UC_FIRMWARE_NONE
:
85 case INTEL_UC_FIRMWARE_PENDING
:
87 case INTEL_UC_FIRMWARE_SUCCESS
:
93 static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type
)
96 case INTEL_UC_FW_TYPE_GUC
:
98 case INTEL_UC_FW_TYPE_HUC
:
105 void intel_uc_fw_init(struct intel_uc_fw
*uc_fw
, enum intel_uc_fw_type type
)
108 uc_fw
->fetch_status
= INTEL_UC_FIRMWARE_NONE
;
109 uc_fw
->load_status
= INTEL_UC_FIRMWARE_NONE
;
113 void intel_uc_fw_fetch(struct drm_i915_private
*dev_priv
,
114 struct intel_uc_fw
*uc_fw
);
115 int intel_uc_fw_upload(struct intel_uc_fw
*uc_fw
,
116 int (*xfer
)(struct intel_uc_fw
*uc_fw
,
117 struct i915_vma
*vma
));
118 void intel_uc_fw_fini(struct intel_uc_fw
*uc_fw
);
119 void intel_uc_fw_dump(struct intel_uc_fw
*uc_fw
, struct drm_printer
*p
);