blob: 4fef65e5702396bab72e501d158b2c514d279127 [file] [log] [blame]
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +08001/*
2 * Copyright (C) 2006 Intel Corp.
3 * Tom Long Nguyen (tom.l.nguyen@intel.com)
4 * Zhang Yanmin (yanmin.zhang@intel.com)
5 */
6
7#ifndef _AER_H_
8#define _AER_H_
9
Thierry Redingefd01a72014-08-05 14:08:55 +020010#include <linux/types.h>
11
Betty Dall9e50a912013-06-06 12:10:49 -060012#define AER_NONFATAL 0
13#define AER_FATAL 1
14#define AER_CORRECTABLE 2
15
Mike Qiu5ccb8222014-07-29 10:49:25 -070016struct pci_dev;
17
Huang Yingc413d762011-02-21 13:54:43 +080018struct aer_header_log_regs {
19 unsigned int dw0;
20 unsigned int dw1;
21 unsigned int dw2;
22 unsigned int dw3;
23};
24
25struct aer_capability_regs {
26 u32 header;
27 u32 uncor_status;
28 u32 uncor_mask;
29 u32 uncor_severity;
30 u32 cor_status;
31 u32 cor_mask;
32 u32 cap_control;
33 struct aer_header_log_regs header_log;
34 u32 root_command;
35 u32 root_status;
36 u16 cor_err_source;
37 u16 uncor_err_source;
38};
39
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080040#if defined(CONFIG_PCIEAER)
41/* pci-e port driver needs this function to enable aer */
Betty Dallfde41b92013-06-06 14:35:35 -060042int pci_enable_pcie_error_reporting(struct pci_dev *dev);
43int pci_disable_pcie_error_reporting(struct pci_dev *dev);
44int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080045#else
Randy Dunlap5547bbe2007-08-23 10:37:53 -070046static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
47{
48 return -EINVAL;
49}
Randy Dunlap5547bbe2007-08-23 10:37:53 -070050static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev)
51{
52 return -EINVAL;
53}
54static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
55{
56 return -EINVAL;
57}
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080058#endif
59
Linus Torvalds862f0012013-07-03 16:31:35 -070060void cper_print_aer(struct pci_dev *dev, int cper_severity,
Betty Dallfde41b92013-06-06 14:35:35 -060061 struct aer_capability_regs *aer);
62int cper_severity_to_aer(int cper_severity);
63void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
Linus Torvalds862f0012013-07-03 16:31:35 -070064 int severity,
65 struct aer_capability_regs *aer_regs);
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080066#endif //_AER_H_
67