Commit 2cced2d9 authored by Lance Ortiz's avatar Lance Ortiz Committed by Tony Luck

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: default avatarLance Ortiz <lance.ortiz@hp.com>
Acked-by: default avatarBoris Petkov <bp@alien8.de>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 1d521000
...@@ -124,12 +124,11 @@ static const char *aer_agent_string[] = { ...@@ -124,12 +124,11 @@ static const char *aer_agent_string[] = {
"Transmitter ID" "Transmitter ID"
}; };
static void __aer_print_error(const char *prefix, static void __aer_print_error(struct pci_dev *dev,
struct aer_err_info *info) struct aer_err_info *info)
{ {
int i, status; int i, status;
const char *errmsg = NULL; const char *errmsg = NULL;
status = (info->status & ~info->mask); status = (info->status & ~info->mask);
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
...@@ -144,26 +143,22 @@ static void __aer_print_error(const char *prefix, ...@@ -144,26 +143,22 @@ static void __aer_print_error(const char *prefix,
aer_uncorrectable_error_string[i] : NULL; aer_uncorrectable_error_string[i] : NULL;
if (errmsg) if (errmsg)
printk("%s"" [%2d] %-22s%s\n", prefix, i, errmsg, dev_err(&dev->dev, " [%2d] %-22s%s\n", i, errmsg,
info->first_error == i ? " (First)" : ""); info->first_error == i ? " (First)" : "");
else else
printk("%s"" [%2d] Unknown Error Bit%s\n", prefix, i, dev_err(&dev->dev, " [%2d] Unknown Error Bit%s\n",
info->first_error == i ? " (First)" : ""); i, info->first_error == i ? " (First)" : "");
} }
} }
void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
{ {
int id = ((dev->bus->number << 8) | dev->devfn); int id = ((dev->bus->number << 8) | dev->devfn);
char prefix[44];
snprintf(prefix, sizeof(prefix), "%s%s %s: ",
(info->severity == AER_CORRECTABLE) ? KERN_WARNING : KERN_ERR,
dev_driver_string(&dev->dev), dev_name(&dev->dev));
if (info->status == 0) { if (info->status == 0) {
printk("%s""PCIe Bus Error: severity=%s, type=Unaccessible, " dev_err(&dev->dev,
"id=%04x(Unregistered Agent ID)\n", prefix, "PCIe Bus Error: severity=%s, type=Unaccessible, "
"id=%04x(Unregistered Agent ID)\n",
aer_error_severity_string[info->severity], id); aer_error_severity_string[info->severity], id);
} else { } else {
int layer, agent; int layer, agent;
...@@ -171,22 +166,24 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) ...@@ -171,22 +166,24 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
layer = AER_GET_LAYER_ERROR(info->severity, info->status); layer = AER_GET_LAYER_ERROR(info->severity, info->status);
agent = AER_GET_AGENT(info->severity, info->status); agent = AER_GET_AGENT(info->severity, info->status);
printk("%s""PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n", dev_err(&dev->dev,
prefix, aer_error_severity_string[info->severity], "PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
aer_error_severity_string[info->severity],
aer_error_layer[layer], id, aer_agent_string[agent]); aer_error_layer[layer], id, aer_agent_string[agent]);
printk("%s"" device [%04x:%04x] error status/mask=%08x/%08x\n", dev_err(&dev->dev,
prefix, dev->vendor, dev->device, " device [%04x:%04x] error status/mask=%08x/%08x\n",
dev->vendor, dev->device,
info->status, info->mask); info->status, info->mask);
__aer_print_error(prefix, info); __aer_print_error(dev, info);
if (info->tlp_header_valid) { if (info->tlp_header_valid) {
unsigned char *tlp = (unsigned char *) &info->tlp; unsigned char *tlp = (unsigned char *) &info->tlp;
printk("%s"" TLP Header:" dev_err(&dev->dev, " TLP Header:"
" %02x%02x%02x%02x %02x%02x%02x%02x" " %02x%02x%02x%02x %02x%02x%02x%02x"
" %02x%02x%02x%02x %02x%02x%02x%02x\n", " %02x%02x%02x%02x %02x%02x%02x%02x\n",
prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
*(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
*(tlp + 11), *(tlp + 10), *(tlp + 9), *(tlp + 11), *(tlp + 10), *(tlp + 9),
*(tlp + 8), *(tlp + 15), *(tlp + 14), *(tlp + 8), *(tlp + 15), *(tlp + 14),
...@@ -195,8 +192,9 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) ...@@ -195,8 +192,9 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
} }
if (info->id && info->error_dev_num > 1 && info->id == id) if (info->id && info->error_dev_num > 1 && info->id == id)
printk("%s"" Error of this Agent(%04x) is reported first\n", dev_err(&dev->dev,
prefix, id); " Error of this Agent(%04x) is reported first\n",
id);
trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask), trace_aer_event(dev_name(&dev->dev), (info->status & ~info->mask),
info->severity); info->severity);
} }
...@@ -244,21 +242,21 @@ void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity, ...@@ -244,21 +242,21 @@ void cper_print_aer(const char *prefix, struct pci_dev *dev, int cper_severity,
} }
layer = AER_GET_LAYER_ERROR(aer_severity, status); layer = AER_GET_LAYER_ERROR(aer_severity, status);
agent = AER_GET_AGENT(aer_severity, status); agent = AER_GET_AGENT(aer_severity, status);
printk("%s""aer_status: 0x%08x, aer_mask: 0x%08x\n", dev_err(&dev->dev, "aer_status: 0x%08x, aer_mask: 0x%08x\n",
prefix, status, mask); status, mask);
cper_print_bits(prefix, status, status_strs, status_strs_size); cper_print_bits(prefix, status, status_strs, status_strs_size);
printk("%s""aer_layer=%s, aer_agent=%s\n", prefix, dev_err(&dev->dev, "aer_layer=%s, aer_agent=%s\n",
aer_error_layer[layer], aer_agent_string[agent]); aer_error_layer[layer], aer_agent_string[agent]);
if (aer_severity != AER_CORRECTABLE) if (aer_severity != AER_CORRECTABLE)
printk("%s""aer_uncor_severity: 0x%08x\n", dev_err(&dev->dev, "aer_uncor_severity: 0x%08x\n",
prefix, aer->uncor_severity); aer->uncor_severity);
if (tlp_header_valid) { if (tlp_header_valid) {
const unsigned char *tlp; const unsigned char *tlp;
tlp = (const unsigned char *)&aer->header_log; tlp = (const unsigned char *)&aer->header_log;
printk("%s""aer_tlp_header:" dev_err(&dev->dev, "aer_tlp_header:"
" %02x%02x%02x%02x %02x%02x%02x%02x" " %02x%02x%02x%02x %02x%02x%02x%02x"
" %02x%02x%02x%02x %02x%02x%02x%02x\n", " %02x%02x%02x%02x %02x%02x%02x%02x\n",
prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
*(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
*(tlp + 11), *(tlp + 10), *(tlp + 9), *(tlp + 11), *(tlp + 10), *(tlp + 9),
*(tlp + 8), *(tlp + 15), *(tlp + 14), *(tlp + 8), *(tlp + 15), *(tlp + 14),
......
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