drm/i915/huc: fix version parsing from CSS header

The HuC FW has silently switched to encoding the version the same way as
the GuC FW does, i.e. major.minor.patch instead of just major.minor. All
the current blobs follow the new scheme, but since minor and patch are
both zero there is no difference in the end results and we happily load
them. New binaries, however, will have non-zero values in there, so we
need to make sure to parse them correctly.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Stuart Summers <stuart.summers@intel.com>
Acked-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190925222121.4000-1-daniele.ceraolospurio@intel.com
This commit is contained in:
Daniele Ceraolo Spurio 2019-09-25 15:21:21 -07:00
parent 9cd6c339e3
commit 901045c3f0
2 changed files with 7 additions and 24 deletions

View File

@ -339,25 +339,10 @@ int intel_uc_fw_fetch(struct intel_uc_fw *uc_fw, struct drm_i915_private *i915)
}
/* Get version numbers from the CSS header */
switch (uc_fw->type) {
case INTEL_UC_FW_TYPE_GUC:
uc_fw->major_ver_found = FIELD_GET(CSS_SW_VERSION_GUC_MAJOR,
css->sw_version);
uc_fw->minor_ver_found = FIELD_GET(CSS_SW_VERSION_GUC_MINOR,
css->sw_version);
break;
case INTEL_UC_FW_TYPE_HUC:
uc_fw->major_ver_found = FIELD_GET(CSS_SW_VERSION_HUC_MAJOR,
css->sw_version);
uc_fw->minor_ver_found = FIELD_GET(CSS_SW_VERSION_HUC_MINOR,
css->sw_version);
break;
default:
MISSING_CASE(uc_fw->type);
break;
}
uc_fw->major_ver_found = FIELD_GET(CSS_SW_VERSION_UC_MAJOR,
css->sw_version);
uc_fw->minor_ver_found = FIELD_GET(CSS_SW_VERSION_UC_MINOR,
css->sw_version);
if (uc_fw->major_ver_found != uc_fw->major_ver_wanted ||
uc_fw->minor_ver_found < uc_fw->minor_ver_wanted) {

View File

@ -69,11 +69,9 @@ struct uc_css_header {
char username[8];
char buildnumber[12];
u32 sw_version;
#define CSS_SW_VERSION_GUC_MAJOR (0xFF << 16)
#define CSS_SW_VERSION_GUC_MINOR (0xFF << 8)
#define CSS_SW_VERSION_GUC_PATCH (0xFF << 0)
#define CSS_SW_VERSION_HUC_MAJOR (0xFFFF << 16)
#define CSS_SW_VERSION_HUC_MINOR (0xFFFF << 0)
#define CSS_SW_VERSION_UC_MAJOR (0xFF << 16)
#define CSS_SW_VERSION_UC_MINOR (0xFF << 8)
#define CSS_SW_VERSION_UC_PATCH (0xFF << 0)
u32 reserved[14];
u32 header_info;
} __packed;