#define pr_fmt(fmt) …
#define dev_fmt …
#include <linux/bitops.h>
#include <linux/cper.h>
#include <linux/pci.h>
#include <linux/pci-acpi.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/pm.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/kfifo.h>
#include <linux/slab.h>
#include <acpi/apei.h>
#include <acpi/ghes.h>
#include <ras/ras_event.h>
#include "../pci.h"
#include "portdrv.h"
#define AER_ERROR_SOURCES_MAX …
#define AER_MAX_TYPEOF_COR_ERRS …
#define AER_MAX_TYPEOF_UNCOR_ERRS …
struct aer_err_source { … };
struct aer_rpc { … };
struct aer_stats { … };
#define AER_LOG_TLP_MASKS …
#define SYSTEM_ERROR_INTR_ON_MESG_MASK …
#define ROOT_PORT_INTR_ON_MESG_MASK …
#define ERR_COR_ID(d) …
#define ERR_UNCOR_ID(d) …
#define AER_ERR_STATUS_MASK …
static int pcie_aer_disable;
static pci_ers_result_t aer_root_reset(struct pci_dev *dev);
void pci_no_aer(void)
{ … }
bool pci_aer_available(void)
{ … }
#ifdef CONFIG_PCIE_ECRC
#define ECRC_POLICY_DEFAULT …
#define ECRC_POLICY_OFF …
#define ECRC_POLICY_ON …
static int ecrc_policy = …;
static const char * const ecrc_policy_str[] = …;
static int enable_ecrc_checking(struct pci_dev *dev)
{ … }
static int disable_ecrc_checking(struct pci_dev *dev)
{ … }
void pcie_set_ecrc_checking(struct pci_dev *dev)
{ … }
void pcie_ecrc_get_policy(char *str)
{ … }
#endif
#define PCI_EXP_AER_FLAGS …
int pcie_aer_is_native(struct pci_dev *dev)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static int pci_enable_pcie_error_reporting(struct pci_dev *dev)
{ … }
int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
void pci_aer_clear_fatal_status(struct pci_dev *dev)
{ … }
int pci_aer_raw_clear_status(struct pci_dev *dev)
{ … }
int pci_aer_clear_status(struct pci_dev *dev)
{ … }
void pci_save_aer_state(struct pci_dev *dev)
{ … }
void pci_restore_aer_state(struct pci_dev *dev)
{ … }
void pci_aer_init(struct pci_dev *dev)
{ … }
void pci_aer_exit(struct pci_dev *dev)
{ … }
#define AER_AGENT_RECEIVER …
#define AER_AGENT_REQUESTER …
#define AER_AGENT_COMPLETER …
#define AER_AGENT_TRANSMITTER …
#define AER_AGENT_REQUESTER_MASK(t) …
#define AER_AGENT_COMPLETER_MASK(t) …
#define AER_AGENT_TRANSMITTER_MASK(t) …
#define AER_GET_AGENT(t, e) …
#define AER_PHYSICAL_LAYER_ERROR …
#define AER_DATA_LINK_LAYER_ERROR …
#define AER_TRANSACTION_LAYER_ERROR …
#define AER_PHYSICAL_LAYER_ERROR_MASK(t) …
#define AER_DATA_LINK_LAYER_ERROR_MASK(t) …
#define AER_GET_LAYER_ERROR(t, e) …
static const char * const aer_error_severity_string[] = …;
static const char *aer_error_layer[] = …;
static const char *aer_correctable_error_string[] = …;
static const char *aer_uncorrectable_error_string[] = …;
static const char *aer_agent_string[] = …;
#define aer_stats_dev_attr(name, stats_array, strings_array, \
total_string, total_field) …
aer_stats_dev_attr(…) …;
aer_stats_dev_attr(…) …;
aer_stats_dev_attr(…) …;
#define aer_stats_rootport_attr(name, field) …
aer_stats_rootport_attr(…) …;
aer_stats_rootport_attr(…) …;
aer_stats_rootport_attr(…) …;
static struct attribute *aer_stats_attrs[] __ro_after_init = …;
static umode_t aer_stats_attrs_are_visible(struct kobject *kobj,
struct attribute *a, int n)
{ … }
const struct attribute_group aer_stats_attr_group = …;
static void pci_dev_aer_stats_incr(struct pci_dev *pdev,
struct aer_err_info *info)
{ … }
static void pci_rootport_aer_stats_incr(struct pci_dev *pdev,
struct aer_err_source *e_src)
{ … }
static void __print_tlp_header(struct pci_dev *dev, struct pcie_tlp_log *t)
{ … }
static void __aer_print_error(struct pci_dev *dev,
struct aer_err_info *info)
{ … }
void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
{ … }
static void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)
{ … }
#ifdef CONFIG_ACPI_APEI_PCIEAER
int cper_severity_to_aer(int cper_severity)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
void pci_print_aer(struct pci_dev *dev, int aer_severity,
struct aer_capability_regs *aer)
{ … }
EXPORT_SYMBOL_NS_GPL(…);
static int add_error_device(struct aer_err_info *e_info, struct pci_dev *dev)
{ … }
static bool is_error_source(struct pci_dev *dev, struct aer_err_info *e_info)
{ … }
static int find_device_iter(struct pci_dev *dev, void *data)
{ … }
static bool find_source_device(struct pci_dev *parent,
struct aer_err_info *e_info)
{ … }
#ifdef CONFIG_PCIEAER_CXL
static void pci_aer_unmask_internal_errors(struct pci_dev *dev)
{ … }
static bool is_cxl_mem_dev(struct pci_dev *dev)
{ … }
static bool cxl_error_is_native(struct pci_dev *dev)
{ … }
static bool is_internal_error(struct aer_err_info *info)
{ … }
static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data)
{ … }
static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info)
{ … }
static int handles_cxl_error_iter(struct pci_dev *dev, void *data)
{ … }
static bool handles_cxl_errors(struct pci_dev *rcec)
{ … }
static void cxl_rch_enable_rcec(struct pci_dev *rcec)
{ … }
#else
static inline void cxl_rch_enable_rcec(struct pci_dev *dev) { }
static inline void cxl_rch_handle_error(struct pci_dev *dev,
struct aer_err_info *info) { }
#endif
static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info)
{ … }
static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info)
{ … }
#ifdef CONFIG_ACPI_APEI_PCIEAER
#define AER_RECOVER_RING_SIZE …
struct aer_recover_entry { … };
static DEFINE_KFIFO(aer_recover_ring, … } ;
static void aer_recover_work_func(struct work_struct *work)
{ … }
static DEFINE_SPINLOCK(aer_recover_ring_lock);
static DECLARE_WORK(aer_recover_work, aer_recover_work_func);
void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn,
int severity, struct aer_capability_regs *aer_regs)
{ … }
EXPORT_SYMBOL_GPL(…);
#endif
int aer_get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
{ … }
static inline void aer_process_err_devices(struct aer_err_info *e_info)
{ … }
static void aer_isr_one_error(struct aer_rpc *rpc,
struct aer_err_source *e_src)
{ … }
static irqreturn_t aer_isr(int irq, void *context)
{ … }
static irqreturn_t aer_irq(int irq, void *context)
{ … }
static void aer_enable_irq(struct pci_dev *pdev)
{ … }
static void aer_disable_irq(struct pci_dev *pdev)
{ … }
static void aer_enable_rootport(struct aer_rpc *rpc)
{ … }
static void aer_disable_rootport(struct aer_rpc *rpc)
{ … }
static void aer_remove(struct pcie_device *dev)
{ … }
static int aer_probe(struct pcie_device *dev)
{ … }
static int aer_suspend(struct pcie_device *dev)
{ … }
static int aer_resume(struct pcie_device *dev)
{ … }
static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
{ … }
static struct pcie_port_service_driver aerdriver = …;
int __init pcie_aer_init(void)
{ … }