aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2009-09-07 04:12:25 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-09 16:49:07 -0400
commit0d90c3ac0bb89acfbf481c8b06749b00eade6545 (patch)
tree1f8bb597f08231c1f715fa6d6c72fa21089c1fef /drivers/pci/pcie
parent24dbb7beb2a207f423006c46830dfaacca5a1139 (diff)
PCI: pcie, aer: refer mask state in mask register properly
ERR_{,UN}CORRECTABLE_ERROR_MASK are set of error bits which linux know, set of PCI_ERR_COR_* and PCI_ERR_UNC_* defined in linux/pci_regs.h. This masks make aerdrv not to report errors of unknown bit, while aerdrv have ability to report such undefined errors as "Unknown Error Bit %2d". OTOH aerdrv_errprint does not have any check of setting in mask register. So it could report masked wrong error by finding bit in status without knowing that the bit is masked in the mask register. This patch changes aerdrv to use mask state in mask register propely instead of defined/hardcoded ERR_{,UN}CORRECTABLE_ERROR_MASK. This change prevents aerdrv from reporting masked error, and also enable reporting unknown errors. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Reviewed-by: Andrew Patterson <andrew.patterson@hp.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r--drivers/pci/pcie/aer/aerdrv.h4
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c28
-rw-r--r--drivers/pci/pcie/aer/aerdrv_errprint.c6
3 files changed, 17 insertions, 21 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h
index 820ea73d25f7..0db530db9439 100644
--- a/drivers/pci/pcie/aer/aerdrv.h
+++ b/drivers/pci/pcie/aer/aerdrv.h
@@ -47,9 +47,6 @@
47#define AER_TLP_HEADER_VALID_FLAG 0x00000001 47#define AER_TLP_HEADER_VALID_FLAG 0x00000001
48#define AER_MULTI_ERROR_VALID_FLAG 0x00000002 48#define AER_MULTI_ERROR_VALID_FLAG 0x00000002
49 49
50#define ERR_CORRECTABLE_ERROR_MASK 0x000031c1
51#define ERR_UNCORRECTABLE_ERROR_MASK 0x001ff010
52
53struct header_log_regs { 50struct header_log_regs {
54 unsigned int dw0; 51 unsigned int dw0;
55 unsigned int dw1; 52 unsigned int dw1;
@@ -65,6 +62,7 @@ struct aer_err_info {
65 int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */ 62 int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */
66 int flags; 63 int flags;
67 unsigned int status; /* COR/UNCOR Error Status */ 64 unsigned int status; /* COR/UNCOR Error Status */
65 unsigned int mask; /* COR/UNCOR Error Mask */
68 struct header_log_regs tlp; /* TLP Header */ 66 struct header_log_regs tlp; /* TLP Header */
69}; 67};
70 68
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c
index 4d67db8dd0d0..38b3933200ca 100644
--- a/drivers/pci/pcie/aer/aerdrv_core.c
+++ b/drivers/pci/pcie/aer/aerdrv_core.c
@@ -236,24 +236,16 @@ static int find_device_iter(struct pci_dev *dev, void *data)
236 status = 0; 236 status = 0;
237 mask = 0; 237 mask = 0;
238 if (e_info->severity == AER_CORRECTABLE) { 238 if (e_info->severity == AER_CORRECTABLE) {
239 pci_read_config_dword(dev, 239 pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, &status);
240 pos + PCI_ERR_COR_STATUS, 240 pci_read_config_dword(dev, pos + PCI_ERR_COR_MASK, &mask);
241 &status); 241 if (status & ~mask) {
242 pci_read_config_dword(dev,
243 pos + PCI_ERR_COR_MASK,
244 &mask);
245 if (status & ERR_CORRECTABLE_ERROR_MASK & ~mask) {
246 add_error_device(e_info, dev); 242 add_error_device(e_info, dev);
247 goto added; 243 goto added;
248 } 244 }
249 } else { 245 } else {
250 pci_read_config_dword(dev, 246 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, &status);
251 pos + PCI_ERR_UNCOR_STATUS, 247 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_MASK, &mask);
252 &status); 248 if (status & ~mask) {
253 pci_read_config_dword(dev,
254 pos + PCI_ERR_UNCOR_MASK,
255 &mask);
256 if (status & ERR_UNCORRECTABLE_ERROR_MASK & ~mask) {
257 add_error_device(e_info, dev); 249 add_error_device(e_info, dev);
258 goto added; 250 goto added;
259 } 251 }
@@ -720,7 +712,9 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
720 if (info->severity == AER_CORRECTABLE) { 712 if (info->severity == AER_CORRECTABLE) {
721 pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS, 713 pci_read_config_dword(dev, pos + PCI_ERR_COR_STATUS,
722 &info->status); 714 &info->status);
723 if (!(info->status & ERR_CORRECTABLE_ERROR_MASK)) 715 pci_read_config_dword(dev, pos + PCI_ERR_COR_MASK,
716 &info->mask);
717 if (!(info->status & ~info->mask))
724 return AER_UNSUCCESS; 718 return AER_UNSUCCESS;
725 } else if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE || 719 } else if (dev->hdr_type & PCI_HEADER_TYPE_BRIDGE ||
726 info->severity == AER_NONFATAL) { 720 info->severity == AER_NONFATAL) {
@@ -728,7 +722,9 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
728 /* Link is still healthy for IO reads */ 722 /* Link is still healthy for IO reads */
729 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS, 723 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_STATUS,
730 &info->status); 724 &info->status);
731 if (!(info->status & ERR_UNCORRECTABLE_ERROR_MASK)) 725 pci_read_config_dword(dev, pos + PCI_ERR_UNCOR_MASK,
726 &info->mask);
727 if (!(info->status & ~info->mask))
732 return AER_UNSUCCESS; 728 return AER_UNSUCCESS;
733 729
734 if (info->status & AER_LOG_TLP_MASKS) { 730 if (info->status & AER_LOG_TLP_MASKS) {
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
index 95c3f1ca8076..41bd1c753ace 100644
--- a/drivers/pci/pcie/aer/aerdrv_errprint.c
+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
@@ -154,11 +154,13 @@ static char *aer_agent_string[] = {
154 154
155static void aer_print_error_source(struct aer_err_info *info) 155static void aer_print_error_source(struct aer_err_info *info)
156{ 156{
157 int i; 157 int i, status;
158 char *errmsg = NULL; 158 char *errmsg = NULL;
159 159
160 status = (info->status & ~info->mask);
161
160 for (i = 0; i < 32; i++) { 162 for (i = 0; i < 32; i++) {
161 if (!(info->status & (1 << i))) 163 if (!(status & (1 << i)))
162 continue; 164 continue;
163 165
164 if (info->severity == AER_CORRECTABLE) 166 if (info->severity == AER_CORRECTABLE)