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 _AERDRV_H_
|
|
|
|
#define _AERDRV_H_
|
|
|
|
|
Detach sched.h from mm.h
First thing mm.h does is including sched.h solely for can_do_mlock() inline
function which has "current" dereference inside. By dealing with can_do_mlock()
mm.h can be detached from sched.h which is good. See below, why.
This patch
a) removes unconditional inclusion of sched.h from mm.h
b) makes can_do_mlock() normal function in mm/mlock.c
c) exports can_do_mlock() to not break compilation
d) adds sched.h inclusions back to files that were getting it indirectly.
e) adds less bloated headers to some files (asm/signal.h, jiffies.h) that were
getting them indirectly
Net result is:
a) mm.h users would get less code to open, read, preprocess, parse, ... if
they don't need sched.h
b) sched.h stops being dependency for significant number of files:
on x86_64 allmodconfig touching sched.h results in recompile of 4083 files,
after patch it's only 3744 (-8.3%).
Cross-compile tested on
all arm defconfigs, all mips defconfigs, all powerpc defconfigs,
alpha alpha-up
arm
i386 i386-up i386-defconfig i386-allnoconfig
ia64 ia64-up
m68k
mips
parisc parisc-up
powerpc powerpc-up
s390 s390-up
sparc sparc-up
sparc64 sparc64-up
um-x86_64
x86_64 x86_64-up x86_64-defconfig x86_64-allnoconfig
as well as my two usual configs.
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-21 05:22:52 +08:00
|
|
|
#include <linux/workqueue.h>
|
2006-07-31 15:21:33 +08:00
|
|
|
#include <linux/pcieport_if.h>
|
|
|
|
#include <linux/aer.h>
|
2009-04-24 10:45:23 +08:00
|
|
|
#include <linux/interrupt.h>
|
2006-07-31 15:21:33 +08:00
|
|
|
|
|
|
|
#define AER_NONFATAL 0
|
|
|
|
#define AER_FATAL 1
|
|
|
|
#define AER_CORRECTABLE 2
|
|
|
|
|
|
|
|
/* Root Error Status Register Bits */
|
PCI: pcie, aer: checkpatch style cleanup in pcie/aer/*
Before:
drivers/pci/pcie/aer/aer_inject.c
total: 4 errors, 4 warnings, 473 lines checked
drivers/pci/pcie/aer/aerdrv.c
total: 5 errors, 2 warnings, 333 lines checked
drivers/pci/pcie/aer/aerdrv.h
total: 1 errors, 0 warnings, 139 lines checked
drivers/pci/pcie/aer/aerdrv_core.c
total: 4 errors, 3 warnings, 872 lines checked
drivers/pci/pcie/aer/aerdrv_errprint.c
total: 12 errors, 11 warnings, 248 lines checked
After:
drivers/pci/pcie/aer/aer_inject.c
total: 0 errors, 0 warnings, 466 lines checked
drivers/pci/pcie/aer/aerdrv.c
total: 0 errors, 0 warnings, 335 lines checked
drivers/pci/pcie/aer/aerdrv.h
total: 0 errors, 0 warnings, 139 lines checked
drivers/pci/pcie/aer/aerdrv_core.c
total: 0 errors, 0 warnings, 869 lines checked
drivers/pci/pcie/aer/aerdrv_errprint.c
total: 0 errors, 10 warnings, 247 lines checked
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-07 16:07:29 +08:00
|
|
|
#define ROOT_ERR_STATUS_MASKS 0x0f
|
2006-07-31 15:21:33 +08:00
|
|
|
|
|
|
|
#define SYSTEM_ERROR_INTR_ON_MESG_MASK (PCI_EXP_RTCTL_SECEE| \
|
|
|
|
PCI_EXP_RTCTL_SENFEE| \
|
|
|
|
PCI_EXP_RTCTL_SEFEE)
|
|
|
|
#define ROOT_PORT_INTR_ON_MESG_MASK (PCI_ERR_ROOT_CMD_COR_EN| \
|
|
|
|
PCI_ERR_ROOT_CMD_NONFATAL_EN| \
|
|
|
|
PCI_ERR_ROOT_CMD_FATAL_EN)
|
|
|
|
#define ERR_COR_ID(d) (d & 0xffff)
|
|
|
|
#define ERR_UNCOR_ID(d) (d >> 16)
|
|
|
|
|
|
|
|
#define AER_SUCCESS 0
|
|
|
|
#define AER_UNSUCCESS 1
|
|
|
|
#define AER_ERROR_SOURCES_MAX 100
|
|
|
|
|
|
|
|
#define AER_LOG_TLP_MASKS (PCI_ERR_UNC_POISON_TLP| \
|
|
|
|
PCI_ERR_UNC_ECRC| \
|
|
|
|
PCI_ERR_UNC_UNSUP| \
|
|
|
|
PCI_ERR_UNC_COMP_ABORT| \
|
|
|
|
PCI_ERR_UNC_UNX_COMP| \
|
|
|
|
PCI_ERR_UNC_MALF_TLP)
|
|
|
|
|
|
|
|
/* AER Error Info Flags */
|
|
|
|
#define AER_TLP_HEADER_VALID_FLAG 0x00000001
|
|
|
|
#define AER_MULTI_ERROR_VALID_FLAG 0x00000002
|
|
|
|
|
|
|
|
struct header_log_regs {
|
|
|
|
unsigned int dw0;
|
|
|
|
unsigned int dw1;
|
|
|
|
unsigned int dw2;
|
|
|
|
unsigned int dw3;
|
|
|
|
};
|
|
|
|
|
2009-06-16 13:35:16 +08:00
|
|
|
#define AER_MAX_MULTI_ERR_DEVICES 5 /* Not likely to have more */
|
2006-07-31 15:21:33 +08:00
|
|
|
struct aer_err_info {
|
2009-06-16 13:35:16 +08:00
|
|
|
struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES];
|
|
|
|
int error_dev_num;
|
2009-06-16 13:35:11 +08:00
|
|
|
u16 id;
|
2006-07-31 15:21:33 +08:00
|
|
|
int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */
|
|
|
|
int flags;
|
2009-09-07 16:13:42 +08:00
|
|
|
int first;
|
2006-07-31 15:21:33 +08:00
|
|
|
unsigned int status; /* COR/UNCOR Error Status */
|
2009-09-07 16:12:25 +08:00
|
|
|
unsigned int mask; /* COR/UNCOR Error Mask */
|
PCI: pcie, aer: checkpatch style cleanup in pcie/aer/*
Before:
drivers/pci/pcie/aer/aer_inject.c
total: 4 errors, 4 warnings, 473 lines checked
drivers/pci/pcie/aer/aerdrv.c
total: 5 errors, 2 warnings, 333 lines checked
drivers/pci/pcie/aer/aerdrv.h
total: 1 errors, 0 warnings, 139 lines checked
drivers/pci/pcie/aer/aerdrv_core.c
total: 4 errors, 3 warnings, 872 lines checked
drivers/pci/pcie/aer/aerdrv_errprint.c
total: 12 errors, 11 warnings, 248 lines checked
After:
drivers/pci/pcie/aer/aer_inject.c
total: 0 errors, 0 warnings, 466 lines checked
drivers/pci/pcie/aer/aerdrv.c
total: 0 errors, 0 warnings, 335 lines checked
drivers/pci/pcie/aer/aerdrv.h
total: 0 errors, 0 warnings, 139 lines checked
drivers/pci/pcie/aer/aerdrv_core.c
total: 0 errors, 0 warnings, 869 lines checked
drivers/pci/pcie/aer/aerdrv_errprint.c
total: 0 errors, 10 warnings, 247 lines checked
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-07 16:07:29 +08:00
|
|
|
struct header_log_regs tlp; /* TLP Header */
|
2006-07-31 15:21:33 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct aer_err_source {
|
|
|
|
unsigned int status;
|
|
|
|
unsigned int id;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct aer_rpc {
|
|
|
|
struct pcie_device *rpd; /* Root Port device */
|
|
|
|
struct work_struct dpc_handler;
|
|
|
|
struct aer_err_source e_sources[AER_ERROR_SOURCES_MAX];
|
|
|
|
unsigned short prod_idx; /* Error Producer Index */
|
|
|
|
unsigned short cons_idx; /* Error Consumer Index */
|
|
|
|
int isr;
|
|
|
|
spinlock_t e_lock; /*
|
|
|
|
* Lock access to Error Status/ID Regs
|
|
|
|
* and error producer/consumer index
|
|
|
|
*/
|
|
|
|
struct mutex rpc_mutex; /*
|
|
|
|
* only one thread could do
|
|
|
|
* recovery on the same
|
2007-02-18 02:23:03 +08:00
|
|
|
* root port hierarchy
|
2006-07-31 15:21:33 +08:00
|
|
|
*/
|
|
|
|
wait_queue_head_t wait_release;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct aer_broadcast_data {
|
|
|
|
enum pci_channel_state state;
|
|
|
|
enum pci_ers_result result;
|
|
|
|
};
|
|
|
|
|
|
|
|
static inline pci_ers_result_t merge_result(enum pci_ers_result orig,
|
|
|
|
enum pci_ers_result new)
|
|
|
|
{
|
2009-04-30 14:48:29 +08:00
|
|
|
if (new == PCI_ERS_RESULT_NONE)
|
|
|
|
return orig;
|
|
|
|
|
2006-07-31 15:21:33 +08:00
|
|
|
switch (orig) {
|
|
|
|
case PCI_ERS_RESULT_CAN_RECOVER:
|
|
|
|
case PCI_ERS_RESULT_RECOVERED:
|
|
|
|
orig = new;
|
|
|
|
break;
|
|
|
|
case PCI_ERS_RESULT_DISCONNECT:
|
|
|
|
if (new == PCI_ERS_RESULT_NEED_RESET)
|
|
|
|
orig = new;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return orig;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern struct bus_type pcie_port_bus_type;
|
|
|
|
extern void aer_enable_rootport(struct aer_rpc *rpc);
|
|
|
|
extern void aer_delete_rootport(struct aer_rpc *rpc);
|
|
|
|
extern int aer_init(struct pcie_device *dev);
|
2006-11-22 22:55:48 +08:00
|
|
|
extern void aer_isr(struct work_struct *work);
|
2006-07-31 15:21:33 +08:00
|
|
|
extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info);
|
2009-04-24 10:45:23 +08:00
|
|
|
extern irqreturn_t aer_irq(int irq, void *context);
|
2007-06-06 11:44:16 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_ACPI
|
|
|
|
extern int aer_osc_setup(struct pcie_device *pciedev);
|
|
|
|
#else
|
|
|
|
static inline int aer_osc_setup(struct pcie_device *pciedev)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
2006-07-31 15:21:33 +08:00
|
|
|
|
PCI: pcie, aer: checkpatch style cleanup in pcie/aer/*
Before:
drivers/pci/pcie/aer/aer_inject.c
total: 4 errors, 4 warnings, 473 lines checked
drivers/pci/pcie/aer/aerdrv.c
total: 5 errors, 2 warnings, 333 lines checked
drivers/pci/pcie/aer/aerdrv.h
total: 1 errors, 0 warnings, 139 lines checked
drivers/pci/pcie/aer/aerdrv_core.c
total: 4 errors, 3 warnings, 872 lines checked
drivers/pci/pcie/aer/aerdrv_errprint.c
total: 12 errors, 11 warnings, 248 lines checked
After:
drivers/pci/pcie/aer/aer_inject.c
total: 0 errors, 0 warnings, 466 lines checked
drivers/pci/pcie/aer/aerdrv.c
total: 0 errors, 0 warnings, 335 lines checked
drivers/pci/pcie/aer/aerdrv.h
total: 0 errors, 0 warnings, 139 lines checked
drivers/pci/pcie/aer/aerdrv_core.c
total: 0 errors, 0 warnings, 869 lines checked
drivers/pci/pcie/aer/aerdrv_errprint.c
total: 0 errors, 10 warnings, 247 lines checked
Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Reviewed-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
2009-09-07 16:07:29 +08:00
|
|
|
#endif /* _AERDRV_H_ */
|