Commit ae7a3166 authored by Michal Wajdeczko's avatar Michal Wajdeczko Committed by Chris Wilson

drm/i915/uc: Fail early if there is no GuC fw available

We don't want to rely on misleading WOPCM partitioning error.
Signed-off-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190811195132.9660-2-michal.wajdeczko@intel.com
parent 9f4dd137
...@@ -436,6 +436,11 @@ int intel_uc_init_hw(struct intel_uc *uc) ...@@ -436,6 +436,11 @@ int intel_uc_init_hw(struct intel_uc *uc)
if (!intel_uc_supports_guc(uc)) if (!intel_uc_supports_guc(uc))
return 0; return 0;
if (!intel_uc_fw_is_available(&guc->fw)) {
ret = intel_uc_fw_status_to_error(guc->fw.status);
goto err_out;
}
ret = uc_init_wopcm(uc); ret = uc_init_wopcm(uc);
if (ret) if (ret)
goto err_out; goto err_out;
......
...@@ -107,6 +107,27 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status) ...@@ -107,6 +107,27 @@ const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
return "<invalid>"; return "<invalid>";
} }
static inline int intel_uc_fw_status_to_error(enum intel_uc_fw_status status)
{
switch (status) {
case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
case INTEL_UC_FIRMWARE_UNINITIALIZED:
return -EPERM;
case INTEL_UC_FIRMWARE_MISSING:
return -ENOENT;
case INTEL_UC_FIRMWARE_ERROR:
return -ENOEXEC;
case INTEL_UC_FIRMWARE_FAIL:
return -EIO;
case INTEL_UC_FIRMWARE_SELECTED:
case INTEL_UC_FIRMWARE_AVAILABLE:
case INTEL_UC_FIRMWARE_TRANSFERRED:
case INTEL_UC_FIRMWARE_RUNNING:
return 0;
}
return -EINVAL;
}
static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type) static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
{ {
switch (type) { switch (type) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment