Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 1 | /* |
| 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 Reding | efd01a7 | 2014-08-05 14:08:55 +0200 | [diff] [blame] | 10 | #include <linux/types.h> |
| 11 | |
Betty Dall | 9e50a91 | 2013-06-06 12:10:49 -0600 | [diff] [blame] | 12 | #define AER_NONFATAL 0 |
| 13 | #define AER_FATAL 1 |
| 14 | #define AER_CORRECTABLE 2 |
| 15 | |
Mike Qiu | 5ccb822 | 2014-07-29 10:49:25 -0700 | [diff] [blame] | 16 | struct pci_dev; |
| 17 | |
Huang Ying | c413d76 | 2011-02-21 13:54:43 +0800 | [diff] [blame] | 18 | struct aer_header_log_regs { |
| 19 | unsigned int dw0; |
| 20 | unsigned int dw1; |
| 21 | unsigned int dw2; |
| 22 | unsigned int dw3; |
| 23 | }; |
| 24 | |
| 25 | struct 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, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 40 | #if defined(CONFIG_PCIEAER) |
| 41 | /* pci-e port driver needs this function to enable aer */ |
Betty Dall | fde41b9 | 2013-06-06 14:35:35 -0600 | [diff] [blame] | 42 | int pci_enable_pcie_error_reporting(struct pci_dev *dev); |
| 43 | int pci_disable_pcie_error_reporting(struct pci_dev *dev); |
| 44 | int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); |
Taku Izumi | b07461a | 2015-09-17 10:09:37 -0500 | [diff] [blame] | 45 | int pci_cleanup_aer_error_status_regs(struct pci_dev *dev); |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 46 | #else |
Randy Dunlap | 5547bbe | 2007-08-23 10:37:53 -0700 | [diff] [blame] | 47 | static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) |
| 48 | { |
| 49 | return -EINVAL; |
| 50 | } |
Randy Dunlap | 5547bbe | 2007-08-23 10:37:53 -0700 | [diff] [blame] | 51 | static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) |
| 52 | { |
| 53 | return -EINVAL; |
| 54 | } |
| 55 | static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) |
| 56 | { |
| 57 | return -EINVAL; |
| 58 | } |
Taku Izumi | b07461a | 2015-09-17 10:09:37 -0500 | [diff] [blame] | 59 | static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) |
| 60 | { |
| 61 | return -EINVAL; |
| 62 | } |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 63 | #endif |
| 64 | |
Linus Torvalds | 862f001 | 2013-07-03 16:31:35 -0700 | [diff] [blame] | 65 | void cper_print_aer(struct pci_dev *dev, int cper_severity, |
Betty Dall | fde41b9 | 2013-06-06 14:35:35 -0600 | [diff] [blame] | 66 | struct aer_capability_regs *aer); |
| 67 | int cper_severity_to_aer(int cper_severity); |
| 68 | void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, |
Linus Torvalds | 862f001 | 2013-07-03 16:31:35 -0700 | [diff] [blame] | 69 | int severity, |
| 70 | struct aer_capability_regs *aer_regs); |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 71 | #endif //_AER_H_ |
| 72 | |