drm/amdgpu: support get_vram_info atomfirmware i/f for aldebaran
authorHawking Zhang <Hawking.Zhang@amd.com>
Fri, 13 Nov 2020 10:03:07 +0000 (18:03 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 24 Mar 2021 02:54:59 +0000 (22:54 -0400)
Query vram_type, channel_num, channel_width
information through atomfirmware i/f

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
drivers/gpu/drm/amd/include/atomfirmware.h

index 6107ac9..266d949 100644 (file)
@@ -123,6 +123,7 @@ union vram_info {
        struct atom_vram_info_header_v2_3 v23;
        struct atom_vram_info_header_v2_4 v24;
        struct atom_vram_info_header_v2_5 v25;
+       struct atom_vram_info_header_v2_5 v26;
 };
 
 union vram_module {
@@ -315,6 +316,26 @@ amdgpu_atomfirmware_get_vram_info(struct amdgpu_device *adev,
                                if (vram_vendor)
                                        *vram_vendor = mem_vendor;
                                break;
+                       case 6:
+                               if (module_id > vram_info->v26.vram_module_num)
+                                       module_id = 0;
+                               vram_module = (union vram_module *)vram_info->v26.vram_module;
+                               while (i < module_id) {
+                                       vram_module = (union vram_module *)
+                                               ((u8 *)vram_module + vram_module->v11.vram_module_size);
+                                       i++;
+                               }
+                               mem_type = vram_module->v9.memory_type;
+                               if (vram_type)
+                                       *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
+                               mem_channel_number = vram_module->v9.channel_num;
+                               mem_channel_width = vram_module->v9.channel_width;
+                               if (vram_width)
+                                       *vram_width = mem_channel_number * (1 << mem_channel_width);
+                               mem_vendor = (vram_module->v9.vender_rev_id) & 0xF;
+                               if (vram_vendor)
+                                       *vram_vendor = mem_vendor;
+                               break;
                        default:
                                return -EINVAL;
                        }
index 3cb8d4c..ec43a4f 100644 (file)
@@ -2789,6 +2789,22 @@ struct atom_vram_info_header_v2_5 {
        struct   atom_vram_module_v11  vram_module[16];        // just for allocation, real number of blocks is in ucNumOfVRAMModule;
 };
 
+struct atom_vram_info_header_v2_6 {
+       struct atom_common_table_header table_header;
+       uint16_t mem_adjust_tbloffset;
+       uint16_t mem_clk_patch_tbloffset;
+       uint16_t mc_adjust_pertile_tbloffset;
+       uint16_t mc_phyinit_tbloffset;
+       uint16_t dram_data_remap_tbloffset;
+       uint16_t tmrs_seq_offset;
+       uint16_t post_ucode_init_offset;
+       uint16_t vram_rsd2;
+       uint8_t  vram_module_num;
+       uint8_t  umcip_min_ver;
+       uint8_t  umcip_max_ver;
+       uint8_t  mc_phy_tile_num;
+       struct atom_vram_module_v9 vram_module[16];
+};
 /* 
   ***************************************************************************
     Data Table voltageobject_info  structure