23 #include <linux/kernel.h>
24 #include <linux/module.h>
26 #include <linux/pci.h>
28 #include <linux/errno.h>
29 #include "../../pci.h"
31 #define ECRC_POLICY_DEFAULT 0
32 #define ECRC_POLICY_OFF 1
33 #define ECRC_POLICY_ON 2
37 static const char *ecrc_policy_str[] = {
49 static int enable_ecrc_checking(
struct pci_dev *
dev)
54 if (!pci_is_pcie(dev))
61 pci_read_config_dword(dev, pos +
PCI_ERR_CAP, ®32);
66 pci_write_config_dword(dev, pos +
PCI_ERR_CAP, reg32);
77 static int disable_ecrc_checking(
struct pci_dev *dev)
82 if (!pci_is_pcie(dev))
89 pci_read_config_dword(dev, pos +
PCI_ERR_CAP, ®32);
91 pci_write_config_dword(dev, pos +
PCI_ERR_CAP, reg32);
102 switch (ecrc_policy) {
106 disable_ecrc_checking(dev);
109 enable_ecrc_checking(dev);
123 for (i = 0; i <
ARRAY_SIZE(ecrc_policy_str); i++)
124 if (!
strncmp(str, ecrc_policy_str[i],
125 strlen(ecrc_policy_str[i])))