18 #include <linux/module.h>
19 #include <linux/pci.h>
21 #include <linux/sched.h>
22 #include <linux/kernel.h>
23 #include <linux/errno.h>
29 #include <linux/slab.h>
32 #include "../../pci.h"
37 #define DRIVER_VERSION "v1.0"
39 #define DRIVER_DESC "Root Port Advanced Error Reporting Driver"
48 static void aer_error_resume(
struct pci_dev *
dev);
52 .error_detected = aer_error_detected,
53 .resume = aer_error_resume,
64 .err_handler = &aer_error_handlers,
66 .reset_link = aer_root_reset,
69 static int pcie_aer_disable;
81 static int set_device_error_reporting(
struct pci_dev *
dev,
void *
data)
83 bool enable = *((
bool *)data);
84 int type = pci_pcie_type(dev);
106 static void set_downstream_devices_error_reporting(
struct pci_dev *dev,
109 set_device_error_reporting(dev, &enable);
122 static void aer_enable_rootport(
struct aer_rpc *
rpc)
150 set_downstream_devices_error_reporting(pdev,
true);
164 static void aer_disable_rootport(
struct aer_rpc *
rpc)
174 set_downstream_devices_error_reporting(pdev,
false);
213 spin_unlock_irqrestore(&rpc->
e_lock, flags);
225 if (next_prod_idx == rpc->
cons_idx) {
230 spin_unlock_irqrestore(&rpc->
e_lock, flags);
236 spin_unlock_irqrestore(&rpc->
e_lock, flags);
268 set_service_data(dev, rpc);
281 struct aer_rpc *rpc = get_service_data(dev);
290 aer_disable_rootport(rpc);
292 set_service_data(dev,
NULL);
315 rpc = aer_alloc_rpc(dev);
317 dev_printk(
KERN_DEBUG, device,
"alloc rpc failed\n");
325 dev_printk(
KERN_DEBUG, device,
"request IRQ failed\n");
332 aer_enable_rootport(rpc);
356 dev_printk(
KERN_DEBUG, &dev->
dev,
"Root Port link has been reset\n");
390 static void aer_error_resume(
struct pci_dev *dev)
416 static int __init aer_service_init(
void)
428 static void __exit aer_service_exit(
void)