From patchwork Tue Dec 2 17:35:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fu Wei X-Patchwork-Id: 416941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id E66841401AF; Wed, 3 Dec 2014 04:35:59 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XvrMk-0001CN-SI; Tue, 02 Dec 2014 17:35:58 +0000 Received: from mail-pd0-f182.google.com ([209.85.192.182]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1XvrMe-0001AX-RB for fwts-devel@lists.ubuntu.com; Tue, 02 Dec 2014 17:35:52 +0000 Received: by mail-pd0-f182.google.com with SMTP id r10so13622688pdi.13 for ; Tue, 02 Dec 2014 09:35:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:reply-to:organization :user-agent:mime-version:to:cc:subject:content-type :content-transfer-encoding; bh=OKCrq3TW+80d15vKS5D6KMb/Rk9A+LiVWzdpHL/K+CA=; b=Sosk13IERLbfAi6CPFt4M1lCI33stkB/5StItS6PZlKNosIH/PZhIcblnu1Eati2/V Jn3mgBY2aCnLUvEFPWk4rNGMJ+Rpuvn7wNMRNGZwycf5akg5l8a2cMp5j+UbStj6xL9c 6YHKUG6WUN1G2vd3Pd+2sDvcVyReKEArkUoy5EBegVsy98FjA+5omkuEeWFZPmEPu1lf pMptH6Lwzj9Uhe2wSMpUtGKS+yO/LCtK7d8CCD3s5gYD8uPwYTtf/FnvAOYQLcBa2Rtb 5LofM6T1R8J/pP1XiDOXd1erC3MgO2abPHMXzvyW6cjZfEuKT5yMEpsL8JRRp85/h06T JGRw== X-Gm-Message-State: ALoCoQlxrX6iJiC4rrR4cf1Sghgnp4/CQexiXn/Aea7Wc0H+NN9RzVFrsY/bSwfClRuGpHLI3HRF X-Received: by 10.68.130.136 with SMTP id oe8mr7415531pbb.121.1417541752068; Tue, 02 Dec 2014 09:35:52 -0800 (PST) Received: from [192.168.1.11] ([59.58.227.241]) by mx.google.com with ESMTPSA id c5sm2604854pda.16.2014.12.02.09.35.49 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 02 Dec 2014 09:35:51 -0800 (PST) Message-ID: <547DF872.7090700@linaro.org> Date: Wed, 03 Dec 2014 01:35:46 +0800 From: Fu Wei Organization: Linaro User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0 MIME-Version: 1.0 To: fwts-devel Subject: [PATCH v2 3/3] ACPI: a missing FACS table can be ignored under some circumstances Cc: Al Stone , Graeme Gregory , Hanjun Guo , Andrea Gallo , Ilias Biris X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list Reply-To: Fu Wei 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-bounces@lists.ubuntu.com (1)Both of the FADT fields FIRMWARE_CTRL and X_FIRMWARE_CTRL are allowed to be null, if and only if ACPI is operating in hardware- reduced mode. (2)If the ACPI tables are from before ACPI 5.0, or if ACPI is not operating in hardware-reduced mode, at least one of the FIRMWARE_CTRL or X_FIRMWARE_CTRL fields _must_ be non-null. This patch corrects the logic to ensure that a missing FACS is only allowed under the proper circumstances. Signed-off-by: Fu Wei Acked-by: Hanjun Guo Reviewed-by: Al Stone Acked-by: Colin Ian King Acked-by: Alex Hung --- src/acpi/acpitables/acpitables.c | 5 +++-- src/lib/src/fwts_acpi_tables.c | 24 +++++++++++++++++------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c index 255261c..3d261cb 100644 --- a/src/acpi/acpitables/acpitables.c +++ b/src/acpi/acpitables/acpitables.c @@ -75,10 +75,11 @@ static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *tabl if (fadt->firmware_control == 0) { if (table->length >= 140) { - if (fadt->x_firmware_ctrl == 0) { + if ((fadt->x_firmware_ctrl == 0) && !(fwts_acpi_is_reduced_hardware(fadt))) { fwts_failed(fw, LOG_LEVEL_CRITICAL, "FADTFACSZero", "FADT 32 bit FIRMWARE_CONTROL and 64 bit X_FIRMWARE_CONTROL (FACS address) are null."); fwts_advice(fw, "The 32 bit FIRMWARE_CTRL or 64 bit X_FIRMWARE_CTRL should point to a valid " - "Firmware ACPI Control Structure (FACS). This is a firmware bug and needs to be fixed."); + "Firmware ACPI Control Structure (FACS) when ACPI hardware reduced mode is not set. " + "This is a firmware bug and needs to be fixed."); } } else { fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32BitFACSNull", "FADT 32 bit FIRMWARE_CONTROL is null."); diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index ee592d6..68211e5 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -373,6 +373,7 @@ static int fwts_acpi_handle_fadt( const fwts_acpi_table_provenance provenance) { static uint64_t facs_last_phys_addr; /* default to zero */ + int result = FWTS_ERROR; /* * The FADT handling may occur twice if it appears @@ -384,13 +385,22 @@ static int fwts_acpi_handle_fadt( facs_last_phys_addr = phys_addr; - /* Determine FACS addr and load it */ - if (fwts_acpi_handle_fadt_tables(fw, fadt, - "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", - &fadt->firmware_control, &fadt->x_firmware_ctrl, - provenance) != FWTS_OK) { - fwts_log_error(fw, "Failed to load FACS."); - return FWTS_ERROR; + /* Determine FACS addr and load it. + * Will ignore the missing FACS in the hardware-reduced mode. + */ + result = fwts_acpi_handle_fadt_tables(fw, fadt, + "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", + &fadt->firmware_control, &fadt->x_firmware_ctrl, + provenance); + if (result != FWTS_OK) { + if ((result == FWTS_NULL_POINTER) && + fwts_acpi_is_reduced_hardware(fadt)) { + fwts_log_info(fw, "Ignore the missing FACS. " + "It is optional in hardware-reduced mode"); + } else { + fwts_log_error(fw, "Failed to load FACS."); + return FWTS_ERROR; + } } /* Determine DSDT addr and load it */ if (fwts_acpi_handle_fadt_tables(fw, fadt,