From patchwork Tue Feb 28 11:07:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 143402 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 2DE56B6EE7 for ; Tue, 28 Feb 2012 22:07:51 +1100 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1S2KuL-0003Zy-TI for incoming@patchwork.ozlabs.org; Tue, 28 Feb 2012 11:07:49 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1S2KuH-0003XS-M1 for fwts-devel@lists.ubuntu.com; Tue, 28 Feb 2012 11:07:45 +0000 Received: from cpc19-craw6-2-0-cust5.croy.cable.virginmedia.com ([77.102.228.6] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1S2KuH-0003ql-Fl for fwts-devel@lists.ubuntu.com; Tue, 28 Feb 2012 11:07:45 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH 3/3] acpi: checksum: flag up errors that are critical, add more helpful advice Date: Tue, 28 Feb 2012 11:07:42 +0000 Message-Id: <1330427263-26803-4-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.7.9 In-Reply-To: <1330427263-26803-1-git-send-email-colin.king@canonical.com> References: <1330427263-26803-1-git-send-email-colin.king@canonical.com> X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: fwts-devel-bounces@lists.ubuntu.com Errors-To: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/acpi/checksum/checksum.c | 66 +++++++++++++++++++++++++++++++++++------ 1 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/acpi/checksum/checksum.c b/src/acpi/checksum/checksum.c index 77449cc..264e7d0 100644 --- a/src/acpi/checksum/checksum.c +++ b/src/acpi/checksum/checksum.c @@ -42,12 +42,16 @@ static void checksum_rsdp(fwts_framework *fw, fwts_acpi_table_info *table) /* Version 1.0 RSDP checksum, always applies */ checksum = fwts_checksum(table->data, 20); - if (checksum != 0) - fwts_failed(fw, LOG_LEVEL_HIGH, "ACPITableChecksumRSDP", + if (checksum != 0) { + fwts_failed(fw, LOG_LEVEL_CRITICAL, "ACPITableChecksumRSDP", "RSDP has incorrect checksum, expected 0x%2.2x, " "got 0x%2.2x.", (uint8_t)(rsdp->checksum)-checksum, rsdp->checksum); - else + fwts_advice(fw, + "The kernel will not load the RSDP with an " + "invalid checksum and hence all other ACPI " + "tables will also fail to load."); + } else fwts_passed(fw, "Table RSDP has correct checksum 0x%x.", rsdp->checksum); @@ -57,7 +61,7 @@ static void checksum_rsdp(fwts_framework *fw, fwts_acpi_table_info *table) */ if (rsdp->revision > 0) { if (table->length < sizeof(fwts_acpi_table_rsdp)) { - fwts_failed(fw, LOG_LEVEL_HIGH, + fwts_failed(fw, LOG_LEVEL_CRITICAL, "ACPITableCheckSumShortRSDP", "RSDP was expected to be %d bytes long, " "got a shortened size of %d bytes.", @@ -67,20 +71,34 @@ static void checksum_rsdp(fwts_framework *fw, fwts_acpi_table_info *table) return; } checksum = fwts_checksum(table->data, sizeof(fwts_acpi_table_rsdp)); - if (checksum != 0) - fwts_failed(fw, LOG_LEVEL_HIGH, + if (checksum != 0) { + fwts_failed(fw, LOG_LEVEL_CRITICAL, "ACPITableChecksumRSDP", "RSDP has incorrect extended checksum, " "expected 0x%2.2x, got 0x%2.2x.", (uint8_t)(rsdp->extended_checksum-checksum), rsdp->extended_checksum); - else + fwts_advice(fw, + "The kernel will not load the RSDP with an " + "invalid extended checksum and hence all " + "other ACPI tables will also fail to load."); + } else fwts_passed(fw, "Table RSDP has correct extended " "checksum 0x%x.", rsdp->extended_checksum); } } +/* + * The following tables the kernel requires the checksum to be valid otherwise + * it will not load them, so checksum failures here are considered critical errors. + */ +static char *critical_checksum[] = { + "RSDT", + "XSDT", + NULL +}; + static int checksum_scan_tables(fwts_framework *fw) { int i; @@ -104,6 +122,7 @@ static int checksum_scan_tables(fwts_framework *fw) continue; } + /* FACS doesn't have a checksum, so ignore */ if (strcmp("FACS", table->name) == 0) continue; @@ -112,11 +131,38 @@ static int checksum_scan_tables(fwts_framework *fw) fwts_passed(fw, "Table %s has correct checksum 0x%x.", table->name, hdr->checksum); else { - fwts_failed(fw, LOG_LEVEL_LOW, "ACPITableChecksum", + int i; + int log_level = LOG_LEVEL_LOW; + + for (i = 0; critical_checksum[i]; i++) { + if (!strcmp(table->name, critical_checksum[i])) { + log_level = LOG_LEVEL_CRITICAL; + break; + } + } + + fwts_failed(fw, log_level, "ACPITableChecksum", "Table %s has incorrect checksum, " "expected 0x%2.2x, got 0x%2.2x.", - table->name, (uint8_t)(hdr->checksum-checksum), hdr->checksum); - } fwts_tag_failed(fw, FWTS_TAG_ACPI_TABLE_CHECKSUM); + table->name, (uint8_t)(hdr->checksum-checksum), + hdr->checksum); + + /* Give some contextual explanation of the error */ + if (log_level == LOG_LEVEL_CRITICAL) + fwts_advice(fw, + "The kernel requires this table to have a " + "valid checksum and will not load it. This " + "will lead to ACPI not working correctly."); + else + fwts_advice(fw, + "The kernel will warn that this table has " + "an invalid checksum but will ignore the " + "error and still load it. This is not a " + "critical issue, but should be fixed if " + "possible to avoid the warning messages."); + + fwts_tag_failed(fw, FWTS_TAG_ACPI_TABLE_CHECKSUM); + } } return FWTS_OK; }