Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 241695
b: refs/heads/master
c: b64a441
h: refs/heads/master
i:
  241693: 0438740
  241691: 7f1a364
  241687: 3c0f6c4
  241679: 2da3c85
  241663: 83152cc
v: v3
  • Loading branch information
Huang Ying authored and Len Brown committed Mar 22, 2011
1 parent a1baa3e commit c29c440
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 76 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 885b976fada5bc6595a9fd3e67e3cb1a3d11f50b
refs/heads/master: b64a44146540a4761bb1cf8047fffd9dbf0c3090
123 changes: 48 additions & 75 deletions trunk/drivers/pci/pcie/aer/aerdrv_errprint.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,106 +57,74 @@
(e & AER_DATA_LINK_LAYER_ERROR_MASK(t)) ? AER_DATA_LINK_LAYER_ERROR : \
AER_TRANSACTION_LAYER_ERROR)

#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
*/
static char *aer_error_severity_string[] = {
static const char *aer_error_severity_string[] = {
"Uncorrected (Non-Fatal)",
"Uncorrected (Fatal)",
"Corrected"
};

static char *aer_error_layer[] = {
static const char *aer_error_layer[] = {
"Physical Layer",
"Data Link Layer",
"Transaction Layer"
};
static char *aer_correctable_error_string[] = {
"Receiver Error ", /* Bit Position 0 */
NULL,
NULL,
NULL,
NULL,
NULL,
"Bad TLP ", /* Bit Position 6 */
"Bad DLLP ", /* Bit Position 7 */
"RELAY_NUM Rollover ", /* Bit Position 8 */
NULL,
NULL,
NULL,
"Replay Timer Timeout ", /* Bit Position 12 */
"Advisory Non-Fatal ", /* Bit Position 13 */
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,

static const char *aer_correctable_error_string[] = {
"Receiver Error", /* Bit Position 0 */
NULL,
NULL,
NULL,
NULL,
NULL,
"Bad TLP", /* Bit Position 6 */
"Bad DLLP", /* Bit Position 7 */
"RELAY_NUM Rollover", /* Bit Position 8 */
NULL,
NULL,
NULL,
"Replay Timer Timeout", /* Bit Position 12 */
"Advisory Non-Fatal", /* Bit Position 13 */
};

static char *aer_uncorrectable_error_string[] = {
NULL,
NULL,
NULL,
NULL,
"Data Link Protocol ", /* Bit Position 4 */
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"Poisoned TLP ", /* Bit Position 12 */
"Flow Control Protocol ", /* Bit Position 13 */
"Completion Timeout ", /* Bit Position 14 */
"Completer Abort ", /* Bit Position 15 */
"Unexpected Completion ", /* Bit Position 16 */
"Receiver Overflow ", /* Bit Position 17 */
"Malformed TLP ", /* Bit Position 18 */
"ECRC ", /* Bit Position 19 */
"Unsupported Request ", /* Bit Position 20 */
static const char *aer_uncorrectable_error_string[] = {
NULL,
NULL,
NULL,
NULL,
"Data Link Protocol", /* Bit Position 4 */
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
"Poisoned TLP", /* Bit Position 12 */
"Flow Control Protocol", /* Bit Position 13 */
"Completion Timeout", /* Bit Position 14 */
"Completer Abort", /* Bit Position 15 */
"Unexpected Completion", /* Bit Position 16 */
"Receiver Overflow", /* Bit Position 17 */
"Malformed TLP", /* Bit Position 18 */
"ECRC", /* Bit Position 19 */
"Unsupported Request", /* Bit Position 20 */
};

static char *aer_agent_string[] = {
static const char *aer_agent_string[] = {
"Receiver ID",
"Requester ID",
"Completer ID",
"Transmitter ID"
};

static void __aer_print_error(struct aer_err_info *info, struct pci_dev *dev)
static void __aer_print_error(const char *prefix,
struct aer_err_info *info)
{
int i, status;
char *errmsg = NULL;
const char *errmsg = NULL;

status = (info->status & ~info->mask);

Expand All @@ -165,51 +133,56 @@ static void __aer_print_error(struct aer_err_info *info, struct pci_dev *dev)
continue;

if (info->severity == AER_CORRECTABLE)
errmsg = aer_correctable_error_string[i];
errmsg = i < ARRAY_SIZE(aer_correctable_error_string) ?
aer_correctable_error_string[i] : NULL;
else
errmsg = aer_uncorrectable_error_string[i];
errmsg = i < ARRAY_SIZE(aer_uncorrectable_error_string) ?
aer_uncorrectable_error_string[i] : NULL;

if (errmsg)
AER_PR(info, dev, " [%2d] %s%s\n", i, errmsg,
printk("%s"" [%2d] %-22s%s\n", prefix, i, errmsg,
info->first_error == i ? " (First)" : "");
else
AER_PR(info, dev, " [%2d] Unknown Error Bit%s\n", i,
printk("%s"" [%2d] Unknown Error Bit%s\n", prefix, i,
info->first_error == i ? " (First)" : "");
}
}

void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
{
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) {
AER_PR(info, dev,
"PCIe Bus Error: severity=%s, type=Unaccessible, "
"id=%04x(Unregistered Agent ID)\n",
printk("%s""PCIe Bus Error: severity=%s, type=Unaccessible, "
"id=%04x(Unregistered Agent ID)\n", prefix,
aer_error_severity_string[info->severity], id);
} else {
int layer, agent;

layer = AER_GET_LAYER_ERROR(info->severity, info->status);
agent = AER_GET_AGENT(info->severity, info->status);

AER_PR(info, dev,
"PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
aer_error_severity_string[info->severity],
printk("%s""PCIe Bus Error: severity=%s, type=%s, id=%04x(%s)\n",
prefix, 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);
printk("%s"" device [%04x:%04x] error status/mask=%08x/%08x\n",
prefix, dev->vendor, dev->device,
info->status, info->mask);

__aer_print_error(info, dev);
__aer_print_error(prefix, info);

if (info->tlp_header_valid) {
unsigned char *tlp = (unsigned char *) &info->tlp;
AER_PR(info, dev, " TLP Header:"
printk("%s"" 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,
prefix, *(tlp + 3), *(tlp + 2), *(tlp + 1), *tlp,
*(tlp + 7), *(tlp + 6), *(tlp + 5), *(tlp + 4),
*(tlp + 11), *(tlp + 10), *(tlp + 9),
*(tlp + 8), *(tlp + 15), *(tlp + 14),
Expand All @@ -218,8 +191,8 @@ 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, dev,
" Error of this Agent(%04x) is reported first\n", id);
printk("%s"" Error of this Agent(%04x) is reported first\n",
prefix, id);
}

void aer_print_port_info(struct pci_dev *dev, struct aer_err_info *info)
Expand Down

0 comments on commit c29c440

Please sign in to comment.