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