1 // SPDX-License-Identifier: MIT 2 /* 3 * Copyright © 2014-2019 Intel Corporation 4 */ 5 6 #include "gt/intel_gt.h" 7 #include "intel_huc_fw.h" 8 #include "i915_drv.h" 9 10 /** 11 * DOC: HuC Firmware 12 * 13 * Motivation: 14 * GEN9 introduces a new dedicated firmware for usage in media HEVC (High 15 * Efficiency Video Coding) operations. Userspace can use the firmware 16 * capabilities by adding HuC specific commands to batch buffers. 17 * 18 * Implementation: 19 * The same firmware loader is used as the GuC. However, the actual 20 * loading to HW is deferred until GEM initialization is done. 21 * 22 * Note that HuC firmware loading must be done before GuC loading. 23 */ 24 25 /** 26 * intel_huc_fw_init_early() - initializes HuC firmware struct 27 * @huc: intel_huc struct 28 * 29 * On platforms with HuC selects firmware for uploading 30 */ 31 void intel_huc_fw_init_early(struct intel_huc *huc) 32 { 33 struct intel_gt *gt = huc_to_gt(huc); 34 struct intel_uc *uc = >->uc; 35 struct drm_i915_private *i915 = gt->i915; 36 37 intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC, 38 intel_uc_uses_guc(uc), 39 INTEL_INFO(i915)->platform, INTEL_REVID(i915)); 40 } 41 42 /** 43 * intel_huc_fw_upload() - load HuC uCode to device 44 * @huc: intel_huc structure 45 * 46 * Called from intel_uc_init_hw() during driver load, resume from sleep and 47 * after a GPU reset. Note that HuC must be loaded before GuC. 48 * 49 * The firmware image should have already been fetched into memory, so only 50 * check that fetch succeeded, and then transfer the image to the h/w. 51 * 52 * Return: non-zero code on error 53 */ 54 int intel_huc_fw_upload(struct intel_huc *huc) 55 { 56 /* HW doesn't look at destination address for HuC, so set it to 0 */ 57 return intel_uc_fw_upload(&huc->fw, huc_to_gt(huc), 0, HUC_UKERNEL); 58 } 59