2017-11-01 15:07:57 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
2006-07-31 15:21:33 +08:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2006 Intel Corp.
|
|
|
|
|
* Tom Long Nguyen (tom.l.nguyen@intel.com)
|
|
|
|
|
* Zhang Yanmin (yanmin.zhang@intel.com)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _AER_H_
|
|
|
|
|
#define _AER_H_
|
|
|
|
|
|
2015-12-23 21:05:26 +05:30
|
|
|
#include <linux/errno.h>
|
2014-08-05 14:08:55 +02:00
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
2013-06-06 12:10:49 -06:00
|
|
|
#define AER_NONFATAL 0
|
|
|
|
|
#define AER_FATAL 1
|
|
|
|
|
#define AER_CORRECTABLE 2
|
2018-05-17 16:44:20 -05:00
|
|
|
#define DPC_FATAL 3
|
2013-06-06 12:10:49 -06:00
|
|
|
|
2025-01-14 19:08:35 +02:00
|
|
|
/*
|
|
|
|
|
* AER and DPC capabilities TLP Logging register sizes (PCIe r6.2, sec 7.8.4
|
|
|
|
|
* & 7.9.14).
|
|
|
|
|
*/
|
|
|
|
|
#define PCIE_STD_NUM_TLP_HEADERLOG 4
|
|
|
|
|
#define PCIE_STD_MAX_TLP_PREFIXLOG 4
|
2025-02-07 18:18:36 +02:00
|
|
|
#define PCIE_STD_MAX_TLP_HEADERLOG (PCIE_STD_NUM_TLP_HEADERLOG + 10)
|
2025-01-14 19:08:35 +02:00
|
|
|
|
2014-07-29 10:49:25 -07:00
|
|
|
struct pci_dev;
|
|
|
|
|
|
2024-02-06 15:57:15 +02:00
|
|
|
struct pcie_tlp_log {
|
2025-02-07 18:18:36 +02:00
|
|
|
union {
|
|
|
|
|
u32 dw[PCIE_STD_MAX_TLP_HEADERLOG];
|
|
|
|
|
struct {
|
|
|
|
|
u32 _do_not_use[PCIE_STD_NUM_TLP_HEADERLOG];
|
|
|
|
|
u32 prefix[PCIE_STD_MAX_TLP_PREFIXLOG];
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
u8 header_len; /* Length of the Logged TLP Header in DWORDs */
|
|
|
|
|
bool flit; /* TLP was logged when in Flit mode */
|
2011-02-21 13:54:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct aer_capability_regs {
|
|
|
|
|
u32 header;
|
|
|
|
|
u32 uncor_status;
|
|
|
|
|
u32 uncor_mask;
|
|
|
|
|
u32 uncor_severity;
|
|
|
|
|
u32 cor_status;
|
|
|
|
|
u32 cor_mask;
|
|
|
|
|
u32 cap_control;
|
2024-02-06 15:57:15 +02:00
|
|
|
struct pcie_tlp_log header_log;
|
2011-02-21 13:54:43 +08:00
|
|
|
u32 root_command;
|
|
|
|
|
u32 root_status;
|
|
|
|
|
u16 cor_err_source;
|
|
|
|
|
u16 uncor_err_source;
|
|
|
|
|
};
|
|
|
|
|
|
2006-07-31 15:21:33 +08:00
|
|
|
#if defined(CONFIG_PCIEAER)
|
2020-03-23 17:26:08 -07:00
|
|
|
int pci_aer_clear_nonfatal_status(struct pci_dev *dev);
|
2023-08-23 23:43:04 +00:00
|
|
|
int pcie_aer_is_native(struct pci_dev *dev);
|
2026-01-14 12:20:30 -06:00
|
|
|
void pci_aer_unmask_internal_errors(struct pci_dev *dev);
|
2006-07-31 15:21:33 +08:00
|
|
|
#else
|
2020-03-23 17:26:08 -07:00
|
|
|
static inline int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
|
2015-09-17 10:09:37 -05:00
|
|
|
{
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
}
|
2023-08-23 23:43:04 +00:00
|
|
|
static inline int pcie_aer_is_native(struct pci_dev *dev) { return 0; }
|
2026-01-14 12:20:30 -06:00
|
|
|
static inline void pci_aer_unmask_internal_errors(struct pci_dev *dev) { }
|
2006-07-31 15:21:33 +08:00
|
|
|
#endif
|
|
|
|
|
|
2023-10-18 19:17:05 +02:00
|
|
|
void pci_print_aer(struct pci_dev *dev, int aer_severity,
|
2013-06-06 14:35:35 -06:00
|
|
|
struct aer_capability_regs *aer);
|
|
|
|
|
int cper_severity_to_aer(int cper_severity);
|
|
|
|
|
void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
|
2017-09-01 16:35:50 -05:00
|
|
|
int severity, struct aer_capability_regs *aer_regs);
|
2006-07-31 15:21:33 +08:00
|
|
|
#endif //_AER_H_
|
|
|
|
|
|