From 273024ded7b364e1305a31bf4eb197870284f279 Mon Sep 17 00:00:00 2001 From: Hidetoshi Seto Date: Mon, 7 Sep 2009 17:16:20 +0900 Subject: PCI: pcie, aer: flags to bits Compact struct and codes. Signed-off-by: Hidetoshi Seto Signed-off-by: Jesse Barnes --- drivers/pci/pcie/aer/aerdrv.h | 19 +++++++++++-------- drivers/pci/pcie/aer/aerdrv_core.c | 12 ++++++------ drivers/pci/pcie/aer/aerdrv_errprint.c | 6 +++--- 3 files changed, 20 insertions(+), 17 deletions(-) (limited to 'drivers/pci') diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index c44d9e12d06..78c977cec47 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h @@ -40,10 +40,6 @@ 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; @@ -55,10 +51,17 @@ struct header_log_regs { struct aer_err_info { struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES]; int error_dev_num; - u16 id; - int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */ - int flags; - int first; + + unsigned int id:16; + + 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 mask; /* COR/UNCOR Error Mask */ struct header_log_regs tlp; /* TLP Header */ diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 9ba1602aebf..96264697446 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -196,7 +196,7 @@ static int find_device_iter(struct pci_dev *dev, void *data) * If there is no multiple error, we stop * or continue based on the id comparing. */ - if (!(e_info->flags & AER_MULTI_ERROR_VALID_FLAG)) + if (!e_info->multi_error_valid) return result; /* @@ -254,7 +254,7 @@ static int find_device_iter(struct pci_dev *dev, void *data) return 0; added: - if (e_info->flags & AER_MULTI_ERROR_VALID_FLAG) + if (e_info->multi_error_valid) return 0; else return 1; @@ -701,7 +701,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) int pos, temp; 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); @@ -729,10 +729,10 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) /* Get First Error Pointer */ 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) { - info->flags |= AER_TLP_HEADER_VALID_FLAG; + info->tlp_header_valid = 1; pci_read_config_dword(dev, pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0); pci_read_config_dword(dev, @@ -811,7 +811,7 @@ static void aer_isr_one_error(struct pcie_device *p_device, if (e_src->status & (PCI_ERR_ROOT_MULTI_COR_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); aer_process_err_devices(p_device, e_info); diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index 0bb91e28d5f..f0bdf0ff859 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c @@ -170,10 +170,10 @@ static void aer_print_error_source(struct aer_err_info *info) if (errmsg) AER_PR(info, "%s\t: %s\n", errmsg, - info->first == i ? "First" : ""); + info->first_error == i ? "First" : ""); else 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) PCI_SLOT(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; AER_PR(info, "TLP Header:\n"); AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x" -- cgit v1.2.3