@@ -3257,7 +3257,7 @@ static void si_gpu_init(struct radeon_device *rdev)
3257
3257
/* XXX what about 12? */
3258
3258
rdev -> config .si .tile_config |= (3 << 0 );
3259
3259
break ;
3260
- }
3260
+ }
3261
3261
switch ((mc_arb_ramcfg & NOOFBANK_MASK ) >> NOOFBANK_SHIFT ) {
3262
3262
case 0 : /* four banks */
3263
3263
rdev -> config .si .tile_config |= 0 << 4 ;
@@ -7087,7 +7087,6 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
7087
7087
{
7088
7088
struct pci_dev * root = rdev -> pdev -> bus -> self ;
7089
7089
enum pci_bus_speed speed_cap ;
7090
- int bridge_pos , gpu_pos ;
7091
7090
u32 speed_cntl , current_data_rate ;
7092
7091
int i ;
7093
7092
u16 tmp16 ;
@@ -7129,12 +7128,7 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
7129
7128
DRM_INFO ("enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0\n" );
7130
7129
}
7131
7130
7132
- bridge_pos = pci_pcie_cap (root );
7133
- if (!bridge_pos )
7134
- return ;
7135
-
7136
- gpu_pos = pci_pcie_cap (rdev -> pdev );
7137
- if (!gpu_pos )
7131
+ if (!pci_is_pcie (root ) || !pci_is_pcie (rdev -> pdev ))
7138
7132
return ;
7139
7133
7140
7134
if (speed_cap == PCIE_SPEED_8_0GT ) {
@@ -7144,14 +7138,17 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
7144
7138
u16 bridge_cfg2 , gpu_cfg2 ;
7145
7139
u32 max_lw , current_lw , tmp ;
7146
7140
7147
- pci_read_config_word (root , bridge_pos + PCI_EXP_LNKCTL , & bridge_cfg );
7148
- pci_read_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL , & gpu_cfg );
7141
+ pcie_capability_read_word (root , PCI_EXP_LNKCTL ,
7142
+ & bridge_cfg );
7143
+ pcie_capability_read_word (rdev -> pdev , PCI_EXP_LNKCTL ,
7144
+ & gpu_cfg );
7149
7145
7150
7146
tmp16 = bridge_cfg | PCI_EXP_LNKCTL_HAWD ;
7151
- pci_write_config_word (root , bridge_pos + PCI_EXP_LNKCTL , tmp16 );
7147
+ pcie_capability_write_word (root , PCI_EXP_LNKCTL , tmp16 );
7152
7148
7153
7149
tmp16 = gpu_cfg | PCI_EXP_LNKCTL_HAWD ;
7154
- pci_write_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL , tmp16 );
7150
+ pcie_capability_write_word (rdev -> pdev , PCI_EXP_LNKCTL ,
7151
+ tmp16 );
7155
7152
7156
7153
tmp = RREG32_PCIE (PCIE_LC_STATUS1 );
7157
7154
max_lw = (tmp & LC_DETECTED_LINK_WIDTH_MASK ) >> LC_DETECTED_LINK_WIDTH_SHIFT ;
@@ -7169,15 +7166,23 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
7169
7166
7170
7167
for (i = 0 ; i < 10 ; i ++ ) {
7171
7168
/* check status */
7172
- pci_read_config_word (rdev -> pdev , gpu_pos + PCI_EXP_DEVSTA , & tmp16 );
7169
+ pcie_capability_read_word (rdev -> pdev ,
7170
+ PCI_EXP_DEVSTA ,
7171
+ & tmp16 );
7173
7172
if (tmp16 & PCI_EXP_DEVSTA_TRPND )
7174
7173
break ;
7175
7174
7176
- pci_read_config_word (root , bridge_pos + PCI_EXP_LNKCTL , & bridge_cfg );
7177
- pci_read_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL , & gpu_cfg );
7175
+ pcie_capability_read_word (root , PCI_EXP_LNKCTL ,
7176
+ & bridge_cfg );
7177
+ pcie_capability_read_word (rdev -> pdev ,
7178
+ PCI_EXP_LNKCTL ,
7179
+ & gpu_cfg );
7178
7180
7179
- pci_read_config_word (root , bridge_pos + PCI_EXP_LNKCTL2 , & bridge_cfg2 );
7180
- pci_read_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL2 , & gpu_cfg2 );
7181
+ pcie_capability_read_word (root , PCI_EXP_LNKCTL2 ,
7182
+ & bridge_cfg2 );
7183
+ pcie_capability_read_word (rdev -> pdev ,
7184
+ PCI_EXP_LNKCTL2 ,
7185
+ & gpu_cfg2 );
7181
7186
7182
7187
tmp = RREG32_PCIE_PORT (PCIE_LC_CNTL4 );
7183
7188
tmp |= LC_SET_QUIESCE ;
@@ -7190,32 +7195,46 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
7190
7195
msleep (100 );
7191
7196
7192
7197
/* linkctl */
7193
- pci_read_config_word (root , bridge_pos + PCI_EXP_LNKCTL , & tmp16 );
7198
+ pcie_capability_read_word (root , PCI_EXP_LNKCTL ,
7199
+ & tmp16 );
7194
7200
tmp16 &= ~PCI_EXP_LNKCTL_HAWD ;
7195
7201
tmp16 |= (bridge_cfg & PCI_EXP_LNKCTL_HAWD );
7196
- pci_write_config_word (root , bridge_pos + PCI_EXP_LNKCTL , tmp16 );
7202
+ pcie_capability_write_word (root ,
7203
+ PCI_EXP_LNKCTL ,
7204
+ tmp16 );
7197
7205
7198
- pci_read_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL , & tmp16 );
7206
+ pcie_capability_read_word (rdev -> pdev ,
7207
+ PCI_EXP_LNKCTL ,
7208
+ & tmp16 );
7199
7209
tmp16 &= ~PCI_EXP_LNKCTL_HAWD ;
7200
7210
tmp16 |= (gpu_cfg & PCI_EXP_LNKCTL_HAWD );
7201
- pci_write_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL , tmp16 );
7211
+ pcie_capability_write_word (rdev -> pdev ,
7212
+ PCI_EXP_LNKCTL ,
7213
+ tmp16 );
7202
7214
7203
7215
/* linkctl2 */
7204
- pci_read_config_word (root , bridge_pos + PCI_EXP_LNKCTL2 , & tmp16 );
7216
+ pcie_capability_read_word (root , PCI_EXP_LNKCTL2 ,
7217
+ & tmp16 );
7205
7218
tmp16 &= ~(PCI_EXP_LNKCTL2_ENTER_COMP |
7206
7219
PCI_EXP_LNKCTL2_TX_MARGIN );
7207
7220
tmp16 |= (bridge_cfg2 &
7208
7221
(PCI_EXP_LNKCTL2_ENTER_COMP |
7209
7222
PCI_EXP_LNKCTL2_TX_MARGIN ));
7210
- pci_write_config_word (root , bridge_pos + PCI_EXP_LNKCTL2 , tmp16 );
7223
+ pcie_capability_write_word (root ,
7224
+ PCI_EXP_LNKCTL2 ,
7225
+ tmp16 );
7211
7226
7212
- pci_read_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL2 , & tmp16 );
7227
+ pcie_capability_read_word (rdev -> pdev ,
7228
+ PCI_EXP_LNKCTL2 ,
7229
+ & tmp16 );
7213
7230
tmp16 &= ~(PCI_EXP_LNKCTL2_ENTER_COMP |
7214
7231
PCI_EXP_LNKCTL2_TX_MARGIN );
7215
7232
tmp16 |= (gpu_cfg2 &
7216
7233
(PCI_EXP_LNKCTL2_ENTER_COMP |
7217
7234
PCI_EXP_LNKCTL2_TX_MARGIN ));
7218
- pci_write_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL2 , tmp16 );
7235
+ pcie_capability_write_word (rdev -> pdev ,
7236
+ PCI_EXP_LNKCTL2 ,
7237
+ tmp16 );
7219
7238
7220
7239
tmp = RREG32_PCIE_PORT (PCIE_LC_CNTL4 );
7221
7240
tmp &= ~LC_SET_QUIESCE ;
@@ -7229,15 +7248,15 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
7229
7248
speed_cntl &= ~LC_FORCE_DIS_SW_SPEED_CHANGE ;
7230
7249
WREG32_PCIE_PORT (PCIE_LC_SPEED_CNTL , speed_cntl );
7231
7250
7232
- pci_read_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL2 , & tmp16 );
7251
+ pcie_capability_read_word (rdev -> pdev , PCI_EXP_LNKCTL2 , & tmp16 );
7233
7252
tmp16 &= ~PCI_EXP_LNKCTL2_TLS ;
7234
7253
if (speed_cap == PCIE_SPEED_8_0GT )
7235
7254
tmp16 |= PCI_EXP_LNKCTL2_TLS_8_0GT ; /* gen3 */
7236
7255
else if (speed_cap == PCIE_SPEED_5_0GT )
7237
7256
tmp16 |= PCI_EXP_LNKCTL2_TLS_5_0GT ; /* gen2 */
7238
7257
else
7239
7258
tmp16 |= PCI_EXP_LNKCTL2_TLS_2_5GT ; /* gen1 */
7240
- pci_write_config_word (rdev -> pdev , gpu_pos + PCI_EXP_LNKCTL2 , tmp16 );
7259
+ pcie_capability_write_word (rdev -> pdev , PCI_EXP_LNKCTL2 , tmp16 );
7241
7260
7242
7261
speed_cntl = RREG32_PCIE_PORT (PCIE_LC_SPEED_CNTL );
7243
7262
speed_cntl |= LC_INITIATE_LINK_SPEED_CHANGE ;
0 commit comments