diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2018-03-20 13:24:03 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-05-17 11:13:22 -0400 |
commit | 59b0b509f1ae0c7ca54607f2770a1aec6e55d8dc (patch) | |
tree | cda8d5c7025789000799177ecc52ec916aaffb31 /drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | |
parent | 6f68711dd63522aab34c3e9513fa42a7586a95e5 (diff) |
drm/amdgpu/atomfirmware: add parser for gfx_info table
Add support for the gfx_info table on boards that use atomfirmware.
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c index a0f48cb9b8f0..7014d5875d5b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c | |||
@@ -322,3 +322,49 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev) | |||
322 | 322 | ||
323 | return ret; | 323 | return ret; |
324 | } | 324 | } |
325 | |||
326 | union gfx_info { | ||
327 | struct atom_gfx_info_v2_4 v24; | ||
328 | }; | ||
329 | |||
330 | int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev) | ||
331 | { | ||
332 | struct amdgpu_mode_info *mode_info = &adev->mode_info; | ||
333 | int index; | ||
334 | uint8_t frev, crev; | ||
335 | uint16_t data_offset; | ||
336 | |||
337 | index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1, | ||
338 | gfx_info); | ||
339 | if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL, | ||
340 | &frev, &crev, &data_offset)) { | ||
341 | union gfx_info *gfx_info = (union gfx_info *) | ||
342 | (mode_info->atom_context->bios + data_offset); | ||
343 | switch (crev) { | ||
344 | case 4: | ||
345 | adev->gfx.config.max_shader_engines = gfx_info->v24.gc_num_se; | ||
346 | adev->gfx.config.max_cu_per_sh = gfx_info->v24.gc_num_cu_per_sh; | ||
347 | adev->gfx.config.max_sh_per_se = gfx_info->v24.gc_num_sh_per_se; | ||
348 | adev->gfx.config.max_backends_per_se = gfx_info->v24.gc_num_rb_per_se; | ||
349 | adev->gfx.config.max_texture_channel_caches = gfx_info->v24.gc_num_tccs; | ||
350 | adev->gfx.config.max_gprs = le16_to_cpu(gfx_info->v24.gc_num_gprs); | ||
351 | adev->gfx.config.max_gs_threads = gfx_info->v24.gc_num_max_gs_thds; | ||
352 | adev->gfx.config.gs_vgt_table_depth = gfx_info->v24.gc_gs_table_depth; | ||
353 | adev->gfx.config.gs_prim_buffer_depth = | ||
354 | le16_to_cpu(gfx_info->v24.gc_gsprim_buff_depth); | ||
355 | adev->gfx.config.double_offchip_lds_buf = | ||
356 | gfx_info->v24.gc_double_offchip_lds_buffer; | ||
357 | adev->gfx.cu_info.wave_front_size = gfx_info->v24.gc_wave_size; | ||
358 | adev->gfx.cu_info.max_waves_per_simd = | ||
359 | le16_to_cpu(gfx_info->v24.gc_max_waves_per_simd); | ||
360 | adev->gfx.cu_info.max_scratch_slots_per_cu = | ||
361 | gfx_info->v24.gc_max_scratch_slots_per_cu; | ||
362 | adev->gfx.cu_info.lds_size = le16_to_cpu(gfx_info->v24.gc_lds_size); | ||
363 | return 0; | ||
364 | default: | ||
365 | return -EINVAL; | ||
366 | } | ||
367 | |||
368 | } | ||
369 | return -EINVAL; | ||
370 | } | ||