Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2006 Intel Corp. |
| 4 | * Tom Long Nguyen (tom.l.nguyen@intel.com) |
| 5 | * Zhang Yanmin (yanmin.zhang@intel.com) |
| 6 | */ |
| 7 | |
| 8 | #ifndef _AER_H_ |
| 9 | #define _AER_H_ |
| 10 | |
Sudip Mukherjee | c89e5b8 | 2015-12-23 21:05:26 +0530 | [diff] [blame] | 11 | #include <linux/errno.h> |
Thierry Reding | efd01a7 | 2014-08-05 14:08:55 +0200 | [diff] [blame] | 12 | #include <linux/types.h> |
| 13 | |
Betty Dall | 9e50a91 | 2013-06-06 12:10:49 -0600 | [diff] [blame] | 14 | #define AER_NONFATAL 0 |
| 15 | #define AER_FATAL 1 |
| 16 | #define AER_CORRECTABLE 2 |
| 17 | |
Mike Qiu | 5ccb822 | 2014-07-29 10:49:25 -0700 | [diff] [blame] | 18 | struct pci_dev; |
| 19 | |
Huang Ying | c413d76 | 2011-02-21 13:54:43 +0800 | [diff] [blame] | 20 | struct aer_header_log_regs { |
| 21 | unsigned int dw0; |
| 22 | unsigned int dw1; |
| 23 | unsigned int dw2; |
| 24 | unsigned int dw3; |
| 25 | }; |
| 26 | |
| 27 | struct aer_capability_regs { |
| 28 | u32 header; |
| 29 | u32 uncor_status; |
| 30 | u32 uncor_mask; |
| 31 | u32 uncor_severity; |
| 32 | u32 cor_status; |
| 33 | u32 cor_mask; |
| 34 | u32 cap_control; |
| 35 | struct aer_header_log_regs header_log; |
| 36 | u32 root_command; |
| 37 | u32 root_status; |
| 38 | u16 cor_err_source; |
| 39 | u16 uncor_err_source; |
| 40 | }; |
| 41 | |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 42 | #if defined(CONFIG_PCIEAER) |
Bjorn Helgaas | 96291d5 | 2017-09-01 16:35:50 -0500 | [diff] [blame] | 43 | /* PCIe port driver needs this function to enable AER */ |
Betty Dall | fde41b9 | 2013-06-06 14:35:35 -0600 | [diff] [blame] | 44 | int pci_enable_pcie_error_reporting(struct pci_dev *dev); |
| 45 | int pci_disable_pcie_error_reporting(struct pci_dev *dev); |
| 46 | int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); |
Taku Izumi | b07461a | 2015-09-17 10:09:37 -0500 | [diff] [blame] | 47 | int pci_cleanup_aer_error_status_regs(struct pci_dev *dev); |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 48 | #else |
Randy Dunlap | 5547bbe | 2007-08-23 10:37:53 -0700 | [diff] [blame] | 49 | static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) |
| 50 | { |
| 51 | return -EINVAL; |
| 52 | } |
Randy Dunlap | 5547bbe | 2007-08-23 10:37:53 -0700 | [diff] [blame] | 53 | static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) |
| 54 | { |
| 55 | return -EINVAL; |
| 56 | } |
| 57 | static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) |
| 58 | { |
| 59 | return -EINVAL; |
| 60 | } |
Taku Izumi | b07461a | 2015-09-17 10:09:37 -0500 | [diff] [blame] | 61 | static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) |
| 62 | { |
| 63 | return -EINVAL; |
| 64 | } |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 65 | #endif |
| 66 | |
Tyler Baicar | 95c3549 | 2016-09-14 15:14:45 -0600 | [diff] [blame] | 67 | void cper_print_aer(struct pci_dev *dev, int aer_severity, |
Betty Dall | fde41b9 | 2013-06-06 14:35:35 -0600 | [diff] [blame] | 68 | struct aer_capability_regs *aer); |
| 69 | int cper_severity_to_aer(int cper_severity); |
| 70 | void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, |
Bjorn Helgaas | 96291d5 | 2017-09-01 16:35:50 -0500 | [diff] [blame] | 71 | int severity, struct aer_capability_regs *aer_regs); |
Zhang, Yanmin | 6c2b374 | 2006-07-31 15:21:33 +0800 | [diff] [blame] | 72 | #endif //_AER_H_ |
| 73 | |