Skip to content

Commit 14fb496

Browse files
John Clementsalexdeucher
authored andcommitted
drm/amdgpu: set RAS EEPROM address from VBIOS
update to latest atombios fw table Signed-off-by: John Clements <[email protected]> Reviewed-by: Hawking Zhang <[email protected]>. Signed-off-by: Alex Deucher <[email protected]>
1 parent 564e3dc commit 14fb496

File tree

4 files changed

+59
-1
lines changed

4 files changed

+59
-1
lines changed

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

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,46 @@ bool amdgpu_atomfirmware_dynamic_boot_config_supported(struct amdgpu_device *ade
468468
return (fw_cap & ATOM_FIRMWARE_CAP_DYNAMIC_BOOT_CFG_ENABLE) ? true : false;
469469
}
470470

471+
/*
472+
* Helper function to query RAS EEPROM address
473+
*
474+
* @adev: amdgpu_device pointer
475+
*
476+
* Return true if vbios supports ras rom address reporting
477+
*/
478+
bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address)
479+
{
480+
struct amdgpu_mode_info *mode_info = &adev->mode_info;
481+
int index;
482+
u16 data_offset, size;
483+
union firmware_info *firmware_info;
484+
u8 frev, crev;
485+
486+
if (i2c_address == NULL)
487+
return false;
488+
489+
*i2c_address = 0;
490+
491+
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
492+
firmwareinfo);
493+
494+
if (amdgpu_atom_parse_data_header(adev->mode_info.atom_context,
495+
index, &size, &frev, &crev, &data_offset)) {
496+
/* support firmware_info 3.4 + */
497+
if ((frev == 3 && crev >=4) || (frev > 3)) {
498+
firmware_info = (union firmware_info *)
499+
(mode_info->atom_context->bios + data_offset);
500+
*i2c_address = firmware_info->v34.ras_rom_i2c_slave_addr;
501+
}
502+
}
503+
504+
if (*i2c_address != 0)
505+
return true;
506+
507+
return false;
508+
}
509+
510+
471511
union smu_info {
472512
struct atom_smu_info_v3_1 v31;
473513
};

drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev);
3636
int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev);
3737
bool amdgpu_atomfirmware_mem_ecc_supported(struct amdgpu_device *adev);
3838
bool amdgpu_atomfirmware_sram_ecc_supported(struct amdgpu_device *adev);
39+
bool amdgpu_atomfirmware_ras_rom_addr(struct amdgpu_device *adev, uint8_t* i2c_address);
3940
bool amdgpu_atomfirmware_mem_training_supported(struct amdgpu_device *adev);
4041
bool amdgpu_atomfirmware_dynamic_boot_config_supported(struct amdgpu_device *adev);
4142
int amdgpu_atomfirmware_get_fw_reserved_fb_size(struct amdgpu_device *adev);

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/bits.h>
2828
#include "atom.h"
2929
#include "amdgpu_eeprom.h"
30+
#include "amdgpu_atomfirmware.h"
3031
#include <linux/debugfs.h>
3132
#include <linux/uaccess.h>
3233

@@ -116,6 +117,22 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
116117
if (!control)
117118
return false;
118119

120+
control->i2c_address = 0;
121+
122+
if (amdgpu_atomfirmware_ras_rom_addr(adev, (uint8_t*)&control->i2c_address))
123+
{
124+
if (control->i2c_address == 0xA0)
125+
control->i2c_address = 0;
126+
else if (control->i2c_address == 0xA8)
127+
control->i2c_address = 0x40000;
128+
else {
129+
dev_warn(adev->dev, "RAS EEPROM I2C address not supported");
130+
return false;
131+
}
132+
133+
return true;
134+
}
135+
119136
switch (adev->asic_type) {
120137
case CHIP_VEGA20:
121138
control->i2c_address = EEPROM_I2C_MADDR_VEGA20;

drivers/gpu/drm/amd/include/atomfirmware.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ struct atom_firmware_info_v3_4 {
590590
uint8_t board_i2c_feature_id; // enum of atom_board_i2c_feature_id_def
591591
uint8_t board_i2c_feature_gpio_id; // i2c id find in gpio_lut data table gpio_id
592592
uint8_t board_i2c_feature_slave_addr;
593-
uint8_t reserved3;
593+
uint8_t ras_rom_i2c_slave_addr;
594594
uint16_t bootup_mvddq_mv;
595595
uint16_t bootup_mvpp_mv;
596596
uint32_t zfbstartaddrin16mb;

0 commit comments

Comments
 (0)