Commit 273024de authored by Hidetoshi Seto's avatar Hidetoshi Seto Committed by Jesse Barnes

PCI: pcie, aer: flags to bits

Compact struct and codes.
Signed-off-by: default avatarHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 3472a187
...@@ -40,10 +40,6 @@ ...@@ -40,10 +40,6 @@
PCI_ERR_UNC_UNX_COMP| \ PCI_ERR_UNC_UNX_COMP| \
PCI_ERR_UNC_MALF_TLP) 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 { struct header_log_regs {
unsigned int dw0; unsigned int dw0;
unsigned int dw1; unsigned int dw1;
...@@ -55,10 +51,17 @@ struct header_log_regs { ...@@ -55,10 +51,17 @@ struct header_log_regs {
struct aer_err_info { struct aer_err_info {
struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES]; struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES];
int error_dev_num; int error_dev_num;
u16 id;
int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */ unsigned int id:16;
int flags;
int first; unsigned int severity:2; /* 0:NONFATAL | 1:FATAL | 2:COR */
unsigned int __pad1:5;
unsigned int multi_error_valid:1;
unsigned int first_error:5;
unsigned int __pad2:2;
unsigned int tlp_header_valid:1;
unsigned int status; /* COR/UNCOR Error Status */ unsigned int status; /* COR/UNCOR Error Status */
unsigned int mask; /* COR/UNCOR Error Mask */ unsigned int mask; /* COR/UNCOR Error Mask */
struct header_log_regs tlp; /* TLP Header */ struct header_log_regs tlp; /* TLP Header */
......
...@@ -196,7 +196,7 @@ static int find_device_iter(struct pci_dev *dev, void *data) ...@@ -196,7 +196,7 @@ static int find_device_iter(struct pci_dev *dev, void *data)
* If there is no multiple error, we stop * If there is no multiple error, we stop
* or continue based on the id comparing. * or continue based on the id comparing.
*/ */
if (!(e_info->flags & AER_MULTI_ERROR_VALID_FLAG)) if (!e_info->multi_error_valid)
return result; return result;
/* /*
...@@ -254,7 +254,7 @@ static int find_device_iter(struct pci_dev *dev, void *data) ...@@ -254,7 +254,7 @@ static int find_device_iter(struct pci_dev *dev, void *data)
return 0; return 0;
added: added:
if (e_info->flags & AER_MULTI_ERROR_VALID_FLAG) if (e_info->multi_error_valid)
return 0; return 0;
else else
return 1; return 1;
...@@ -701,7 +701,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) ...@@ -701,7 +701,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
int pos, temp; int pos, temp;
info->status = 0; info->status = 0;
info->flags &= ~AER_TLP_HEADER_VALID_FLAG; info->tlp_header_valid = 0;
pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
...@@ -729,10 +729,10 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) ...@@ -729,10 +729,10 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
/* Get First Error Pointer */ /* Get First Error Pointer */
pci_read_config_dword(dev, pos + PCI_ERR_CAP, &temp); pci_read_config_dword(dev, pos + PCI_ERR_CAP, &temp);
info->first = PCI_ERR_CAP_FEP(temp); info->first_error = PCI_ERR_CAP_FEP(temp);
if (info->status & AER_LOG_TLP_MASKS) { if (info->status & AER_LOG_TLP_MASKS) {
info->flags |= AER_TLP_HEADER_VALID_FLAG; info->tlp_header_valid = 1;
pci_read_config_dword(dev, pci_read_config_dword(dev,
pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0); pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0);
pci_read_config_dword(dev, pci_read_config_dword(dev,
...@@ -811,7 +811,7 @@ static void aer_isr_one_error(struct pcie_device *p_device, ...@@ -811,7 +811,7 @@ static void aer_isr_one_error(struct pcie_device *p_device,
if (e_src->status & if (e_src->status &
(PCI_ERR_ROOT_MULTI_COR_RCV | (PCI_ERR_ROOT_MULTI_COR_RCV |
PCI_ERR_ROOT_MULTI_UNCOR_RCV)) PCI_ERR_ROOT_MULTI_UNCOR_RCV))
e_info->flags |= AER_MULTI_ERROR_VALID_FLAG; e_info->multi_error_valid = 1;
find_source_device(p_device->port, e_info); find_source_device(p_device->port, e_info);
aer_process_err_devices(p_device, e_info); aer_process_err_devices(p_device, e_info);
......
...@@ -170,10 +170,10 @@ static void aer_print_error_source(struct aer_err_info *info) ...@@ -170,10 +170,10 @@ static void aer_print_error_source(struct aer_err_info *info)
if (errmsg) if (errmsg)
AER_PR(info, "%s\t: %s\n", errmsg, AER_PR(info, "%s\t: %s\n", errmsg,
info->first == i ? "First" : ""); info->first_error == i ? "First" : "");
else else
AER_PR(info, "Unknown Error Bit %2d \t: %s\n", AER_PR(info, "Unknown Error Bit %2d \t: %s\n",
i, info->first == i ? "First" : ""); i, info->first_error == i ? "First" : "");
} }
} }
...@@ -207,7 +207,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) ...@@ -207,7 +207,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
PCI_SLOT(dev->devfn), PCI_SLOT(dev->devfn),
PCI_FUNC(dev->devfn)); PCI_FUNC(dev->devfn));
if (info->flags & AER_TLP_HEADER_VALID_FLAG) { if (info->tlp_header_valid) {
unsigned char *tlp = (unsigned char *) &info->tlp; unsigned char *tlp = (unsigned char *) &info->tlp;
AER_PR(info, "TLP Header:\n"); AER_PR(info, "TLP Header:\n");
AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x" AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment