Skip to content

Commit 19c815d

Browse files
Gangliang Xiealexdeucher
authored andcommitted
drm/amdgpu: add initialization function for pmfw eeprom
add initialization function for pmfw eeprom Signed-off-by: Gangliang Xie <ganglxie@amd.com> Reviewed-by: Tao Zhou <tao.zhou1@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 9ce015e commit 19c815d

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,42 @@ static int __read_table_ras_info(struct amdgpu_ras_eeprom_control *control)
13861386
return res == RAS_TABLE_V2_1_INFO_SIZE ? 0 : res;
13871387
}
13881388

1389+
static int amdgpu_ras_smu_eeprom_init(struct amdgpu_ras_eeprom_control *control)
1390+
{
1391+
struct amdgpu_device *adev = to_amdgpu_device(control);
1392+
struct amdgpu_ras_eeprom_table_header *hdr = &control->tbl_hdr;
1393+
struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
1394+
uint64_t local_time;
1395+
int res;
1396+
1397+
ras->is_rma = false;
1398+
1399+
if (!__is_ras_eeprom_supported(adev))
1400+
return 0;
1401+
mutex_init(&control->ras_tbl_mutex);
1402+
1403+
res = amdgpu_ras_smu_get_table_version(adev, &(hdr->version));
1404+
if (res)
1405+
return res;
1406+
1407+
res = amdgpu_ras_smu_get_badpage_count(adev,
1408+
&(control->ras_num_recs), 100);
1409+
if (res)
1410+
return res;
1411+
1412+
local_time = (uint64_t)ktime_get_real_seconds();
1413+
res = amdgpu_ras_smu_set_timestamp(adev, local_time);
1414+
if (res)
1415+
return res;
1416+
1417+
control->ras_max_record_count = 4000;
1418+
1419+
control->ras_num_mca_recs = 0;
1420+
control->ras_num_pa_recs = 0;
1421+
1422+
return 0;
1423+
}
1424+
13891425
int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
13901426
{
13911427
struct amdgpu_device *adev = to_amdgpu_device(control);
@@ -1394,6 +1430,9 @@ int amdgpu_ras_eeprom_init(struct amdgpu_ras_eeprom_control *control)
13941430
struct amdgpu_ras *ras = amdgpu_ras_get_context(adev);
13951431
int res;
13961432

1433+
if (amdgpu_ras_smu_eeprom_supported(adev))
1434+
return amdgpu_ras_smu_eeprom_init(control);
1435+
13971436
ras->is_rma = false;
13981437

13991438
if (!__is_ras_eeprom_supported(adev))

0 commit comments

Comments
 (0)