Commit | Line | Data |
---|---|---|
b2441318 | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
6c2b374d ZY |
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 | ||
c89e5b80 | 11 | #include <linux/errno.h> |
efd01a72 TR |
12 | #include <linux/types.h> |
13 | ||
9e50a912 BD |
14 | #define AER_NONFATAL 0 |
15 | #define AER_FATAL 1 | |
16 | #define AER_CORRECTABLE 2 | |
b09803b5 | 17 | #define DPC_FATAL 3 |
9e50a912 | 18 | |
5ccb8225 MQ |
19 | struct pci_dev; |
20 | ||
c413d768 HY |
21 | struct aer_header_log_regs { |
22 | unsigned int dw0; | |
23 | unsigned int dw1; | |
24 | unsigned int dw2; | |
25 | unsigned int dw3; | |
26 | }; | |
27 | ||
28 | struct aer_capability_regs { | |
29 | u32 header; | |
30 | u32 uncor_status; | |
31 | u32 uncor_mask; | |
32 | u32 uncor_severity; | |
33 | u32 cor_status; | |
34 | u32 cor_mask; | |
35 | u32 cap_control; | |
36 | struct aer_header_log_regs header_log; | |
37 | u32 root_command; | |
38 | u32 root_status; | |
39 | u16 cor_err_source; | |
40 | u16 uncor_err_source; | |
41 | }; | |
42 | ||
6c2b374d | 43 | #if defined(CONFIG_PCIEAER) |
96291d56 | 44 | /* PCIe port driver needs this function to enable AER */ |
fde41b9f BD |
45 | int pci_enable_pcie_error_reporting(struct pci_dev *dev); |
46 | int pci_disable_pcie_error_reporting(struct pci_dev *dev); | |
47 | int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev); | |
b07461a8 | 48 | int pci_cleanup_aer_error_status_regs(struct pci_dev *dev); |
6c2b374d | 49 | #else |
5547bbee RD |
50 | static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev) |
51 | { | |
52 | return -EINVAL; | |
53 | } | |
5547bbee RD |
54 | static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev) |
55 | { | |
56 | return -EINVAL; | |
57 | } | |
58 | static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev) | |
59 | { | |
60 | return -EINVAL; | |
61 | } | |
b07461a8 TI |
62 | static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev) |
63 | { | |
64 | return -EINVAL; | |
65 | } | |
6c2b374d ZY |
66 | #endif |
67 | ||
95c35491 | 68 | void cper_print_aer(struct pci_dev *dev, int aer_severity, |
fde41b9f BD |
69 | struct aer_capability_regs *aer); |
70 | int cper_severity_to_aer(int cper_severity); | |
71 | void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, | |
96291d56 | 72 | int severity, struct aer_capability_regs *aer_regs); |
6c2b374d ZY |
73 | #endif //_AER_H_ |
74 |