aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorLance Ortiz <lance.ortiz@hp.com>2013-01-03 17:34:15 -0500
committerTony Luck <tony.luck@intel.com>2013-01-03 17:35:41 -0500
commit2cced2d95961acd318e9395578a60ee424d9db80 (patch)
treef2e2122f7cf309b1b7146d84e2b0c30aa813c6c6 /drivers/pci
parent1d5210008bd3a26daf4b06aed9d6c330dd4c83e2 (diff)
aerdrv: Cleanup log output for AER
These changes make cper_print_aer more consistent with aer_print_error and clean things up by elimiating the use of the prefix variable and replacing it with dev_printk. Signed-off-by: Lance Ortiz <lance.ortiz@hp.com> Acked-by: Boris Petkov <bp@alien8.de> Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pcie/aer/aerdrv_errprint.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c
index d3e5fc5a2de9..5ab14251839d 100644
--- a/drivers/pci/pcie/aer/aerdrv_errprint.c
+++ b/drivers/pci/pcie/aer/aerdrv_errprint.c
@@ -124,12 +124,11 @@ static const char *aer_agent_string[] = {
124 "Transmitter ID" 124 "Transmitter ID"
125}; 125};
126 126
127static void __aer_print_error(const char *prefix, 127static void __aer_print_error(struct pci_dev *dev,
128 struct aer_err_info *info) 128 struct aer_err_info *info)
129{ 129{
130 int i, status; 130 int i, status;
131 const char *errmsg = NULL; 131 const char *errmsg = NULL;
132
133 status = (info->status & ~info->mask); 132 status = (info->status & ~info->mask);
134 133
135 for (i = 0; i < 32; i++) { 134 for (i = 0; i < 32; i++) {
@@ -144,26 +143,22 @@ static void __aer_print_error(const char *prefix,
144 aer_uncorrectable_error_string[i] : NULL; 143 aer_uncorrectable_error_string[i] : NULL;
145 144
146 if (errmsg) 145 if (errmsg)
147 printk("%s"" [%2d] %-22s%s\n", prefix, i, errmsg, 146 dev_err(&dev->dev, " [%2d] %-22s%s\n", i, errmsg,
148 info->first_error == i ? " (First)" : ""); 147 info->first_error == i ? " (First)" : "");
149 else 148 else
150 printk("%s"" [%2d] Unknown Error Bit%s\n", prefix, i, 149 dev_err(&dev->dev, " [%2d] Unknown Error Bit%s\n",
151 info->first_error == i ? " (First)" : ""); 150 i, info->first_error == i ? " (First)" : "");
152 } 151 }
153} 152}
154 153
155void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) 154void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
156{ 155{
157 int id = ((dev->bus->number << 8) | dev->devfn); 156 int id = ((dev->bus->number << 8) | dev->devfn);
158 char prefix[44];
159
160 snprintf(prefix, sizeof(prefix), "%s%s %s: ",
161 (info->severity == AER_CORRECTABLE) ? KERN_WARNING : KERN_ERR,
162 dev_driver_string(&dev->dev), dev_name(&dev->dev));
163 157
164 if (info->status == 0) { 158 if (info->status == 0) {
165 printk("%s""PCIe Bus Error: severity=%s, type=Unaccessible, " 159 dev_err(&dev->dev,
166 "id=%04x(Unregistered Agent ID)\n", prefix, 160 "PCIe Bus Error: severity=%s, type=Unaccessible, "
161 "id=%04x(Unregistered Agent ID)\n",
167 aer_error_severity_string[info->severity], id); 162 aer_error_severity_string[info->severity], id);
168 } else { 163 } else {
169 int layer, agent; 164 int layer, agent;
@@ -171,22 +166,24 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
171 layer = AER_GET_LAYER_ERROR(info->severity, info->status); 166 layer = AER_GET_LAYER_ERROR(info->severity, info->status);
172 agent = AER_GET_AGENT(info->severity, info->status); 167 agent = AER_GET_AGENT(info->severity, info->status);
173 168
174 printk("%s""PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", 169 dev_err(&dev->dev,
175 prefix, aer_error_severity_string[info->severity], 170 "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
171 aer_error_severity_string[info->severity],
176 aer_error_layer[layer], id, aer_agent_string[agent]); 172 aer_error_layer[layer], id, aer_agent_string[agent]);
177 173
178 printk("%s"" device [%04x:%04x] error status/mask=%08x/%08x\n", 174 dev_err(&dev->dev,
179 prefix, dev->vendor, dev->device, 175 " device [%04x:%04x] error status/mask=%08x/%08x\n",
176 dev->vendor, dev->device,
180 info->status, info->mask); 177 info->status, info->mask);
181 178
182 __aer_print_error(prefix, info); 179 __aer_print_error(dev, info);
183 180
184 if (info->tlp_header_valid) { 181 if (info->tlp_header_valid) {
185 unsigned char *tlp = (unsigned char *) &info->tlp; 182 unsigned char *tlp = (unsigned char *) &info->tlp;
186 printk("%s"" TLP Header:" 183 dev_err(&dev->dev, " TLP Header:"
187 " %02x%02x%02x%02x %02x%02x%02x%02x" 184 " %02x%02x%02x%02x %02x%02x%02x%02x"
188 " %02x%02x%02x%02x %02x%02x%02x%02x\n", 185 " %02x%02x%02x%02x %02x%02x%02x%02x\n",
189 prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, 186 *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
190 *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), 187 *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
191 *(tlp + 11), *(tlp + 10), *(tlp + 9), 188 *(tlp + 11), *(tlp + 10), *(tlp + 9),
192 *(tlp + 8), *(tlp + 15), *(tlp + 14), 189 *(tlp + 8), *(tlp + 15), *(tlp + 14),
@@ -195,8 +192,9 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
195 } 192 }
196 193
197 if (info->id && info->error_dev_num > 1 && info->id == id) 194 if (info->id && info->error_dev_num > 1 && info->id == id)
198 printk("%s"" Error of this Agent(%04x) is reported first\n", 195 dev_err(&dev->dev,
199 prefix, id); 196 " Error of this Agent(%04x) is reported first\n",
197 id);
200 trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask), 198 trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask),
201 info->severity); 199 info->severity);
202} 200}
@@ -244,21 +242,21 @@ void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity,
244 } 242 }
245 layer = AER_GET_LAYER_ERROR(aer_severity, status); 243 layer = AER_GET_LAYER_ERROR(aer_severity, status);
246 agent = AER_GET_AGENT(aer_severity, status); 244 agent = AER_GET_AGENT(aer_severity, status);
247 printk("%s""aer_status: 0x%08x, aer_mask: 0x%08x\n", 245 dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n",
248 prefix, status, mask); 246 status, mask);
249 cper_print_bits(prefix, status, status_strs, status_strs_size); 247 cper_print_bits(prefix, status, status_strs, status_strs_size);
250 printk("%s""aer_layer=%s, aer_agent=%s\n", prefix, 248 dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n",
251 aer_error_layer[layer], aer_agent_string[agent]); 249 aer_error_layer[layer], aer_agent_string[agent]);
252 if (aer_severity != AER_CORRECTABLE) 250 if (aer_severity != AER_CORRECTABLE)
253 printk("%s""aer_uncor_severity: 0x%08x\n", 251 dev_err(&dev->dev, "aer_uncor_severity: 0x%08x\n",
254 prefix, aer->uncor_severity); 252 aer->uncor_severity);
255 if (tlp_header_valid) { 253 if (tlp_header_valid) {
256 const unsigned char *tlp; 254 const unsigned char *tlp;
257 tlp = (const unsigned char *)&aer->header_log; 255 tlp = (const unsigned char *)&aer->header_log;
258 printk("%s""aer_tlp_header:" 256 dev_err(&dev->dev, "aer_tlp_header:"
259 " %02x%02x%02x%02x %02x%02x%02x%02x" 257 " %02x%02x%02x%02x %02x%02x%02x%02x"
260 " %02x%02x%02x%02x %02x%02x%02x%02x\n", 258 " %02x%02x%02x%02x %02x%02x%02x%02x\n",
261 prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, 259 *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
262 *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), 260 *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
263 *(tlp + 11), *(tlp + 10), *(tlp + 9), 261 *(tlp + 11), *(tlp + 10), *(tlp + 9),
264 *(tlp + 8), *(tlp + 15), *(tlp + 14), 262 *(tlp + 8), *(tlp + 15), *(tlp + 14),