mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-01 11:24:25 +08:00
drm/amdgpu: fix byteorder error in amdgpu discovery
fix some byteorder issues about amdgpu discovery. This will result in running errors on the big end system. (e.g:MIPS) Signed-off-by: Yang Wang <KevinYang.Wang@amd.com> Reviewed-by: Guchun Chen <guchun.chen@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
c4ef8a73bf
commit
fd08953b2d
@ -248,8 +248,8 @@ get_from_vram:
|
|||||||
|
|
||||||
offset = offsetof(struct binary_header, binary_checksum) +
|
offset = offsetof(struct binary_header, binary_checksum) +
|
||||||
sizeof(bhdr->binary_checksum);
|
sizeof(bhdr->binary_checksum);
|
||||||
size = bhdr->binary_size - offset;
|
size = le16_to_cpu(bhdr->binary_size) - offset;
|
||||||
checksum = bhdr->binary_checksum;
|
checksum = le16_to_cpu(bhdr->binary_checksum);
|
||||||
|
|
||||||
if (!amdgpu_discovery_verify_checksum(adev->mman.discovery_bin + offset,
|
if (!amdgpu_discovery_verify_checksum(adev->mman.discovery_bin + offset,
|
||||||
size, checksum)) {
|
size, checksum)) {
|
||||||
@ -270,7 +270,7 @@ get_from_vram:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!amdgpu_discovery_verify_checksum(adev->mman.discovery_bin + offset,
|
if (!amdgpu_discovery_verify_checksum(adev->mman.discovery_bin + offset,
|
||||||
ihdr->size, checksum)) {
|
le16_to_cpu(ihdr->size), checksum)) {
|
||||||
DRM_ERROR("invalid ip discovery data table checksum\n");
|
DRM_ERROR("invalid ip discovery data table checksum\n");
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -282,7 +282,7 @@ get_from_vram:
|
|||||||
ghdr = (struct gpu_info_header *)(adev->mman.discovery_bin + offset);
|
ghdr = (struct gpu_info_header *)(adev->mman.discovery_bin + offset);
|
||||||
|
|
||||||
if (!amdgpu_discovery_verify_checksum(adev->mman.discovery_bin + offset,
|
if (!amdgpu_discovery_verify_checksum(adev->mman.discovery_bin + offset,
|
||||||
ghdr->size, checksum)) {
|
le32_to_cpu(ghdr->size), checksum)) {
|
||||||
DRM_ERROR("invalid gc data table checksum\n");
|
DRM_ERROR("invalid gc data table checksum\n");
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
@ -489,10 +489,10 @@ void amdgpu_discovery_harvest_ip(struct amdgpu_device *adev)
|
|||||||
le16_to_cpu(bhdr->table_list[HARVEST_INFO].offset));
|
le16_to_cpu(bhdr->table_list[HARVEST_INFO].offset));
|
||||||
|
|
||||||
for (i = 0; i < 32; i++) {
|
for (i = 0; i < 32; i++) {
|
||||||
if (le32_to_cpu(harvest_info->list[i].hw_id) == 0)
|
if (le16_to_cpu(harvest_info->list[i].hw_id) == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
switch (le32_to_cpu(harvest_info->list[i].hw_id)) {
|
switch (le16_to_cpu(harvest_info->list[i].hw_id)) {
|
||||||
case VCN_HWID:
|
case VCN_HWID:
|
||||||
vcn_harvest_count++;
|
vcn_harvest_count++;
|
||||||
if (harvest_info->list[i].number_instance == 0)
|
if (harvest_info->list[i].number_instance == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user