Commit d5617541 authored by Nicholas Kazlauskas's avatar Nicholas Kazlauskas Committed by Alex Deucher

drm/amd/display: Fix DMUB meta offset for new load method

[Why]
The new metadata offset is located at the end of the firmware binary
without any additional padding.

Firmware state is currently larger than 1024 bytes so new firmware state
will hang when trying to access any data above 1024 bytes.

[How]
Specify the correct offset based on legacy vs new loading method.
Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: default avatarYongqiang Sun <yongqiang.sun@amd.com>
Acked-by: default avatarAurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1dfedb39
...@@ -96,25 +96,27 @@ dmub_get_fw_meta_info(const struct dmub_srv_region_params *params) ...@@ -96,25 +96,27 @@ dmub_get_fw_meta_info(const struct dmub_srv_region_params *params)
const union dmub_fw_meta *meta; const union dmub_fw_meta *meta;
const uint8_t *blob = NULL; const uint8_t *blob = NULL;
uint32_t blob_size = 0; uint32_t blob_size = 0;
uint32_t meta_offset = 0;
if (params->fw_bss_data) { if (params->fw_bss_data) {
/* Legacy metadata region. */ /* Legacy metadata region. */
blob = params->fw_bss_data; blob = params->fw_bss_data;
blob_size = params->bss_data_size; blob_size = params->bss_data_size;
meta_offset = DMUB_FW_META_OFFSET;
} else if (params->fw_inst_const) { } else if (params->fw_inst_const) {
/* Combined metadata region. */ /* Combined metadata region. */
blob = params->fw_inst_const; blob = params->fw_inst_const;
blob_size = params->inst_const_size; blob_size = params->inst_const_size;
meta_offset = 0;
} }
if (!blob || !blob_size) if (!blob || !blob_size)
return NULL; return NULL;
if (blob_size < sizeof(union dmub_fw_meta) + DMUB_FW_META_OFFSET) if (blob_size < sizeof(union dmub_fw_meta) + meta_offset)
return NULL; return NULL;
meta = (const union dmub_fw_meta *)(blob + blob_size - meta = (const union dmub_fw_meta *)(blob + blob_size - meta_offset -
DMUB_FW_META_OFFSET -
sizeof(union dmub_fw_meta)); sizeof(union dmub_fw_meta));
if (meta->info.magic_value != DMUB_FW_META_MAGIC) if (meta->info.magic_value != DMUB_FW_META_MAGIC)
......
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