From patchwork Tue May 5 04:13:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1283211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49GRDB6nkQz9sSW; Tue, 5 May 2020 14:13:28 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jVoxP-0001uG-0W; Tue, 05 May 2020 04:13:23 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jVoxN-0001uA-Bx for fwts-devel@lists.ubuntu.com; Tue, 05 May 2020 04:13:21 +0000 Received: from 2.general.alexhung.us.vpn ([10.172.65.255] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jVoxM-0003BT-J4; Tue, 05 May 2020 04:13:21 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi/method: check reserved bits from _BBN return Date: Mon, 4 May 2020 22:13:17 -0600 Message-Id: <20200505041317.307921-1-alex.hung@canonical.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" Signed-off-by: Alex Hung Acked-by: Colin Ian King Acked-by: Ivan Hu --- src/acpi/method/method.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c index 3641f94e..cd4d15c7 100644 --- a/src/acpi/method/method.c +++ b/src/acpi/method/method.c @@ -1230,10 +1230,36 @@ static int method_test_STA(fwts_framework *fw) /* * Section 6.5 Other Objects and Controls */ +static void method_test_BBN_return( + fwts_framework *fw, + char *name, + ACPI_BUFFER *buf, + ACPI_OBJECT *obj, + void *private) +{ + bool failed = false; + FWTS_UNUSED(private); + + if (fwts_method_check_type(fw, name, buf, ACPI_TYPE_INTEGER) != FWTS_OK) + return; + + if ((obj->Integer.Value & 0xffffff00)) { + fwts_failed(fw, LOG_LEVEL_MEDIUM, + "Method_BBNIllegalReserved", + "%s returned value 0x%8.8" PRIx64 " and some of the " + "reserved bits are set when they should be zero.", + name, (uint64_t)obj->Integer.Value); + failed = true; + } + + if (!failed) + fwts_method_passed_sane(fw, name, "integer"); +} + static int method_test_BBN(fwts_framework *fw) { return method_evaluate_method(fw, METHOD_OPTIONAL, "_BBN", - NULL, 0, fwts_method_test_integer_return, "_BBN"); + NULL, 0, method_test_BBN_return, NULL); } static int method_test_BDN(fwts_framework *fw)