Commit 8e84aa1b authored by Xiaojie Yuan's avatar Xiaojie Yuan Committed by Alex Deucher

drm/amdgpu/discovery: stop taking psp header into account

psp will write a header to vram, but the value exposed in
RCC_CONFIG_MEMSIZE does not include the memory that this header is
written to. Therefore, the interpretation of the table does not need to
take the psp header into account.
Signed-off-by: default avatarXiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 2de00413
...@@ -189,7 +189,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev) ...@@ -189,7 +189,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev)
goto out; goto out;
} }
bhdr = (struct binary_header *)(adev->discovery + PSP_HEADER_SIZE); bhdr = (struct binary_header *)adev->discovery;
if (le32_to_cpu(bhdr->binary_signature) != BINARY_SIGNATURE) { if (le32_to_cpu(bhdr->binary_signature) != BINARY_SIGNATURE) {
DRM_ERROR("invalid ip discovery binary signature\n"); DRM_ERROR("invalid ip discovery binary signature\n");
...@@ -197,8 +197,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev) ...@@ -197,8 +197,7 @@ int amdgpu_discovery_init(struct amdgpu_device *adev)
goto out; goto out;
} }
offset = PSP_HEADER_SIZE + offset = offsetof(struct binary_header, binary_checksum) +
offsetof(struct binary_header, binary_checksum) +
sizeof(bhdr->binary_checksum); sizeof(bhdr->binary_checksum);
size = bhdr->binary_size - offset; size = bhdr->binary_size - offset;
checksum = bhdr->binary_checksum; checksum = bhdr->binary_checksum;
...@@ -275,7 +274,7 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev) ...@@ -275,7 +274,7 @@ int amdgpu_discovery_reg_base_init(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
bhdr = (struct binary_header *)(adev->discovery + PSP_HEADER_SIZE); bhdr = (struct binary_header *)adev->discovery;
ihdr = (struct ip_discovery_header *)(adev->discovery + ihdr = (struct ip_discovery_header *)(adev->discovery +
le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset)); le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset));
num_dies = le16_to_cpu(ihdr->num_dies); num_dies = le16_to_cpu(ihdr->num_dies);
...@@ -338,7 +337,7 @@ int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id, ...@@ -338,7 +337,7 @@ int amdgpu_discovery_get_ip_version(struct amdgpu_device *adev, int hw_id,
return -EINVAL; return -EINVAL;
} }
bhdr = (struct binary_header *)(adev->discovery + PSP_HEADER_SIZE); bhdr = (struct binary_header *)adev->discovery;
ihdr = (struct ip_discovery_header *)(adev->discovery + ihdr = (struct ip_discovery_header *)(adev->discovery +
le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset)); le16_to_cpu(bhdr->table_list[IP_DISCOVERY].offset));
num_dies = le16_to_cpu(ihdr->num_dies); num_dies = le16_to_cpu(ihdr->num_dies);
...@@ -376,7 +375,7 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev) ...@@ -376,7 +375,7 @@ int amdgpu_discovery_get_gfx_info(struct amdgpu_device *adev)
return -EINVAL; return -EINVAL;
} }
bhdr = (struct binary_header *)(adev->discovery + PSP_HEADER_SIZE); bhdr = (struct binary_header *)adev->discovery;
gc_info = (struct gc_info_v1_0 *)(adev->discovery + gc_info = (struct gc_info_v1_0 *)(adev->discovery +
le16_to_cpu(bhdr->table_list[GC].offset)); le16_to_cpu(bhdr->table_list[GC].offset));
......
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