Commit 91e55e54 authored by Daniele Ceraolo Spurio's avatar Daniele Ceraolo Spurio Committed by Chris Wilson

drm/i915/uc: Unify uc_fw status tracking

We currently track fetch and load status separately, but the 2 are
actually sequential in the uc lifetime (fetch must complete before we
can attempt the load!). Unifying the 2 variables we can better follow
the sequential states and improve our trackng of the uC state.

Also, sprinkle some GEM_BUG_ON to make sure we transition correctly
between states.

v2: rename states, add the running state (Michal), drop some logs in
    the fetch path (Michal, Chris)

v3: re-rename states, extend early status check to all helpers (Michal)
Suggested-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190725001813.4740-5-daniele.ceraolospurio@intel.com
parent 21a27d1c
...@@ -172,9 +172,9 @@ int intel_guc_suspend(struct intel_guc *guc); ...@@ -172,9 +172,9 @@ int intel_guc_suspend(struct intel_guc *guc);
int intel_guc_resume(struct intel_guc *guc); int intel_guc_resume(struct intel_guc *guc);
struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size); struct i915_vma *intel_guc_allocate_vma(struct intel_guc *guc, u32 size);
static inline bool intel_guc_is_loaded(struct intel_guc *guc) static inline bool intel_guc_is_running(struct intel_guc *guc)
{ {
return intel_uc_fw_is_loaded(&guc->fw); return intel_uc_fw_is_running(&guc->fw);
} }
static inline int intel_guc_sanitize(struct intel_guc *guc) static inline int intel_guc_sanitize(struct intel_guc *guc)
......
...@@ -230,5 +230,9 @@ static int guc_fw_xfer(struct intel_uc_fw *guc_fw) ...@@ -230,5 +230,9 @@ static int guc_fw_xfer(struct intel_uc_fw *guc_fw)
*/ */
int intel_guc_fw_upload(struct intel_guc *guc) int intel_guc_fw_upload(struct intel_guc *guc)
{ {
return intel_uc_fw_upload(&guc->fw, guc_fw_xfer); int ret = intel_uc_fw_upload(&guc->fw, guc_fw_xfer);
if (!ret)
guc->fw.status = INTEL_UC_FIRMWARE_RUNNING;
return ret;
} }
...@@ -941,7 +941,7 @@ static void __guc_client_disable(struct intel_guc_client *client) ...@@ -941,7 +941,7 @@ static void __guc_client_disable(struct intel_guc_client *client)
* the case, instead of trying (in vain) to communicate with it, let's * the case, instead of trying (in vain) to communicate with it, let's
* just cleanup the doorbell HW and our internal state. * just cleanup the doorbell HW and our internal state.
*/ */
if (intel_guc_is_loaded(client->guc)) if (intel_guc_is_running(client->guc))
destroy_doorbell(client); destroy_doorbell(client);
else else
__fini_doorbell(client); __fini_doorbell(client);
......
...@@ -117,8 +117,8 @@ int intel_huc_auth(struct intel_huc *huc) ...@@ -117,8 +117,8 @@ int intel_huc_auth(struct intel_huc *huc)
struct intel_guc *guc = &gt->uc.guc; struct intel_guc *guc = &gt->uc.guc;
int ret; int ret;
if (huc->fw.load_status != INTEL_UC_FIRMWARE_SUCCESS) GEM_BUG_ON(!intel_uc_fw_is_loaded(&huc->fw));
return -ENOEXEC; GEM_BUG_ON(intel_huc_is_authenticated(huc));
ret = intel_guc_auth_huc(guc, ret = intel_guc_auth_huc(guc,
intel_guc_ggtt_offset(guc, huc->rsa_data)); intel_guc_ggtt_offset(guc, huc->rsa_data));
...@@ -138,10 +138,12 @@ int intel_huc_auth(struct intel_huc *huc) ...@@ -138,10 +138,12 @@ int intel_huc_auth(struct intel_huc *huc)
goto fail; goto fail;
} }
huc->fw.status = INTEL_UC_FIRMWARE_RUNNING;
return 0; return 0;
fail: fail:
huc->fw.load_status = INTEL_UC_FIRMWARE_FAIL; huc->fw.status = INTEL_UC_FIRMWARE_FAIL;
DRM_ERROR("HuC: Authentication failed %d\n", ret); DRM_ERROR("HuC: Authentication failed %d\n", ret);
return ret; return ret;
......
...@@ -56,4 +56,9 @@ static inline int intel_huc_sanitize(struct intel_huc *huc) ...@@ -56,4 +56,9 @@ static inline int intel_huc_sanitize(struct intel_huc *huc)
return 0; return 0;
} }
static inline bool intel_huc_is_authenticated(struct intel_huc *huc)
{
return intel_uc_fw_is_running(&huc->fw);
}
#endif #endif
...@@ -560,7 +560,7 @@ void intel_uc_fini_hw(struct intel_uc *uc) ...@@ -560,7 +560,7 @@ void intel_uc_fini_hw(struct intel_uc *uc)
{ {
struct intel_guc *guc = &uc->guc; struct intel_guc *guc = &uc->guc;
if (!intel_guc_is_loaded(guc)) if (!intel_guc_is_running(guc))
return; return;
GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw)); GEM_BUG_ON(!intel_uc_fw_supported(&guc->fw));
...@@ -582,7 +582,7 @@ void intel_uc_reset_prepare(struct intel_uc *uc) ...@@ -582,7 +582,7 @@ void intel_uc_reset_prepare(struct intel_uc *uc)
{ {
struct intel_guc *guc = &uc->guc; struct intel_guc *guc = &uc->guc;
if (!intel_guc_is_loaded(guc)) if (!intel_guc_is_running(guc))
return; return;
guc_stop_communication(guc); guc_stop_communication(guc);
...@@ -594,7 +594,7 @@ void intel_uc_runtime_suspend(struct intel_uc *uc) ...@@ -594,7 +594,7 @@ void intel_uc_runtime_suspend(struct intel_uc *uc)
struct intel_guc *guc = &uc->guc; struct intel_guc *guc = &uc->guc;
int err; int err;
if (!intel_guc_is_loaded(guc)) if (!intel_guc_is_running(guc))
return; return;
err = intel_guc_suspend(guc); err = intel_guc_suspend(guc);
...@@ -609,7 +609,7 @@ void intel_uc_suspend(struct intel_uc *uc) ...@@ -609,7 +609,7 @@ void intel_uc_suspend(struct intel_uc *uc)
struct intel_guc *guc = &uc->guc; struct intel_guc *guc = &uc->guc;
intel_wakeref_t wakeref; intel_wakeref_t wakeref;
if (!intel_guc_is_loaded(guc)) if (!intel_guc_is_running(guc))
return; return;
with_intel_runtime_pm(&uc_to_gt(uc)->i915->runtime_pm, wakeref) with_intel_runtime_pm(&uc_to_gt(uc)->i915->runtime_pm, wakeref)
...@@ -621,7 +621,7 @@ int intel_uc_resume(struct intel_uc *uc) ...@@ -621,7 +621,7 @@ int intel_uc_resume(struct intel_uc *uc)
struct intel_guc *guc = &uc->guc; struct intel_guc *guc = &uc->guc;
int err; int err;
if (!intel_guc_is_loaded(guc)) if (!intel_guc_is_running(guc))
return 0; return 0;
guc_enable_communication(guc); guc_enable_communication(guc);
......
...@@ -162,12 +162,11 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw, ...@@ -162,12 +162,11 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
struct drm_i915_private *i915) struct drm_i915_private *i915)
{ {
/* /*
* we use FIRMWARE_UNINITIALIZED to detect checks against fetch_status * we use FIRMWARE_UNINITIALIZED to detect checks against uc_fw->status
* before we're looked at the HW caps to see if we have uc support * before we're looked at the HW caps to see if we have uc support
*/ */
BUILD_BUG_ON(INTEL_UC_FIRMWARE_UNINITIALIZED); BUILD_BUG_ON(INTEL_UC_FIRMWARE_UNINITIALIZED);
GEM_BUG_ON(uc_fw->fetch_status); GEM_BUG_ON(uc_fw->status);
GEM_BUG_ON(uc_fw->load_status);
GEM_BUG_ON(uc_fw->path); GEM_BUG_ON(uc_fw->path);
uc_fw->type = type; uc_fw->type = type;
...@@ -176,13 +175,10 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw, ...@@ -176,13 +175,10 @@ void intel_uc_fw_init_early(struct intel_uc_fw *uc_fw,
__uc_fw_auto_select(uc_fw, INTEL_INFO(i915)->platform, __uc_fw_auto_select(uc_fw, INTEL_INFO(i915)->platform,
INTEL_REVID(i915)); INTEL_REVID(i915));
if (uc_fw->path) { if (uc_fw->path)
uc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_STARTED; uc_fw->status = INTEL_UC_FIRMWARE_SELECTED;
uc_fw->load_status = INTEL_UC_FIRMWARE_NOT_STARTED; else
} else { uc_fw->status = INTEL_UC_FIRMWARE_NOT_SUPPORTED;
uc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_SUPPORTED;
uc_fw->load_status = INTEL_UC_FIRMWARE_NOT_SUPPORTED;
}
} }
/** /**
...@@ -205,20 +201,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, ...@@ -205,20 +201,9 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
GEM_BUG_ON(!intel_uc_fw_supported(uc_fw)); GEM_BUG_ON(!intel_uc_fw_supported(uc_fw));
DRM_DEBUG_DRIVER("%s fw fetch %s\n",
intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
uc_fw->fetch_status = INTEL_UC_FIRMWARE_PENDING;
DRM_DEBUG_DRIVER("%s fw fetch %s\n",
intel_uc_fw_type_repr(uc_fw->type),
intel_uc_fw_status_repr(uc_fw->fetch_status));
err = request_firmware(&fw, uc_fw->path, &pdev->dev); err = request_firmware(&fw, uc_fw->path, &pdev->dev);
if (err) { if (err)
DRM_DEBUG_DRIVER("%s fw request_firmware err=%d\n",
intel_uc_fw_type_repr(uc_fw->type), err);
goto fail; goto fail;
}
DRM_DEBUG_DRIVER("%s fw size %zu ptr %p\n", DRM_DEBUG_DRIVER("%s fw size %zu ptr %p\n",
intel_uc_fw_type_repr(uc_fw->type), fw->size, fw); intel_uc_fw_type_repr(uc_fw->type), fw->size, fw);
...@@ -320,19 +305,13 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv, ...@@ -320,19 +305,13 @@ void intel_uc_fw_fetch(struct drm_i915_private *dev_priv,
uc_fw->obj = obj; uc_fw->obj = obj;
uc_fw->size = fw->size; uc_fw->size = fw->size;
uc_fw->fetch_status = INTEL_UC_FIRMWARE_SUCCESS; uc_fw->status = INTEL_UC_FIRMWARE_AVAILABLE;
DRM_DEBUG_DRIVER("%s fw fetch %s\n",
intel_uc_fw_type_repr(uc_fw->type),
intel_uc_fw_status_repr(uc_fw->fetch_status));
release_firmware(fw); release_firmware(fw);
return; return;
fail: fail:
uc_fw->fetch_status = INTEL_UC_FIRMWARE_FAIL; uc_fw->status = INTEL_UC_FIRMWARE_MISSING;
DRM_DEBUG_DRIVER("%s fw fetch %s\n",
intel_uc_fw_type_repr(uc_fw->type),
intel_uc_fw_status_repr(uc_fw->fetch_status));
DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n", DRM_WARN("%s: Failed to fetch firmware %s (error %d)\n",
intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err);
...@@ -388,14 +367,11 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, ...@@ -388,14 +367,11 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
DRM_DEBUG_DRIVER("%s fw load %s\n", DRM_DEBUG_DRIVER("%s fw load %s\n",
intel_uc_fw_type_repr(uc_fw->type), uc_fw->path); intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
if (uc_fw->fetch_status != INTEL_UC_FIRMWARE_SUCCESS) /* make sure the status was cleared the last time we reset the uc */
return -ENOEXEC; GEM_BUG_ON(intel_uc_fw_is_loaded(uc_fw));
uc_fw->load_status = INTEL_UC_FIRMWARE_PENDING;
DRM_DEBUG_DRIVER("%s fw load %s\n",
intel_uc_fw_type_repr(uc_fw->type),
intel_uc_fw_status_repr(uc_fw->load_status));
if (!intel_uc_fw_is_available(uc_fw))
return -ENOEXEC;
/* Call custom loader */ /* Call custom loader */
intel_uc_fw_ggtt_bind(uc_fw); intel_uc_fw_ggtt_bind(uc_fw);
err = xfer(uc_fw); err = xfer(uc_fw);
...@@ -403,10 +379,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, ...@@ -403,10 +379,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
if (err) if (err)
goto fail; goto fail;
uc_fw->load_status = INTEL_UC_FIRMWARE_SUCCESS; uc_fw->status = INTEL_UC_FIRMWARE_TRANSFERRED;
DRM_DEBUG_DRIVER("%s fw load %s\n", DRM_DEBUG_DRIVER("%s fw xfer completed\n",
intel_uc_fw_type_repr(uc_fw->type), intel_uc_fw_type_repr(uc_fw->type));
intel_uc_fw_status_repr(uc_fw->load_status));
DRM_INFO("%s: Loaded firmware %s (version %u.%u)\n", DRM_INFO("%s: Loaded firmware %s (version %u.%u)\n",
intel_uc_fw_type_repr(uc_fw->type), intel_uc_fw_type_repr(uc_fw->type),
...@@ -416,10 +391,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw, ...@@ -416,10 +391,9 @@ int intel_uc_fw_upload(struct intel_uc_fw *uc_fw,
return 0; return 0;
fail: fail:
uc_fw->load_status = INTEL_UC_FIRMWARE_FAIL; uc_fw->status = INTEL_UC_FIRMWARE_FAIL;
DRM_DEBUG_DRIVER("%s fw load %s\n", DRM_DEBUG_DRIVER("%s fw load failed\n",
intel_uc_fw_type_repr(uc_fw->type), intel_uc_fw_type_repr(uc_fw->type));
intel_uc_fw_status_repr(uc_fw->load_status));
DRM_WARN("%s: Failed to load firmware %s (error %d)\n", DRM_WARN("%s: Failed to load firmware %s (error %d)\n",
intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err); intel_uc_fw_type_repr(uc_fw->type), uc_fw->path, err);
...@@ -431,7 +405,10 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw) ...@@ -431,7 +405,10 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw)
{ {
int err; int err;
if (uc_fw->fetch_status != INTEL_UC_FIRMWARE_SUCCESS) /* this should happen before the load! */
GEM_BUG_ON(intel_uc_fw_is_loaded(uc_fw));
if (!intel_uc_fw_is_available(uc_fw))
return -ENOEXEC; return -ENOEXEC;
err = i915_gem_object_pin_pages(uc_fw->obj); err = i915_gem_object_pin_pages(uc_fw->obj);
...@@ -444,7 +421,7 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw) ...@@ -444,7 +421,7 @@ int intel_uc_fw_init(struct intel_uc_fw *uc_fw)
void intel_uc_fw_fini(struct intel_uc_fw *uc_fw) void intel_uc_fw_fini(struct intel_uc_fw *uc_fw)
{ {
if (uc_fw->fetch_status != INTEL_UC_FIRMWARE_SUCCESS) if (!intel_uc_fw_is_available(uc_fw))
return; return;
i915_gem_object_unpin_pages(uc_fw->obj); i915_gem_object_unpin_pages(uc_fw->obj);
...@@ -478,7 +455,7 @@ void intel_uc_fw_cleanup_fetch(struct intel_uc_fw *uc_fw) ...@@ -478,7 +455,7 @@ void intel_uc_fw_cleanup_fetch(struct intel_uc_fw *uc_fw)
if (obj) if (obj)
i915_gem_object_put(obj); i915_gem_object_put(obj);
uc_fw->fetch_status = INTEL_UC_FIRMWARE_NOT_STARTED; uc_fw->status = INTEL_UC_FIRMWARE_SELECTED;
} }
/** /**
...@@ -492,9 +469,8 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p) ...@@ -492,9 +469,8 @@ void intel_uc_fw_dump(const struct intel_uc_fw *uc_fw, struct drm_printer *p)
{ {
drm_printf(p, "%s firmware: %s\n", drm_printf(p, "%s firmware: %s\n",
intel_uc_fw_type_repr(uc_fw->type), uc_fw->path); intel_uc_fw_type_repr(uc_fw->type), uc_fw->path);
drm_printf(p, "\tstatus: fetch %s, load %s\n", drm_printf(p, "\tstatus: %s\n",
intel_uc_fw_status_repr(uc_fw->fetch_status), intel_uc_fw_status_repr(uc_fw->status));
intel_uc_fw_status_repr(uc_fw->load_status));
drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n", drm_printf(p, "\tversion: wanted %u.%u, found %u.%u\n",
uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted, uc_fw->major_ver_wanted, uc_fw->minor_ver_wanted,
uc_fw->major_ver_found, uc_fw->minor_ver_found); uc_fw->major_ver_found, uc_fw->minor_ver_found);
......
...@@ -35,12 +35,14 @@ struct drm_i915_private; ...@@ -35,12 +35,14 @@ struct drm_i915_private;
#define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915" #define INTEL_UC_FIRMWARE_URL "https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915"
enum intel_uc_fw_status { enum intel_uc_fw_status {
INTEL_UC_FIRMWARE_NOT_SUPPORTED = -2, /* no uc HW */ INTEL_UC_FIRMWARE_FAIL = -3, /* failed to xfer or init/auth the fw */
INTEL_UC_FIRMWARE_FAIL = -1, INTEL_UC_FIRMWARE_MISSING = -2, /* blob not found on the system */
INTEL_UC_FIRMWARE_NOT_SUPPORTED = -1, /* no uc HW */
INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */ INTEL_UC_FIRMWARE_UNINITIALIZED = 0, /* used to catch checks done too early */
INTEL_UC_FIRMWARE_NOT_STARTED = 1, INTEL_UC_FIRMWARE_SELECTED, /* selected the blob we want to load */
INTEL_UC_FIRMWARE_PENDING, INTEL_UC_FIRMWARE_AVAILABLE, /* blob found and copied in mem */
INTEL_UC_FIRMWARE_SUCCESS INTEL_UC_FIRMWARE_TRANSFERRED, /* dma xfer done */
INTEL_UC_FIRMWARE_RUNNING /* init/auth done */
}; };
enum intel_uc_fw_type { enum intel_uc_fw_type {
...@@ -57,8 +59,7 @@ struct intel_uc_fw { ...@@ -57,8 +59,7 @@ struct intel_uc_fw {
const char *path; const char *path;
size_t size; size_t size;
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
enum intel_uc_fw_status fetch_status; enum intel_uc_fw_status status;
enum intel_uc_fw_status load_status;
/* /*
* The firmware build process will generate a version header file with major and * The firmware build process will generate a version header file with major and
...@@ -83,18 +84,22 @@ static inline ...@@ -83,18 +84,22 @@ static inline
const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status) const char *intel_uc_fw_status_repr(enum intel_uc_fw_status status)
{ {
switch (status) { switch (status) {
case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
return "N/A - uc HW not available";
case INTEL_UC_FIRMWARE_FAIL: case INTEL_UC_FIRMWARE_FAIL:
return "FAIL"; return "FAIL";
case INTEL_UC_FIRMWARE_MISSING:
return "MISSING";
case INTEL_UC_FIRMWARE_NOT_SUPPORTED:
return "N/A";
case INTEL_UC_FIRMWARE_UNINITIALIZED: case INTEL_UC_FIRMWARE_UNINITIALIZED:
return "UNINITIALIZED"; return "UNINITIALIZED";
case INTEL_UC_FIRMWARE_NOT_STARTED: case INTEL_UC_FIRMWARE_SELECTED:
return "NOT_STARTED"; return "SELECTED";
case INTEL_UC_FIRMWARE_PENDING: case INTEL_UC_FIRMWARE_AVAILABLE:
return "PENDING"; return "AVAILABLE";
case INTEL_UC_FIRMWARE_SUCCESS: case INTEL_UC_FIRMWARE_TRANSFERRED:
return "SUCCESS"; return "TRANSFERRED";
case INTEL_UC_FIRMWARE_RUNNING:
return "RUNNING";
} }
return "<invalid>"; return "<invalid>";
} }
...@@ -110,22 +115,38 @@ static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type) ...@@ -110,22 +115,38 @@ static inline const char *intel_uc_fw_type_repr(enum intel_uc_fw_type type)
return "uC"; return "uC";
} }
static inline enum intel_uc_fw_status
__intel_uc_fw_status(struct intel_uc_fw *uc_fw)
{
/* shouldn't call this before checking hw/blob availability */
GEM_BUG_ON(uc_fw->status == INTEL_UC_FIRMWARE_UNINITIALIZED);
return uc_fw->status;
}
static inline bool intel_uc_fw_is_available(struct intel_uc_fw *uc_fw)
{
return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_AVAILABLE;
}
static inline bool intel_uc_fw_is_loaded(struct intel_uc_fw *uc_fw) static inline bool intel_uc_fw_is_loaded(struct intel_uc_fw *uc_fw)
{ {
return uc_fw->load_status == INTEL_UC_FIRMWARE_SUCCESS; return __intel_uc_fw_status(uc_fw) >= INTEL_UC_FIRMWARE_TRANSFERRED;
}
static inline bool intel_uc_fw_is_running(struct intel_uc_fw *uc_fw)
{
return __intel_uc_fw_status(uc_fw) == INTEL_UC_FIRMWARE_RUNNING;
} }
static inline bool intel_uc_fw_supported(struct intel_uc_fw *uc_fw) static inline bool intel_uc_fw_supported(struct intel_uc_fw *uc_fw)
{ {
/* shouldn't call this before checking hw/blob availability */ return __intel_uc_fw_status(uc_fw) != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
GEM_BUG_ON(uc_fw->fetch_status == INTEL_UC_FIRMWARE_UNINITIALIZED);
return uc_fw->fetch_status != INTEL_UC_FIRMWARE_NOT_SUPPORTED;
} }
static inline void intel_uc_fw_sanitize(struct intel_uc_fw *uc_fw) static inline void intel_uc_fw_sanitize(struct intel_uc_fw *uc_fw)
{ {
if (intel_uc_fw_is_loaded(uc_fw)) if (intel_uc_fw_is_loaded(uc_fw))
uc_fw->load_status = INTEL_UC_FIRMWARE_PENDING; uc_fw->status = INTEL_UC_FIRMWARE_AVAILABLE;
} }
/** /**
...@@ -138,7 +159,7 @@ static inline void intel_uc_fw_sanitize(struct intel_uc_fw *uc_fw) ...@@ -138,7 +159,7 @@ static inline void intel_uc_fw_sanitize(struct intel_uc_fw *uc_fw)
*/ */
static inline u32 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw) static inline u32 intel_uc_fw_get_upload_size(struct intel_uc_fw *uc_fw)
{ {
if (uc_fw->fetch_status != INTEL_UC_FIRMWARE_SUCCESS) if (!intel_uc_fw_is_available(uc_fw))
return 0; return 0;
return uc_fw->header_size + uc_fw->ucode_size; return uc_fw->header_size + uc_fw->ucode_size;
......
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