aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorAlex Deucher <alexander.deucher@amd.com>2017-02-13 16:01:58 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-03-29 23:54:16 -0400
commit0cdd500560e233aef4e0749c9f014e9ee8f4d752 (patch)
tree7d31e87c93c875a5d5381d4b674d715003346d26 /drivers/gpu/drm/amd
parent1fadf42ed5b816d266d68b4e8622c33d03c968bb (diff)
amdgpu: detect if we are using atomfirmware or atombios for vbios (v2)
Supposedly atomfirmware rom header is 3.3 atombios is 1.1. v2: rebased on newer kernel Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu.h1
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c30
2 files changed, 24 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
index a17a54fc8f27..2790129c0b76 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
@@ -1308,6 +1308,7 @@ struct amdgpu_device {
1308 bool have_disp_power_ref; 1308 bool have_disp_power_ref;
1309 1309
1310 /* BIOS */ 1310 /* BIOS */
1311 bool is_atom_fw;
1311 uint8_t *bios; 1312 uint8_t *bios;
1312 uint32_t bios_size; 1313 uint32_t bios_size;
1313 struct amdgpu_bo *stollen_vga_memory; 1314 struct amdgpu_bo *stollen_vga_memory;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
index 821f7cc2051f..365e735f6647 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_bios.c
@@ -86,6 +86,18 @@ static bool check_atom_bios(uint8_t *bios, size_t size)
86 return false; 86 return false;
87} 87}
88 88
89static bool is_atom_fw(uint8_t *bios)
90{
91 uint16_t bios_header_start = bios[0x48] | (bios[0x49] << 8);
92 uint8_t frev = bios[bios_header_start + 2];
93 uint8_t crev = bios[bios_header_start + 3];
94
95 if ((frev < 3) ||
96 ((frev == 3) && (crev < 3)))
97 return false;
98
99 return true;
100}
89 101
90/* If you boot an IGP board with a discrete card as the primary, 102/* If you boot an IGP board with a discrete card as the primary,
91 * the IGP rom is not accessible via the rom bar as the IGP rom is 103 * the IGP rom is not accessible via the rom bar as the IGP rom is
@@ -419,26 +431,30 @@ static inline bool amdgpu_acpi_vfct_bios(struct amdgpu_device *adev)
419bool amdgpu_get_bios(struct amdgpu_device *adev) 431bool amdgpu_get_bios(struct amdgpu_device *adev)
420{ 432{
421 if (amdgpu_atrm_get_bios(adev)) 433 if (amdgpu_atrm_get_bios(adev))
422 return true; 434 goto success;
423 435
424 if (amdgpu_acpi_vfct_bios(adev)) 436 if (amdgpu_acpi_vfct_bios(adev))
425 return true; 437 goto success;
426 438
427 if (igp_read_bios_from_vram(adev)) 439 if (igp_read_bios_from_vram(adev))
428 return true; 440 goto success;
429 441
430 if (amdgpu_read_bios(adev)) 442 if (amdgpu_read_bios(adev))
431 return true; 443 goto success;
432 444
433 if (amdgpu_read_bios_from_rom(adev)) 445 if (amdgpu_read_bios_from_rom(adev))
434 return true; 446 goto success;
435 447
436 if (amdgpu_read_disabled_bios(adev)) 448 if (amdgpu_read_disabled_bios(adev))
437 return true; 449 goto success;
438 450
439 if (amdgpu_read_platform_bios(adev)) 451 if (amdgpu_read_platform_bios(adev))
440 return true; 452 goto success;
441 453
442 DRM_ERROR("Unable to locate a BIOS ROM\n"); 454 DRM_ERROR("Unable to locate a BIOS ROM\n");
443 return false; 455 return false;
456
457success:
458 adev->is_atom_fw = is_atom_fw(adev->bios);
459 return true;
444} 460}