From patchwork Fri Feb 19 23:39:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 62433 Delivered-To: patches@linaro.org Received: by 10.112.43.199 with SMTP id y7csp78702lbl; Fri, 19 Feb 2016 15:41:12 -0800 (PST) X-Received: by 10.202.170.10 with SMTP id t10mr878240oie.60.1455925272774; Fri, 19 Feb 2016 15:41:12 -0800 (PST) Return-Path: Received: from mail-ob0-x235.google.com (mail-ob0-x235.google.com. [2607:f8b0:4003:c01::235]) by mx.google.com with ESMTPS id g5si18932888oif.122.2016.02.19.15.41.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Feb 2016 15:41:12 -0800 (PST) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::235 as permitted sender) client-ip=2607:f8b0:4003:c01::235; Authentication-Results: mx.google.com; spf=pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c01::235 as permitted sender) smtp.mailfrom=al.stone@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-ob0-x235.google.com with SMTP id ts10so6499559obc.1 for ; Fri, 19 Feb 2016 15:41:12 -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=JWb8h3qMVUmLoCbLJadc6+DVcQ42qMV90R0z+kpbOSY=; b=CdbIBsKdHhSAD2PYcrW5aeT7ugU6HEYaPsWcFlqFIYKej3mV21ljHxKoR1Ger9PQsx 9k4KYdTKFxEWmd0rs0UebFOcvmhBfDpzzA0tfSukBnJijzNPvcGN6ZU3o7TnKIW/agqY dmh/iEQYfxbw9n5mK1NM4PzvoaAXzddZPApH0= 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=JWb8h3qMVUmLoCbLJadc6+DVcQ42qMV90R0z+kpbOSY=; b=Stnu3GaLlQyePbnfn8JUunYGTn1mW8zmd2fCVj7gep4wy7CFkskhbtYC31ZU4/G7Qi 5BOCjZaKYfUplNnJx7pi3o8xLvKvwgH5xdy7O/Tsx+XLhA19jTMCe5B7ixCBAZlw+u51 8tdJWL8CUSM2E1sQATF9rSfObO8sPjxmLn2XHbduHDFZTuh85pG72wNe+HQzk2SY9Bf8 pFQyznzROCoP+Y26WY9HkY1PlFAPFsmurT3QdwRAM7grG5BY0ybK3t1u0+hxhYfmj4Gi vYWpPcaL7spbhdSvUpjxef1sJOG7S2H/XeLHxResPegVIss0pXYJHBV05AM3zzhpYix/ cLcg== X-Gm-Message-State: AG10YOTyUejziSsdnspydrDfWg7yNAY6iT5vLWIaYssjAUuKW3lzdT2joRp7mghI7RQnSdrVUFg= X-Received: by 10.182.56.161 with SMTP id b1mr13680417obq.14.1455925272461; Fri, 19 Feb 2016 15:41:12 -0800 (PST) Return-Path: Received: from fidelio.ahs3.com (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by smtp.googlemail.com with ESMTPSA id kg7sm8655217obb.27.2016.02.19.15.41.10 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Feb 2016 15:41:11 -0800 (PST) From: Al Stone To: fwts-devel@lists.ubuntu.com Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, Al Stone Subject: [PATCH v2 17/23] FADT: enhance compliance tests for GPE blocks Date: Fri, 19 Feb 2016 16:39:53 -0700 Message-Id: <1455925199-8587-18-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1455925199-8587-1-git-send-email-al.stone@linaro.org> References: <1455925199-8587-1-git-send-email-al.stone@linaro.org> Other parts of the FADT tests check for proper operation of some of the address fields, like the PM or GPE blocks. The original GPE test was rewritten here to check the fields in more detail. Signed-off-by: Al Stone Acked-by: Colin Ian King Acked-by: Alex Hung --- src/acpi/fadt/fadt.c | 97 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 60 insertions(+), 37 deletions(-) -- 2.5.0 diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index 7c9401c..4254df0 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -1251,50 +1251,72 @@ static void acpi_table_check_fadt_pm_tmr_len(fwts_framework *fw) } } -static void acpi_table_check_fadt_gpe( - fwts_framework *fw, - const fwts_acpi_table_fadt *fadt, - bool *passed) +static void acpi_table_check_fadt_gpe0_blk_len(fwts_framework *fw) { - if (fwts_acpi_is_reduced_hardware(fadt)) { - if (fadt->gpe0_blk_len != 0) { - fwts_warning(fw, "FADT GPE0_BLK_LEN is not zero " - "but should be in reduced hardware mode."); - } - if (fadt->gpe1_blk_len != 0) { - fwts_warning(fw, "FADT GPE1_BLK_LEN is not zero but " - "should be in reduced hardware mode."); - } - return; - } - if (fadt->gpe0_blk_len & 1) { - *passed = false; fwts_failed(fw, LOG_LEVEL_MEDIUM, - "FADTBadGPEBLKLEN", - "FADT GPE0_BLK_LEN is %" PRIu8 - ", should a multiple of 2.", - fadt->gpe0_blk_len); + "FADTBadGPE0BLKLEN", + "FADT GPE0_BLK_LEN is %" PRIu8 + ", should a multiple of 2.", + fadt->gpe0_blk_len); fwts_advice(fw, - "The FADT GPE_BLK_LEN should be a multiple of 2. " - "Because it isn't, the ACPI driver will not map in " - "the GPE0 region. This could mean that General " - "Purpose Events will not function correctly (for " - "example lid or ac-power events)."); + "The FADT GPE0_BLK_LEN should be a multiple of 2. " + "Because it isn't, the ACPI driver will not map in " + "the GPE0 region. This could mean that General " + "Purpose Events will not function correctly (for " + "example lid or AC-power events)."); + } else { + if (fadt->gpe0_blk_len) + fwts_passed(fw, "FADT GPE0_BLK_LEN non-zero and a " + "non-negative multiple of 2: %" PRIu8 ".", + fadt->gpe0_blk_len); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADTZeroGPE0BlkLen", + "FADT GPE0_BLK_LEN is zero, but must be " + "set to a non-negative multiple of 2."); + + } +} + +static void acpi_table_check_fadt_gpe1_blk_len(fwts_framework *fw) +{ + if (fadt->gpe1_blk_len == 0) { + if (fadt->gpe1_blk == 0) + fwts_passed(fw, "FADT GPE1_BLK_LEN is zero and " + "GPE1_BLK is not supported."); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADTGPE1BlkLenInconsistent", + "FADT GPE1_BLK_LEN must be zero because " + "GPE1_BLK is not supported, but is %d.", + fadt->gpe1_blk_len); + return; } + if (fadt->gpe1_blk_len & 1) { - *passed = false; fwts_failed(fw, LOG_LEVEL_MEDIUM, - "FADTBadGPE1BLKLEN", - "FADT GPE1_BLK_LEN is %" PRIu8 - ", should a multiple of 2.", - fadt->gpe1_blk_len); + "FADTBadGPE1BLKLEN", + "FADT GPE1_BLK_LEN is %" PRIu8 + ", should a multiple of 2.", + fadt->gpe1_blk_len); fwts_advice(fw, - "The FADT GPE1_BLK_LEN should be a multiple of 2. " - "Because it isn't, the ACPI driver will not map in " - "the GPE1 region. This could mean that General " - "Purpose Events will not function correctly (for " - "example lid or ac-power events)."); + "The FADT GPE1_BLK_LEN should be a multiple of 2. " + "Because it isn't, the ACPI driver will not map in " + "the GPE1 region. This could mean that General " + "Purpose Events will not function correctly (for " + "example lid or AC-power events)."); + } else { + if (fadt->gpe1_blk_len) + fwts_passed(fw, "FADT GPE1_BLK_LEN non-zero and a " + "non-negative multiple of 2: %" PRIu8 ".", + fadt->gpe1_blk_len); + else + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "FADTZeroGPE1BlkLen", + "FADT GPE1_BLK_LEN is zero, but must be " + "set to a non-negative multiple of 2."); + } } @@ -1332,7 +1354,8 @@ static int fadt_test1(fwts_framework *fw) acpi_table_check_fadt_pm1_cnt_len(fw); acpi_table_check_fadt_pm2_cnt_len(fw); acpi_table_check_fadt_pm_tmr_len(fw); - acpi_table_check_fadt_gpe(fw, fadt, &passed); + acpi_table_check_fadt_gpe0_blk_len(fw); + acpi_table_check_fadt_gpe1_blk_len(fw); fwts_log_info(fw, "FADT GPE1_BASE is %" PRIu8, fadt->gpe1_base); fwts_log_info(fw, "FADT FLUSH_SIZE is %" PRIu16,