Skip to content

Commit cc947bf

Browse files
Luben Tuikovalexdeucher
authored andcommitted
drm/amdgpu: Process any VBIOS RAS EEPROM address
We can now process any RAS EEPROM address from VBIOS. Generalize so as to compute the top three bits of the 19-bit EEPROM address, from any byte returned as the "i2c address" from VBIOS. Cc: John Clements <[email protected]> Cc: Hawking Zhang <[email protected]> Cc: Alex Deucher <[email protected]> Signed-off-by: Luben Tuikov <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent a6a355a commit cc947bf

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,22 @@ static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
114114
static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
115115
struct amdgpu_ras_eeprom_control *control)
116116
{
117+
u8 i2c_addr;
118+
117119
if (!control)
118120
return false;
119121

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-
}
122+
if (amdgpu_atomfirmware_ras_rom_addr(adev, &i2c_addr)) {
123+
/* The address given by VBIOS is an 8-bit, wire-format
124+
* address, i.e. the most significant byte.
125+
*
126+
* Normalize it to a 19-bit EEPROM address. Remove the
127+
* device type identifier and make it a 7-bit address;
128+
* then make it a 19-bit EEPROM address. See top of
129+
* amdgpu_eeprom.c.
130+
*/
131+
i2c_addr = (i2c_addr & 0x0F) >> 1;
132+
control->i2c_address = ((u32) i2c_addr) << 16;
132133

133134
return true;
134135
}

0 commit comments

Comments
 (0)