|
106 | 106 | #define to_amdgpu_device(x) (container_of(x, struct amdgpu_ras, eeprom_control))->adev |
107 | 107 |
|
108 | 108 | static bool __is_ras_eeprom_supported(struct amdgpu_device *adev) |
109 | | -{ |
110 | | - if (adev->asic_type == CHIP_IP_DISCOVERY) { |
111 | | - switch (adev->ip_versions[MP1_HWIP][0]) { |
112 | | - case IP_VERSION(13, 0, 0): |
113 | | - case IP_VERSION(13, 0, 10): |
114 | | - return true; |
115 | | - default: |
116 | | - return false; |
117 | | - } |
118 | | - } |
119 | | - |
120 | | - return adev->asic_type == CHIP_VEGA20 || |
121 | | - adev->asic_type == CHIP_ARCTURUS || |
122 | | - adev->asic_type == CHIP_SIENNA_CICHLID || |
123 | | - adev->asic_type == CHIP_ALDEBARAN; |
124 | | -} |
125 | | - |
126 | | -static bool __get_eeprom_i2c_addr_arct(struct amdgpu_device *adev, |
127 | | - struct amdgpu_ras_eeprom_control *control) |
128 | | -{ |
129 | | - struct atom_context *atom_ctx = adev->mode_info.atom_context; |
130 | | - |
131 | | - if (!control || !atom_ctx) |
132 | | - return false; |
133 | | - |
134 | | - if (strnstr(atom_ctx->vbios_version, |
135 | | - "D342", |
136 | | - sizeof(atom_ctx->vbios_version))) |
137 | | - control->i2c_address = EEPROM_I2C_MADDR_0; |
138 | | - else |
139 | | - control->i2c_address = EEPROM_I2C_MADDR_4; |
140 | | - |
141 | | - return true; |
142 | | -} |
143 | | - |
144 | | -static bool __get_eeprom_i2c_addr_ip_discovery(struct amdgpu_device *adev, |
145 | | - struct amdgpu_ras_eeprom_control *control) |
146 | 109 | { |
147 | 110 | switch (adev->ip_versions[MP1_HWIP][0]) { |
| 111 | + case IP_VERSION(11, 0, 2): /* VEGA20 and ARCTURUS */ |
| 112 | + case IP_VERSION(11, 0, 7): /* Sienna cichlid */ |
148 | 113 | case IP_VERSION(13, 0, 0): |
| 114 | + case IP_VERSION(13, 0, 2): /* Aldebaran */ |
149 | 115 | case IP_VERSION(13, 0, 10): |
150 | | - control->i2c_address = EEPROM_I2C_MADDR_4; |
151 | 116 | return true; |
152 | 117 | default: |
153 | 118 | return false; |
@@ -178,29 +143,32 @@ static bool __get_eeprom_i2c_addr(struct amdgpu_device *adev, |
178 | 143 | return true; |
179 | 144 | } |
180 | 145 |
|
181 | | - switch (adev->asic_type) { |
182 | | - case CHIP_VEGA20: |
183 | | - control->i2c_address = EEPROM_I2C_MADDR_0; |
| 146 | + switch (adev->ip_versions[MP1_HWIP][0]) { |
| 147 | + case IP_VERSION(11, 0, 2): |
| 148 | + /* VEGA20 and ARCTURUS */ |
| 149 | + if (adev->asic_type == CHIP_VEGA20) |
| 150 | + control->i2c_address = EEPROM_I2C_MADDR_0; |
| 151 | + else if (strnstr(atom_ctx->vbios_version, |
| 152 | + "D342", |
| 153 | + sizeof(atom_ctx->vbios_version))) |
| 154 | + control->i2c_address = EEPROM_I2C_MADDR_0; |
| 155 | + else |
| 156 | + control->i2c_address = EEPROM_I2C_MADDR_4; |
184 | 157 | return true; |
185 | | - |
186 | | - case CHIP_ARCTURUS: |
187 | | - return __get_eeprom_i2c_addr_arct(adev, control); |
188 | | - |
189 | | - case CHIP_SIENNA_CICHLID: |
| 158 | + case IP_VERSION(11, 0, 7): |
190 | 159 | control->i2c_address = EEPROM_I2C_MADDR_0; |
191 | 160 | return true; |
192 | | - |
193 | | - case CHIP_ALDEBARAN: |
| 161 | + case IP_VERSION(13, 0, 2): |
194 | 162 | if (strnstr(atom_ctx->vbios_version, "D673", |
195 | 163 | sizeof(atom_ctx->vbios_version))) |
196 | 164 | control->i2c_address = EEPROM_I2C_MADDR_4; |
197 | 165 | else |
198 | 166 | control->i2c_address = EEPROM_I2C_MADDR_0; |
199 | 167 | return true; |
200 | | - |
201 | | - case CHIP_IP_DISCOVERY: |
202 | | - return __get_eeprom_i2c_addr_ip_discovery(adev, control); |
203 | | - |
| 168 | + case IP_VERSION(13, 0, 0): |
| 169 | + case IP_VERSION(13, 0, 10): |
| 170 | + control->i2c_address = EEPROM_I2C_MADDR_4; |
| 171 | + return true; |
204 | 172 | default: |
205 | 173 | return false; |
206 | 174 | } |
|
0 commit comments