2019-08-12 09:29:35 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2018-03-01 16:45:45 +00:00
|
|
|
/*
|
2019-08-12 09:29:35 +00:00
|
|
|
* Copyright © 2014-2019 Intel Corporation
|
2018-03-01 16:45:45 +00:00
|
|
|
*/
|
|
|
|
|
2019-07-13 10:00:14 +00:00
|
|
|
#include "gt/intel_gt.h"
|
2018-03-01 16:45:45 +00:00
|
|
|
#include "intel_huc_fw.h"
|
|
|
|
#include "i915_drv.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DOC: HuC Firmware
|
|
|
|
*
|
|
|
|
* Motivation:
|
|
|
|
* GEN9 introduces a new dedicated firmware for usage in media HEVC (High
|
|
|
|
* Efficiency Video Coding) operations. Userspace can use the firmware
|
|
|
|
* capabilities by adding HuC specific commands to batch buffers.
|
|
|
|
*
|
|
|
|
* Implementation:
|
|
|
|
* The same firmware loader is used as the GuC. However, the actual
|
|
|
|
* loading to HW is deferred until GEM initialization is done.
|
|
|
|
*
|
|
|
|
* Note that HuC firmware loading must be done before GuC loading.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* intel_huc_fw_init_early() - initializes HuC firmware struct
|
|
|
|
* @huc: intel_huc struct
|
|
|
|
*
|
|
|
|
* On platforms with HuC selects firmware for uploading
|
|
|
|
*/
|
|
|
|
void intel_huc_fw_init_early(struct intel_huc *huc)
|
|
|
|
{
|
2019-08-07 17:00:29 +00:00
|
|
|
struct intel_gt *gt = huc_to_gt(huc);
|
|
|
|
struct intel_uc *uc = >->uc;
|
|
|
|
struct drm_i915_private *i915 = gt->i915;
|
|
|
|
|
|
|
|
intel_uc_fw_init_early(&huc->fw, INTEL_UC_FW_TYPE_HUC,
|
2019-08-16 20:56:58 +00:00
|
|
|
intel_uc_uses_guc(uc),
|
2019-08-07 17:00:29 +00:00
|
|
|
INTEL_INFO(i915)->platform, INTEL_REVID(i915));
|
2018-03-01 16:45:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* intel_huc_fw_upload() - load HuC uCode to device
|
|
|
|
* @huc: intel_huc structure
|
|
|
|
*
|
|
|
|
* Called from intel_uc_init_hw() during driver load, resume from sleep and
|
|
|
|
* after a GPU reset. Note that HuC must be loaded before GuC.
|
|
|
|
*
|
2018-03-23 12:34:50 +00:00
|
|
|
* The firmware image should have already been fetched into memory, so only
|
|
|
|
* check that fetch succeeded, and then transfer the image to the h/w.
|
2018-03-01 16:45:45 +00:00
|
|
|
*
|
|
|
|
* Return: non-zero code on error
|
|
|
|
*/
|
|
|
|
int intel_huc_fw_upload(struct intel_huc *huc)
|
|
|
|
{
|
2019-07-25 00:18:13 +00:00
|
|
|
/* HW doesn't look at destination address for HuC, so set it to 0 */
|
|
|
|
return intel_uc_fw_upload(&huc->fw, huc_to_gt(huc), 0, HUC_UKERNEL);
|
2018-03-01 16:45:45 +00:00
|
|
|
}
|