drm/i915/uc: Add intel_uc_fw_fini()
Cleanups of uc firmware structs from GuC and Huc are the same for both. Move common code to the helper function to avoid duplication. Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
This commit is contained in:

committed by
Joonas Lahtinen

parent
5e065f1f49
commit
00bbb72c86
@@ -26,6 +26,19 @@
|
|||||||
#include "intel_uc.h"
|
#include "intel_uc.h"
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
|
|
||||||
|
/* Cleans up uC firmware by releasing the firmware GEM obj.
|
||||||
|
*/
|
||||||
|
static void __intel_uc_fw_fini(struct intel_uc_fw *uc_fw)
|
||||||
|
{
|
||||||
|
struct drm_i915_gem_object *obj;
|
||||||
|
|
||||||
|
obj = fetch_and_zero(&uc_fw->obj);
|
||||||
|
if (obj)
|
||||||
|
i915_gem_object_put(obj);
|
||||||
|
|
||||||
|
uc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset GuC providing us with fresh state for both GuC and HuC.
|
/* Reset GuC providing us with fresh state for both GuC and HuC.
|
||||||
*/
|
*/
|
||||||
static int __intel_uc_reset_hw(struct drm_i915_private *dev_priv)
|
static int __intel_uc_reset_hw(struct drm_i915_private *dev_priv)
|
||||||
@@ -235,21 +248,8 @@ void intel_uc_init_fw(struct drm_i915_private *dev_priv)
|
|||||||
|
|
||||||
void intel_uc_fini_fw(struct drm_i915_private *dev_priv)
|
void intel_uc_fini_fw(struct drm_i915_private *dev_priv)
|
||||||
{
|
{
|
||||||
struct intel_uc_fw *guc_fw = &dev_priv->guc.fw;
|
__intel_uc_fw_fini(&dev_priv->guc.fw);
|
||||||
struct intel_uc_fw *huc_fw = &dev_priv->huc.fw;
|
__intel_uc_fw_fini(&dev_priv->huc.fw);
|
||||||
struct drm_i915_gem_object *obj;
|
|
||||||
|
|
||||||
obj = fetch_and_zero(&guc_fw->obj);
|
|
||||||
if (obj)
|
|
||||||
i915_gem_object_put(obj);
|
|
||||||
|
|
||||||
guc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
|
|
||||||
|
|
||||||
obj = fetch_and_zero(&huc_fw->obj);
|
|
||||||
if (obj)
|
|
||||||
i915_gem_object_put(obj);
|
|
||||||
|
|
||||||
huc_fw->fetch_status = INTEL_UC_FIRMWARE_NONE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int intel_uc_init_hw(struct drm_i915_private *dev_priv)
|
int intel_uc_init_hw(struct drm_i915_private *dev_priv)
|
||||||
|
Reference in New Issue
Block a user