diff --git a/drivers/pci/pcie/aer/aerdrv.h b/drivers/pci/pcie/aer/aerdrv.h index 78c977cec479..f9979eb56fb2 100644 --- a/drivers/pci/pcie/aer/aerdrv.h +++ b/drivers/pci/pcie/aer/aerdrv.h @@ -124,6 +124,7 @@ extern void aer_delete_rootport(struct aer_rpc *rpc); extern int aer_init(struct pcie_device *dev); extern void aer_isr(struct work_struct *work); extern void aer_print_error(struct pci_dev *dev, struct aer_err_info *info); +extern void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info); extern irqreturn_t aer_irq(int irq, void *context); #ifdef CONFIG_ACPI diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 962646974466..d9185cd2d900 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c @@ -813,6 +813,8 @@ static void aer_isr_one_error(struct pcie_device *p_device, PCI_ERR_ROOT_MULTI_UNCOR_RCV)) e_info->multi_error_valid = 1; + aer_print_port_info(p_device->port, e_info); + 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 f0bdf0ff859e..44acde72294f 100644 --- a/drivers/pci/pcie/aer/aerdrv_errprint.c +++ b/drivers/pci/pcie/aer/aerdrv_errprint.c @@ -57,9 +57,10 @@ (e & AER_DATA_LINK_LAYER_ERROR_MASK(t)) ? AER_DATA_LINK_LAYER_ERROR : \ AER_TRANSACTION_LAYER_ERROR) -#define AER_PR(info, fmt, args...) \ - printk("%s" fmt, (info->severity == AER_CORRECTABLE) ? \ - KERN_WARNING : KERN_ERR, ## args) +#define AER_PR(info, pdev, fmt, args...) \ + printk("%s%s %s: " fmt, (info->severity == AER_CORRECTABLE) ? \ + KERN_WARNING : KERN_ERR, dev_driver_string(&pdev->dev), \ + dev_name(&pdev->dev), ## args) /* * AER error strings @@ -152,7 +153,7 @@ static char *aer_agent_string[] = { "Transmitter ID" }; -static void aer_print_error_source(struct aer_err_info *info) +static void __aer_print_error(struct aer_err_info *info, struct pci_dev *dev) { int i, status; char *errmsg = NULL; @@ -169,48 +170,44 @@ static void aer_print_error_source(struct aer_err_info *info) errmsg = aer_uncorrectable_error_string[i]; if (errmsg) - AER_PR(info, "%s\t: %s\n", errmsg, - info->first_error == i ? "First" : ""); + AER_PR(info, dev, " [%2d] %s%s\n", i, errmsg, + info->first_error == i ? " (First)" : ""); else - AER_PR(info, "Unknown Error Bit %2d \t: %s\n", - i, info->first_error == i ? "First" : ""); + AER_PR(info, dev, " [%2d] Unknown Error Bit%s\n", i, + info->first_error == i ? " (First)" : ""); } } void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) { - int err_layer, agent; int id = ((dev->bus->number << 8) | dev->devfn); - AER_PR(info, "+------ PCI-Express Device Error ------+\n"); - AER_PR(info, "Error Severity\t\t: %s\n", - aer_error_severity_string[info->severity]); - if (info->status == 0) { - AER_PR(info, "PCIE Bus Error type\t: (Unaccessible)\n"); - AER_PR(info, "Unregistered Agent ID\t: %04x\n", id); + AER_PR(info, dev, + "PCIE Bus Error: severity=%s, type=Unaccessible, " + "id=%04x(Unregistered Agent ID)\n", + aer_error_severity_string[info->severity], id); } else { - err_layer = AER_GET_LAYER_ERROR(info->severity, info->status); - AER_PR(info, "PCIE Bus Error type\t: %s\n", - aer_error_layer[err_layer]); - - aer_print_error_source(info); + int layer, agent; + layer = AER_GET_LAYER_ERROR(info->severity, info->status); agent = AER_GET_AGENT(info->severity, info->status); - AER_PR(info, "%s\t\t: %04x\n", aer_agent_string[agent], id); - AER_PR(info, "VendorID=%04xh, DeviceID=%04xh," - " Bus=%02xh, Device=%02xh, Function=%02xh\n", - dev->vendor, - dev->device, - dev->bus->number, - PCI_SLOT(dev->devfn), - PCI_FUNC(dev->devfn)); + AER_PR(info, dev, + "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_PR(info, dev, + " device [%04x:%04x] error status/mask=%08x/%08x\n", + dev->vendor, dev->device, info->status, info->mask); + + __aer_print_error(info, dev); 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" + AER_PR(info, dev, " TLP Header:" + " %02x%02x%02x%02x %02x%02x%02x%02x" " %02x%02x%02x%02x %02x%02x%02x%02x\n", *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp, *(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4), @@ -221,6 +218,13 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info) } if (info->id && info->error_dev_num > 1 && info->id == id) - AER_PR(info, "Error of this Agent(%04x) is reported first\n", - id); + AER_PR(info, dev, + " Error of this Agent(%04x) is reported first\n", id); +} + +void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info) +{ + dev_info(&dev->dev, "AER: %s%s error received: id=%04x\n", + info->multi_error_valid ? "Multiple " : "", + aer_error_severity_string[info->severity], info->id); }