diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/pci/pcie/aer/aerdrv_errprint.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/pci/pcie/aer/aerdrv_errprint.c b/drivers/pci/pcie/aer/aerdrv_errprint.c index ccaeceb32da3..7fb5a2c71c6e 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c | |||
@@ -61,6 +61,10 @@ | |||
61 | AER_DATA_LINK_LAYER_ERROR : \ | 61 | AER_DATA_LINK_LAYER_ERROR : \ |
62 | AER_TRANSACTION_LAYER_ERROR) | 62 | AER_TRANSACTION_LAYER_ERROR) |
63 | 63 | ||
64 | #define AER_PR(info, fmt, args...) \ | ||
65 | printk("%s" fmt, (info->severity == AER_CORRECTABLE) ? \ | ||
66 | KERN_WARNING : KERN_ERR, ## args) | ||
67 | |||
64 | /* | 68 | /* |
65 | * AER error strings | 69 | * AER error strings |
66 | */ | 70 | */ |
@@ -185,46 +189,39 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
185 | { | 189 | { |
186 | char *errmsg; | 190 | char *errmsg; |
187 | int err_layer, agent; | 191 | int err_layer, agent; |
188 | char *loglevel; | ||
189 | |||
190 | if (info->severity == AER_CORRECTABLE) | ||
191 | loglevel = KERN_WARNING; | ||
192 | else | ||
193 | loglevel = KERN_ERR; | ||
194 | 192 | ||
195 | printk("%s+------ PCI-Express Device Error ------+\n", loglevel); | 193 | AER_PR(info, "+------ PCI-Express Device Error ------+\n"); |
196 | printk("%sError Severity\t\t: %s\n", loglevel, | 194 | AER_PR(info, "Error Severity\t\t: %s\n", |
197 | aer_error_severity_string[info->severity]); | 195 | aer_error_severity_string[info->severity]); |
198 | 196 | ||
199 | if (info->status == 0) { | 197 | if (info->status == 0) { |
200 | printk("%sPCIE Bus Error type\t: (Unaccessible)\n", loglevel); | 198 | AER_PR(info, "PCIE Bus Error type\t: (Unaccessible)\n"); |
201 | printk("%sUnaccessible Received\t: %s\n", loglevel, | 199 | AER_PR(info, "Unaccessible Received\t: %s\n", |
202 | info->flags & AER_MULTI_ERROR_VALID_FLAG ? | 200 | info->flags & AER_MULTI_ERROR_VALID_FLAG ? |
203 | "Multiple" : "First"); | 201 | "Multiple" : "First"); |
204 | printk("%sUnregistered Agent ID\t: %04x\n", loglevel, | 202 | AER_PR(info, "Unregistered Agent ID\t: %04x\n", |
205 | (dev->bus->number << 8) | dev->devfn); | 203 | (dev->bus->number << 8) | dev->devfn); |
206 | } else { | 204 | } else { |
207 | err_layer = AER_GET_LAYER_ERROR(info->severity, info->status); | 205 | err_layer = AER_GET_LAYER_ERROR(info->severity, info->status); |
208 | printk("%sPCIE Bus Error type\t: %s\n", loglevel, | 206 | AER_PR(info, "PCIE Bus Error type\t: %s\n", |
209 | aer_error_layer[err_layer]); | 207 | aer_error_layer[err_layer]); |
210 | 208 | ||
211 | spin_lock(&logbuf_lock); | 209 | spin_lock(&logbuf_lock); |
212 | errmsg = aer_get_error_source_name(info->severity, | 210 | errmsg = aer_get_error_source_name(info->severity, |
213 | info->status, | 211 | info->status, |
214 | errmsg_buff); | 212 | errmsg_buff); |
215 | printk("%s%s\t: %s\n", loglevel, errmsg, | 213 | AER_PR(info, "%s\t: %s\n", errmsg, |
216 | info->flags & AER_MULTI_ERROR_VALID_FLAG ? | 214 | info->flags & AER_MULTI_ERROR_VALID_FLAG ? |
217 | "Multiple" : "First"); | 215 | "Multiple" : "First"); |
218 | spin_unlock(&logbuf_lock); | 216 | spin_unlock(&logbuf_lock); |
219 | 217 | ||
220 | agent = AER_GET_AGENT(info->severity, info->status); | 218 | agent = AER_GET_AGENT(info->severity, info->status); |
221 | printk("%s%s\t\t: %04x\n", loglevel, | 219 | AER_PR(info, "%s\t\t: %04x\n", |
222 | aer_agent_string[agent], | 220 | aer_agent_string[agent], |
223 | (dev->bus->number << 8) | dev->devfn); | 221 | (dev->bus->number << 8) | dev->devfn); |
224 | 222 | ||
225 | printk("%sVendorID=%04xh, DeviceID=%04xh," | 223 | AER_PR(info, "VendorID=%04xh, DeviceID=%04xh," |
226 | " Bus=%02xh, Device=%02xh, Function=%02xh\n", | 224 | " Bus=%02xh, Device=%02xh, Function=%02xh\n", |
227 | loglevel, | ||
228 | dev->vendor, | 225 | dev->vendor, |
229 | dev->device, | 226 | dev->device, |
230 | dev->bus->number, | 227 | dev->bus->number, |
@@ -233,10 +230,9 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) | |||
233 | 230 | ||
234 | if (info->flags & AER_TLP_HEADER_VALID_FLAG) { | 231 | if (info->flags & AER_TLP_HEADER_VALID_FLAG) { |
235 | unsigned char *tlp = (unsigned char *) &info->tlp; | 232 | unsigned char *tlp = (unsigned char *) &info->tlp; |
236 | printk("%sTLP Header:\n", loglevel); | 233 | AER_PR(info, "TLP Header:\n"); |
237 | printk("%s%02x%02x%02x%02x %02x%02x%02x%02x" | 234 | AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x" |
238 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", | 235 | " %02x%02x%02x%02x %02x%02x%02x%02x\n", |
239 | loglevel, | ||
240 | *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, | 236 | *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, |
241 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), | 237 | *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), |
242 | *(tlp + 11), *(tlp + 10), *(tlp + 9), | 238 | *(tlp + 11), *(tlp + 10), *(tlp + 9), |