Commit 0678e310 authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI/AER: Simplify __aer_print_error()

aer_correctable_error_string[] and aer_uncorrectable_error_string[] have
descriptions of AER error status bits.  Add NULL entries to these tables so
all entries for bits 0-31 are defined.  Then we don't have to check for
ARRAY_SIZE() when decoding a status word, which simplifies
__aer_print_error().
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 16d79cd4
...@@ -447,7 +447,7 @@ static const char *aer_error_layer[] = { ...@@ -447,7 +447,7 @@ static const char *aer_error_layer[] = {
"Transaction Layer" "Transaction Layer"
}; };
static const char *aer_correctable_error_string[AER_MAX_TYPEOF_COR_ERRS] = { static const char *aer_correctable_error_string[] = {
"RxErr", /* Bit Position 0 */ "RxErr", /* Bit Position 0 */
NULL, NULL,
NULL, NULL,
...@@ -464,9 +464,25 @@ static const char *aer_correctable_error_string[AER_MAX_TYPEOF_COR_ERRS] = { ...@@ -464,9 +464,25 @@ static const char *aer_correctable_error_string[AER_MAX_TYPEOF_COR_ERRS] = {
"NonFatalErr", /* Bit Position 13 */ "NonFatalErr", /* Bit Position 13 */
"CorrIntErr", /* Bit Position 14 */ "CorrIntErr", /* Bit Position 14 */
"HeaderOF", /* Bit Position 15 */ "HeaderOF", /* Bit Position 15 */
NULL, /* Bit Position 16 */
NULL, /* Bit Position 17 */
NULL, /* Bit Position 18 */
NULL, /* Bit Position 19 */
NULL, /* Bit Position 20 */
NULL, /* Bit Position 21 */
NULL, /* Bit Position 22 */
NULL, /* Bit Position 23 */
NULL, /* Bit Position 24 */
NULL, /* Bit Position 25 */
NULL, /* Bit Position 26 */
NULL, /* Bit Position 27 */
NULL, /* Bit Position 28 */
NULL, /* Bit Position 29 */
NULL, /* Bit Position 30 */
NULL, /* Bit Position 31 */
}; };
static const char *aer_uncorrectable_error_string[AER_MAX_TYPEOF_UNCOR_ERRS] = { static const char *aer_uncorrectable_error_string[] = {
"Undefined", /* Bit Position 0 */ "Undefined", /* Bit Position 0 */
NULL, NULL,
NULL, NULL,
...@@ -494,6 +510,11 @@ static const char *aer_uncorrectable_error_string[AER_MAX_TYPEOF_UNCOR_ERRS] = { ...@@ -494,6 +510,11 @@ static const char *aer_uncorrectable_error_string[AER_MAX_TYPEOF_UNCOR_ERRS] = {
"AtomicOpBlocked", /* Bit Position 24 */ "AtomicOpBlocked", /* Bit Position 24 */
"TLPBlockedErr", /* Bit Position 25 */ "TLPBlockedErr", /* Bit Position 25 */
"PoisonTLPBlocked", /* Bit Position 26 */ "PoisonTLPBlocked", /* Bit Position 26 */
NULL, /* Bit Position 27 */
NULL, /* Bit Position 28 */
NULL, /* Bit Position 29 */
NULL, /* Bit Position 30 */
NULL, /* Bit Position 31 */
}; };
static const char *aer_agent_string[] = { static const char *aer_agent_string[] = {
...@@ -650,24 +671,23 @@ static void __print_tlp_header(struct pci_dev *dev, ...@@ -650,24 +671,23 @@ static void __print_tlp_header(struct pci_dev *dev,
static void __aer_print_error(struct pci_dev *dev, static void __aer_print_error(struct pci_dev *dev,
struct aer_err_info *info) struct aer_err_info *info)
{ {
const char **strings;
unsigned long status = info->status & ~info->mask; unsigned long status = info->status & ~info->mask;
const char *errmsg = NULL; const char *errmsg;
int i; int i;
if (info->severity == AER_CORRECTABLE)
strings = aer_correctable_error_string;
else
strings = aer_uncorrectable_error_string;
for_each_set_bit(i, &status, 32) { for_each_set_bit(i, &status, 32) {
if (info->severity == AER_CORRECTABLE) errmsg = strings[i];
errmsg = i < ARRAY_SIZE(aer_correctable_error_string) ? if (!errmsg)
aer_correctable_error_string[i] : NULL; errmsg = "Unknown Error Bit";
else
errmsg = i < ARRAY_SIZE(aer_uncorrectable_error_string) ?
aer_uncorrectable_error_string[i] : NULL;
if (errmsg) pci_err(dev, " [%2d] %-22s%s\n", i, errmsg,
pci_err(dev, " [%2d] %-22s%s\n", i, errmsg,
info->first_error == i ? " (First)" : ""); info->first_error == i ? " (First)" : "");
else
pci_err(dev, " [%2d] Unknown Error Bit%s\n",
i, info->first_error == i ? " (First)" : "");
} }
pci_dev_aer_stats_incr(dev, info); pci_dev_aer_stats_incr(dev, info);
} }
......
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