aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2009-09-07 04:16:20 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-09 16:49:56 -0400
commit273024ded7b364e1305a31bf4eb197870284f279 (patch)
treef3aee59e082b25f8920c6c7d6a3d6ea741325c71 /drivers/pci
parent3472a18773bc6661ea7f8de2b4172db7e00b67e6 (diff)
PCI: pcie, aer: flags to bits
Compact struct and codes. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie/aer/aerdrv.h19
-rw-r--r--drivers/pci/pcie/aer/aerdrv_core.c12
-rw-r--r--drivers/pci/pcie/aer/aerdrv_errprint.c6
3 files changed, 20 insertions, 17 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h
index c44d9e12d06e..78c977cec479 100644
--- a/drivers/pci/pcie/aer/aerdrv.h
+++ b/drivers/pci/pcie/aer/aerdrv.h
@@ -40,10 +40,6 @@
40 PCI_ERR_UNC_UNX_COMP| \ 40 PCI_ERR_UNC_UNX_COMP| \
41 PCI_ERR_UNC_MALF_TLP) 41 PCI_ERR_UNC_MALF_TLP)
42 42
43/* AER Error Info Flags */
44#define AER_TLP_HEADER_VALID_FLAG 0x00000001
45#define AER_MULTI_ERROR_VALID_FLAG 0x00000002
46
47struct header_log_regs { 43struct header_log_regs {
48 unsigned int dw0; 44 unsigned int dw0;
49 unsigned int dw1; 45 unsigned int dw1;
@@ -55,10 +51,17 @@ struct header_log_regs {
55struct aer_err_info { 51struct aer_err_info {
56 struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES]; 52 struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES];
57 int error_dev_num; 53 int error_dev_num;
58 u16 id; 54
59 int severity; /* 0:NONFATAL | 1:FATAL | 2:COR */ 55 unsigned int id:16;
60 int flags; 56
61 int first; 57 unsigned int severity:2; /* 0:NONFATAL | 1:FATAL | 2:COR */
58 unsigned int __pad1:5;
59 unsigned int multi_error_valid:1;
60
61 unsigned int first_error:5;
62 unsigned int __pad2:2;
63 unsigned int tlp_header_valid:1;
64
62 unsigned int status; /* COR/UNCOR Error Status */ 65 unsigned int status; /* COR/UNCOR Error Status */
63 unsigned int mask; /* COR/UNCOR Error Mask */ 66 unsigned int mask; /* COR/UNCOR Error Mask */
64 struct header_log_regs tlp; /* TLP Header */ 67 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 9ba1602aebff..962646974466 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)
196 * If there is no multiple error, we stop 196 * If there is no multiple error, we stop
197 * or continue based on the id comparing. 197 * or continue based on the id comparing.
198 */ 198 */
199 if (!(e_info->flags & AER_MULTI_ERROR_VALID_FLAG)) 199 if (!e_info->multi_error_valid)
200 return result; 200 return result;
201 201
202 /* 202 /*
@@ -254,7 +254,7 @@ static int find_device_iter(struct pci_dev *dev, void *data)
254 return 0; 254 return 0;
255 255
256added: 256added:
257 if (e_info->flags & AER_MULTI_ERROR_VALID_FLAG) 257 if (e_info->multi_error_valid)
258 return 0; 258 return 0;
259 else 259 else
260 return 1; 260 return 1;
@@ -701,7 +701,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
701 int pos, temp; 701 int pos, temp;
702 702
703 info->status = 0; 703 info->status = 0;
704 info->flags &= ~AER_TLP_HEADER_VALID_FLAG; 704 info->tlp_header_valid = 0;
705 705
706 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR); 706 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
707 707
@@ -729,10 +729,10 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
729 729
730 /* Get First Error Pointer */ 730 /* Get First Error Pointer */
731 pci_read_config_dword(dev, pos + PCI_ERR_CAP, &temp); 731 pci_read_config_dword(dev, pos + PCI_ERR_CAP, &temp);
732 info->first = PCI_ERR_CAP_FEP(temp); 732 info->first_error = PCI_ERR_CAP_FEP(temp);
733 733
734 if (info->status & AER_LOG_TLP_MASKS) { 734 if (info->status & AER_LOG_TLP_MASKS) {
735 info->flags |= AER_TLP_HEADER_VALID_FLAG; 735 info->tlp_header_valid = 1;
736 pci_read_config_dword(dev, 736 pci_read_config_dword(dev,
737 pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0); 737 pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0);
738 pci_read_config_dword(dev, 738 pci_read_config_dword(dev,
@@ -811,7 +811,7 @@ static void aer_isr_one_error(struct pcie_device *p_device,
811 if (e_src->status & 811 if (e_src->status &
812 (PCI_ERR_ROOT_MULTI_COR_RCV | 812 (PCI_ERR_ROOT_MULTI_COR_RCV |
813 PCI_ERR_ROOT_MULTI_UNCOR_RCV)) 813 PCI_ERR_ROOT_MULTI_UNCOR_RCV))
814 e_info->flags |= AER_MULTI_ERROR_VALID_FLAG; 814 e_info->multi_error_valid = 1;
815 815
816 find_source_device(p_device->port, e_info); 816 find_source_device(p_device->port, e_info);
817 aer_process_err_devices(p_device, e_info); 817 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 0bb91e28d5fe..f0bdf0ff859e 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)
170 170
171 if (errmsg) 171 if (errmsg)
172 AER_PR(info, "%s\t: %s\n", errmsg, 172 AER_PR(info, "%s\t: %s\n", errmsg,
173 info->first == i ? "First" : ""); 173 info->first_error == i ? "First" : "");
174 else 174 else
175 AER_PR(info, "Unknown Error Bit %2d \t: %s\n", 175 AER_PR(info, "Unknown Error Bit %2d \t: %s\n",
176 i, info->first == i ? "First" : ""); 176 i, info->first_error == i ? "First" : "");
177 } 177 }
178} 178}
179 179
@@ -207,7 +207,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
207 PCI_SLOT(dev->devfn), 207 PCI_SLOT(dev->devfn),
208 PCI_FUNC(dev->devfn)); 208 PCI_FUNC(dev->devfn));
209 209
210 if (info->flags & AER_TLP_HEADER_VALID_FLAG) { 210 if (info->tlp_header_valid) {
211 unsigned char *tlp = (unsigned char *) &info->tlp; 211 unsigned char *tlp = (unsigned char *) &info->tlp;
212 AER_PR(info, "TLP Header:\n"); 212 AER_PR(info, "TLP Header:\n");
213 AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x" 213 AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x"