blob: 164049357e5cee3a54d653d883f8639fc8e85243 [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
Sudip Mukherjeec89e5b82015-12-23 21:05:26 +053010#include <linux/errno.h>
Thierry Redingefd01a72014-08-05 14:08:55 +020011#include <linux/types.h>
12
Betty Dall9e50a912013-06-06 12:10:49 -060013#define AER_NONFATAL 0
14#define AER_FATAL 1
15#define AER_CORRECTABLE 2
16
Mike Qiu5ccb8222014-07-29 10:49:25 -070017struct pci_dev;
18
Huang Yingc413d762011-02-21 13:54:43 +080019struct aer_header_log_regs {
20 unsigned int dw0;
21 unsigned int dw1;
22 unsigned int dw2;
23 unsigned int dw3;
24};
25
26struct aer_capability_regs {
27 u32 header;
28 u32 uncor_status;
29 u32 uncor_mask;
30 u32 uncor_severity;
31 u32 cor_status;
32 u32 cor_mask;
33 u32 cap_control;
34 struct aer_header_log_regs header_log;
35 u32 root_command;
36 u32 root_status;
37 u16 cor_err_source;
38 u16 uncor_err_source;
39};
40
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080041#if defined(CONFIG_PCIEAER)
42/* pci-e port driver needs this function to enable aer */
Betty Dallfde41b92013-06-06 14:35:35 -060043int pci_enable_pcie_error_reporting(struct pci_dev *dev);
44int pci_disable_pcie_error_reporting(struct pci_dev *dev);
45int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
Taku Izumib07461a2015-09-17 10:09:37 -050046int pci_cleanup_aer_error_status_regs(struct pci_dev *dev);
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080047#else
Randy Dunlap5547bbe2007-08-23 10:37:53 -070048static inline int pci_enable_pcie_error_reporting(struct pci_dev *dev)
49{
50 return -EINVAL;
51}
Randy Dunlap5547bbe2007-08-23 10:37:53 -070052static inline int pci_disable_pcie_error_reporting(struct pci_dev *dev)
53{
54 return -EINVAL;
55}
56static inline int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev)
57{
58 return -EINVAL;
59}
Taku Izumib07461a2015-09-17 10:09:37 -050060static inline int pci_cleanup_aer_error_status_regs(struct pci_dev *dev)
61{
62 return -EINVAL;
63}
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080064#endif
65
Linus Torvalds862f0012013-07-03 16:31:35 -070066void cper_print_aer(struct pci_dev *dev, int cper_severity,
Betty Dallfde41b92013-06-06 14:35:35 -060067 struct aer_capability_regs *aer);
68int cper_severity_to_aer(int cper_severity);
69void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
Linus Torvalds862f0012013-07-03 16:31:35 -070070 int severity,
71 struct aer_capability_regs *aer_regs);
Zhang, Yanmin6c2b3742006-07-31 15:21:33 +080072#endif //_AER_H_
73