From patchwork Tue Feb 9 01:32:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 61463 Delivered-To: patches@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1766742lbl; Mon, 8 Feb 2016 17:33:55 -0800 (PST) X-Received: by 10.60.232.99 with SMTP id tn3mr27218651oec.8.1454981627006; Mon, 08 Feb 2016 17:33:47 -0800 (PST) Return-Path: Received: from mail-ob0-x230.google.com (mail-ob0-x230.google.com. [2607:f8b0:4003:c01::230]) by mx.google.com with ESMTPS id fr16si18727272oeb.24.2016.02.08.17.33.46 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Feb 2016 17:33:46 -0800 (PST) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::230 as permitted sender) client-ip=2607:f8b0:4003:c01::230; Authentication-Results: mx.google.com; spf=pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::230 as permitted sender) smtp.mailfrom=al.stone@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-ob0-x230.google.com with SMTP id wb13so175738392obb.1 for ; Mon, 08 Feb 2016 17:33:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=GJ4TO9KNl3Gh6+Spq7hXhtlElEOlLn/i2j24cdJfZ28=; b=Onf2O5G1WQdyaeLaADoa9H1uik7aT+mfT3uyh5T1xafpVPW+ZCcvPpu9tHoH9N89r6 8hLygEKnVgP/Cz+dpKr/y168tSpvj+VEmPuLE43N5Jn+JqS7XYEplHSCvgu7lbm/gbWQ BU5Bl5mx84ITC6Q3b7hh6LWrydBzq61qTNKLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=GJ4TO9KNl3Gh6+Spq7hXhtlElEOlLn/i2j24cdJfZ28=; b=XvkqpOkVAei9IYfOe+MLpYeMb9D4XgAry/pihtMb9aPZojmOg42HUd7Or/g2M6t9Zh 6RMys9N+XGYisiA8+0OsjKoe8z5SUoFLfJ3UlrGQZrBR9GFEZ4kBWSinnHEaeqcSc93n ldBsTC4xvzfwTxYJqa7RfjB5iggXdK/8ilPq4np9yf7GAPuMTP3uIdGFu8etmPtTPW9X kQUEhl0VsAzwHBvciO6HiRcIFus1TB2WqT4hi2sAMXpGx5AMuC08gJ8Y5cRrG1ifu1em AX8AgJFoe6Mgnz1iYQq151D+bZ2sIGPLNUFdVLpK6MinTkc6uhrO/7tsXRLO76jHYXm7 Lhzw== X-Gm-Message-State: AG10YOT8FDzwyqut8YPgHg0VIoofWcokDxCKxCTDedDsbKdsZGWqokHksgGfJVmzQQB0VfDq82U= X-Received: by 10.60.101.199 with SMTP id fi7mr27606568oeb.20.1454981626731; Mon, 08 Feb 2016 17:33:46 -0800 (PST) Return-Path: Received: from fidelio.ahs3 (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by smtp.googlemail.com with ESMTPSA id qp4sm19097135obc.9.2016.02.08.17.33.45 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Feb 2016 17:33:45 -0800 (PST) From: Al Stone To: fwts-devel@lists.ubuntu.com Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, Al Stone Subject: [PATCH 10/21] FADT: expand compliance checks for DSDT and X_DSDT fields Date: Mon, 8 Feb 2016 18:32:52 -0700 Message-Id: <1454981583-31872-11-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1454981583-31872-1-git-send-email-al.stone@linaro.org> References: <1454981583-31872-1-git-send-email-al.stone@linaro.org> Expand the testing of the DSDT address -- and by extension, the X_DSDT address field -- to check for full compliance with the spec. Only one or the other may be used at any one time, per 6.1, but we also have to acknowledge there are tables that do use both the 32- and 64-bit values. At that point, we re-use parts of the existing test to verify that they are at least consistent. Signed-off-by: Al Stone --- src/acpi/fadt/fadt.c | 99 +++++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 43 deletions(-) -- 2.5.0 diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index 84f4e09..b21653d 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -295,54 +295,67 @@ static void acpi_table_check_fadt_firmware_ctrl(fwts_framework *fw) } } -static void acpi_table_check_fadt_dsdt( - fwts_framework *fw, - const fwts_acpi_table_fadt *fadt, - bool *passed) +static void acpi_table_check_fadt_dsdt(fwts_framework *fw) { - + /* check out older FADTs */ if (fadt->header.length < 148) { - if (fadt->dsdt == 0) { - *passed = false; + if (fadt->dsdt == 0) fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADTDSDTNull", "FADT DSDT address is null."); - } - } else { - if (fadt->x_dsdt == 0) { - if (fadt->dsdt == 0) { - *passed = false; - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "FADTXDSDTNull", - "FADT X_DSDT and DSDT address are null."); - } else { - *passed = false; - fwts_failed(fw, LOG_LEVEL_MEDIUM, - "FADTXDSDTNull", - "FADT X_DSDT address is null."); - fwts_advice(fw, - "An ACPI 2.0 FADT is being used however " - "the 64 bit X_DSDT is null." - "The kernel will fall back to using " - "the 32 bit DSDT pointer instead."); - } - } else if ((uint64_t)fadt->dsdt != fadt->x_dsdt && fadt->dsdt != 0) { - *passed = false; + } + + /* if one field is being used, the other must be null */ + if ((fadt->dsdt != 0 && fadt->x_dsdt == 0) || + (fadt->dsdt == 0 && fadt->x_dsdt != 0)) + fwts_passed(fw, + "FADT has only one of X_DSDT or DSDT addresses " + "being used."); + else { + if (fadt->dsdt == 0 && fadt->x_dsdt == 0) fwts_failed(fw, LOG_LEVEL_MEDIUM, - "FADT32And64Mismatch", - "FADT 32 bit DSDT (0x%" PRIx32 ") " - "does not point to same " - "physical address as 64 bit X_DSDT " - "(0x%" PRIx64 ").", - fadt->dsdt, fadt->x_dsdt); - fwts_advice(fw, - "One would expect the 32 bit DSDT and " - "64 bit X_DSDT pointers to point to the " - "same DSDT, however they don't which is " - "clearly ambiguous and wrong. " - "The kernel works around this by using the " - "64 bit X_DSDT pointer to the DSDT. "); - } + "FADTOneDSDTNull", + "FADT X_DSDT and DSDT addresses cannot " + "both be null."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADTBothDSDTSet", + "FADT X_DSDT and DSDT addresses cannot " + "both be set to a value."); + } + + /* unexpected use of addresses */ + if (fadt->dsdt != 0 && fadt->x_dsdt == 0) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADTXDSDTNull", + "FADT X_DSDT address is null."); + fwts_advice(fw, + "An ACPI 2.0 or newer FADT is being used however " + "the 64 bit X_DSDT is null." + "The kernel will fall back to using " + "the 32 bit DSDT pointer instead."); + } + + /* + * If you are going to insist on using both fields, even though + * that is incorrect, at least make it unambiguous as to which + * address is the one to use. + */ + if ((uint64_t)fadt->dsdt != fadt->x_dsdt && fadt->dsdt != 0) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADT32And64Mismatch", + "FADT 32 bit DSDT (0x%" PRIx32 ") " + "does not point to same " + "physical address as 64 bit X_DSDT " + "(0x%" PRIx64 ").", + fadt->dsdt, fadt->x_dsdt); + fwts_advice(fw, + "One would expect the 32 bit DSDT and " + "64 bit X_DSDT pointers to point to the " + "same DSDT, however they don't which is " + "clearly ambiguous and wrong. " + "The kernel works around this by using the " + "64 bit X_DSDT pointer to the DSDT. "); } } @@ -531,7 +544,7 @@ static int fadt_test1(fwts_framework *fw) bool passed = true; acpi_table_check_fadt_firmware_ctrl(fw); - acpi_table_check_fadt_dsdt(fw, fadt, &passed); + acpi_table_check_fadt_dsdt(fw); acpi_table_check_fadt_smi(fw, fadt, &passed); acpi_table_check_fadt_pm_tmr(fw, fadt, &passed); acpi_table_check_fadt_gpe(fw, fadt, &passed);