@@ -1213,6 +1213,28 @@ static irqreturn_t aer_irq(int irq, void *context)
1213
1213
return IRQ_WAKE_THREAD ;
1214
1214
}
1215
1215
1216
+ static void aer_enable_irq (struct pci_dev * pdev )
1217
+ {
1218
+ int aer = pdev -> aer_cap ;
1219
+ u32 reg32 ;
1220
+
1221
+ /* Enable Root Port's interrupt in response to error messages */
1222
+ pci_read_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , & reg32 );
1223
+ reg32 |= ROOT_PORT_INTR_ON_MESG_MASK ;
1224
+ pci_write_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , reg32 );
1225
+ }
1226
+
1227
+ static void aer_disable_irq (struct pci_dev * pdev )
1228
+ {
1229
+ int aer = pdev -> aer_cap ;
1230
+ u32 reg32 ;
1231
+
1232
+ /* Disable Root's interrupt in response to error messages */
1233
+ pci_read_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , & reg32 );
1234
+ reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK ;
1235
+ pci_write_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , reg32 );
1236
+ }
1237
+
1216
1238
/**
1217
1239
* aer_enable_rootport - enable Root Port's interrupts when receiving messages
1218
1240
* @rpc: pointer to a Root Port data structure
@@ -1242,10 +1264,7 @@ static void aer_enable_rootport(struct aer_rpc *rpc)
1242
1264
pci_read_config_dword (pdev , aer + PCI_ERR_UNCOR_STATUS , & reg32 );
1243
1265
pci_write_config_dword (pdev , aer + PCI_ERR_UNCOR_STATUS , reg32 );
1244
1266
1245
- /* Enable Root Port's interrupt in response to error messages */
1246
- pci_read_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , & reg32 );
1247
- reg32 |= ROOT_PORT_INTR_ON_MESG_MASK ;
1248
- pci_write_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , reg32 );
1267
+ aer_enable_irq (pdev );
1249
1268
}
1250
1269
1251
1270
/**
@@ -1260,10 +1279,7 @@ static void aer_disable_rootport(struct aer_rpc *rpc)
1260
1279
int aer = pdev -> aer_cap ;
1261
1280
u32 reg32 ;
1262
1281
1263
- /* Disable Root's interrupt in response to error messages */
1264
- pci_read_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , & reg32 );
1265
- reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK ;
1266
- pci_write_config_dword (pdev , aer + PCI_ERR_ROOT_COMMAND , reg32 );
1282
+ aer_disable_irq (pdev );
1267
1283
1268
1284
/* Clear Root's error status reg */
1269
1285
pci_read_config_dword (pdev , aer + PCI_ERR_ROOT_STATUS , & reg32 );
@@ -1358,12 +1374,8 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
1358
1374
*/
1359
1375
aer = root ? root -> aer_cap : 0 ;
1360
1376
1361
- if ((host -> native_aer || pcie_ports_native ) && aer ) {
1362
- /* Disable Root's interrupt in response to error messages */
1363
- pci_read_config_dword (root , aer + PCI_ERR_ROOT_COMMAND , & reg32 );
1364
- reg32 &= ~ROOT_PORT_INTR_ON_MESG_MASK ;
1365
- pci_write_config_dword (root , aer + PCI_ERR_ROOT_COMMAND , reg32 );
1366
- }
1377
+ if ((host -> native_aer || pcie_ports_native ) && aer )
1378
+ aer_disable_irq (root );
1367
1379
1368
1380
if (type == PCI_EXP_TYPE_RC_EC || type == PCI_EXP_TYPE_RC_END ) {
1369
1381
rc = pcie_reset_flr (dev , PCI_RESET_DO_RESET );
@@ -1382,10 +1394,7 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
1382
1394
pci_read_config_dword (root , aer + PCI_ERR_ROOT_STATUS , & reg32 );
1383
1395
pci_write_config_dword (root , aer + PCI_ERR_ROOT_STATUS , reg32 );
1384
1396
1385
- /* Enable Root Port's interrupt in response to error messages */
1386
- pci_read_config_dword (root , aer + PCI_ERR_ROOT_COMMAND , & reg32 );
1387
- reg32 |= ROOT_PORT_INTR_ON_MESG_MASK ;
1388
- pci_write_config_dword (root , aer + PCI_ERR_ROOT_COMMAND , reg32 );
1397
+ aer_enable_irq (root );
1389
1398
}
1390
1399
1391
1400
return rc ? PCI_ERS_RESULT_DISCONNECT : PCI_ERS_RESULT_RECOVERED ;
0 commit comments