From patchwork Tue Feb 9 01:32:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 61470 Delivered-To: patches@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1766869lbl; Mon, 8 Feb 2016 17:34:16 -0800 (PST) X-Received: by 10.202.227.80 with SMTP id a77mr1575033oih.131.1454981647240; Mon, 08 Feb 2016 17:34:07 -0800 (PST) Return-Path: Received: from mail-oi0-x236.google.com (mail-oi0-x236.google.com. [2607:f8b0:4003:c06::236]) by mx.google.com with ESMTPS id v5si18724140oeq.19.2016.02.08.17.34.07 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Feb 2016 17:34:07 -0800 (PST) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c06::236 as permitted sender) client-ip=2607:f8b0:4003:c06::236; Authentication-Results: mx.google.com; spf=pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c06::236 as permitted sender) smtp.mailfrom=al.stone@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-oi0-x236.google.com with SMTP id j125so7155573oih.1 for ; Mon, 08 Feb 2016 17:34:07 -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=LXrQRQGZbsZoYnocP4EqYG2e5m+fXT+P6asNk0B2NR8=; b=Ul8DKJ29lp3tRTZqCbY25PMwN9nIETKZdkWULEY5SkpJZrrDCsDRvlOJnAUTTIzMlW zCASNAydegxQalS3OPK2B4zvnG850uDZMj1sJ9WWW5IDGcUDpODzQvzzHgcZffUBL+74 GWklsltvaaXaEqHf672owoIqs5UWT+FQH755I= 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=LXrQRQGZbsZoYnocP4EqYG2e5m+fXT+P6asNk0B2NR8=; b=SmeCm7HRWFSCn+AyDL5ABXlXsH/S/vSXM6sBNhGNA7ZKHWii/aXVWm886J2tV0M8Rl hOrBSK7iUR9kit+cQi9JFKqU1qJBTe7+sko9vNkmf2cfwDJQVYgsrdYKJ/mYXwWaBWdC Wc6enQwSyykZoZrV1VeqOqJHxtXLkhRku0Z1/Kl3lvWpFeL4qcO5kuhASHI5KzinHjsp IWp07OSROrhmwub0sCJI+KGFqlpHvVjdpRIlcZ71VbP1qaPwnNK3WUGtgmP9QV6MnMtm toW9JGzQZPCrU0KDjT2L29LyAFxCxEAHB/4aX6GcrkcNDb2+V5yUJ/J/QRTev1XZQRDJ QXSA== X-Gm-Message-State: AG10YOS3Ztvkl5oFXdrtGRj9lzpjnxGJduZ3SKcGkAOC4BJukm10IfDtDT0XCxY5j91xBoXMfaY= X-Received: by 10.202.91.130 with SMTP id p124mr1562123oib.38.1454981646948; Mon, 08 Feb 2016 17:34:06 -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.34.05 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 08 Feb 2016 17:34:05 -0800 (PST) From: Al Stone To: fwts-devel@lists.ubuntu.com Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, Al Stone Subject: [PATCH 17/21] FADT: enhance compliance tests for GPE blocks Date: Mon, 8 Feb 2016 18:32:59 -0700 Message-Id: <1454981583-31872-18-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> 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 --- 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 3b5547f..b349954 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -1227,50 +1227,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."); + } } @@ -1308,7 +1330,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,