Merge branch 'misc.namei' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_ras_eeprom.c
index 9dc3b2d..dc44c94 100644 (file)
@@ -114,27 +114,24 @@ static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev,
 static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev,
                                  struct amdgpu_ras_eeprom_control *control)
 {
-       uint8_t ras_rom_i2c_slave_addr;
+       u8 i2c_addr;
 
        if (!control)
                return false;
 
-       control->i2c_address = 0;
-
-       if (amdgpu_atomfirmware_ras_rom_addr(adev, &ras_rom_i2c_slave_addr))
-       {
-               switch (ras_rom_i2c_slave_addr) {
-               case 0xA0:
-                       control->i2c_address = 0;
-                       return true;
-               case 0xA8:
-                       control->i2c_address = 0x40000;
-                       return true;
-               default:
-                       dev_warn(adev->dev, "RAS EEPROM I2C slave address %02x not supported",
-                                ras_rom_i2c_slave_addr);
-                       return false;
-               }
+       if (amdgpu_atomfirmware_ras_rom_addr(adev, &i2c_addr)) {
+               /* The address given by VBIOS is an 8-bit, wire-format
+                * address, i.e. the most significant byte.
+                *
+                * Normalize it to a 19-bit EEPROM address. Remove the
+                * device type identifier and make it a 7-bit address;
+                * then make it a 19-bit EEPROM address. See top of
+                * amdgpu_eeprom.c.
+                */
+               i2c_addr = (i2c_addr & 0x0F) >> 1;
+               control->i2c_address = ((u32) i2c_addr) << 16;
+
+               return true;
        }
 
        switch (adev->asic_type) {