From patchwork Fri Aug 13 21:35:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1516769 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; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=ZHHc6ZO5; dkim-atps=neutral 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 4GmcLP3pt1z9sWq for ; Sat, 14 Aug 2021 07:35:57 +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 1mEeqH-0008Ll-OT; Fri, 13 Aug 2021 21:35:53 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mEeq9-0008Kz-Lr for fwts-devel@lists.ubuntu.com; Fri, 13 Aug 2021 21:35:45 +0000 Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 2F1313F0A1 for ; Fri, 13 Aug 2021 21:35:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628890545; bh=ks4d2/cfx8MRC7fLiNyIZdfgaRKsdU1DdaXDR99jqd0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ZHHc6ZO5YgVSVIzYVhkc8msiytnf4C1lzf+hGmoExi8IXrUee0Sxm2OpgiykFIAqZ A1rIG/soJngokWPeiQk73U0J4lglCgJuv3SVa8eoqjXsVqSBrNq6ushpVG/M+pIk1H ayGRvBkAHsUzyxcNOplB26XNkzJzRa7dMYcpc9mR32bS/VsGFkdpslttav2gqtD89J JRRJ1YHokT7KeiVjXR6BrRYR4i4nk0pKxcrkd1GJioHWG6QAMhgmEf9tApasjbG+1X mS2r4SlV848Uo1DpUOivV6Nm1rX7SJc1QbEdKxXBQVu0B5vYPj2x+4YSxaZRMVJTsK G+kK59qdbcOEA== Received: by mail-pj1-f71.google.com with SMTP id 2-20020a17090a1742b0290178de0ca331so7625081pjm.1 for ; Fri, 13 Aug 2021 14:35:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ks4d2/cfx8MRC7fLiNyIZdfgaRKsdU1DdaXDR99jqd0=; b=ESMYgGgAmKIo1hQ/9rUfWxyL/EM9skA2JiAl3UDYNV5tEBa+qhIPTIwb7P3sdlYh11 NOU/3E8Jagxgls4HUZh9C6nzDWaL9Iy+4xu4ZUOgJqpiwtOoYN6rEbjKXmEtLfQDaExm p5+PwVAYc/pWCx5kZ/mi2oSHa3HtnavYA5VnRPBz92j7xkJ8ZCJI+84Z+jvSmn+Ju370 QCvgdWzofHWbQTMrBKgB7gVkWRKAYAQ9Ucgg3WVw5BrIxkbZW/6TiOWFGoufPUYhiaPH pUHiDmWBrPQLxZYQBUX/A+pk7VZ/5yBMF+l88r/LBoZl5RHY1eeQL3C1hPEjUwd1yVJJ Jmsw== X-Gm-Message-State: AOAM53294utVGJ1sqPaKMUezKdB+I9e250M3jbZsN0gPSPcIUOQ9a0Cm VQtF69KXr0Tl8AASeDfZQRn4kCh7bO4OxK/0nK6XE1q1BXfz+TjHZT1452TipTV25vcoGS8k6w4 Lf92NffW6MlRavdEx82m+eG2tF+nqdx6T08uDIkfM X-Received: by 2002:a17:902:7681:b0:12d:8f52:3d55 with SMTP id m1-20020a170902768100b0012d8f523d55mr3534062pll.70.1628890542923; Fri, 13 Aug 2021 14:35:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwGv3XuX4eH/nrMUK+uwx8XIXS1d33RjXP7Nbc8xkZkFm51lMPaa8+G/qivdm4iMqqwHK2NyA== X-Received: by 2002:a17:902:7681:b0:12d:8f52:3d55 with SMTP id m1-20020a170902768100b0012d8f523d55mr3534055pll.70.1628890542633; Fri, 13 Aug 2021 14:35:42 -0700 (PDT) Received: from canonical.com (node-1w7jr9yeotzddnlkq9kweiluf.ipv6.telus.net. [2001:56a:7943:7600::d17]) by smtp.gmail.com with ESMTPSA id g10sm3331642pfh.120.2021.08.13.14.35.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Aug 2021 14:35:42 -0700 (PDT) From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] acpi: sbbr: refactor by fwts_get_fadt_version Date: Fri, 13 Aug 2021 15:35:39 -0600 Message-Id: <20210813213539.546368-2-alex.hung@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210813213539.546368-1-alex.hung@canonical.com> References: <20210813213539.546368-1-alex.hung@canonical.com> 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: Ivan Hu Acked-by: Colin Ian King --- src/acpi/acpiinfo/acpiinfo.c | 7 +------ src/acpi/fadt/fadt.c | 5 +---- src/acpi/madt/madt.c | 4 +--- src/sbbr/fadt/fadt.c | 3 +-- 4 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/acpi/acpiinfo/acpiinfo.c b/src/acpi/acpiinfo/acpiinfo.c index 8f521605..b5f32242 100644 --- a/src/acpi/acpiinfo/acpiinfo.c +++ b/src/acpi/acpiinfo/acpiinfo.c @@ -111,7 +111,6 @@ static int acpiinfo_test1(fwts_framework *fw) static int acpiinfo_test2(fwts_framework *fw) { fwts_acpi_table_info *table; - fwts_acpi_table_fadt *fadt; uint8_t major; uint8_t minor = 0; @@ -121,11 +120,7 @@ static int acpiinfo_test2(fwts_framework *fw) if (table == NULL || table->data == NULL) return FWTS_ERROR; - fadt = (fwts_acpi_table_fadt *)table->data; - - major = fadt->header.revision; - if (major >= 5 && fadt->header.length >= 268) - minor = fadt->minor_version; + fwts_get_fadt_version(fw, &major, &minor); fwts_log_info(fw, "FACP ACPI Version: %" PRIu8 ".%" PRIu8, major, minor); diff --git a/src/acpi/fadt/fadt.c b/src/acpi/fadt/fadt.c index fc8b5987..d72345b7 100644 --- a/src/acpi/fadt/fadt.c +++ b/src/acpi/fadt/fadt.c @@ -201,10 +201,7 @@ static int fadt_revision(fwts_framework *fw) uint8_t major; uint8_t minor; - major = fadt->header.revision; - minor = 0; - if (major >= 5 && fadt->header.length >= 268) - minor = fadt->minor_version & 0xF; /* field added ACPI 5.1 */ + fwts_get_fadt_version(fw, &major, &minor); fwts_log_info(fw, "FADT revision: %" PRIu8 ".%" PRIu8, major, minor); fwts_log_info(fw, "FADT table length: %" PRIu32, fadt->header.length); diff --git a/src/acpi/madt/madt.c b/src/acpi/madt/madt.c index 7173023a..82ec1115 100644 --- a/src/acpi/madt/madt.c +++ b/src/acpi/madt/madt.c @@ -393,9 +393,7 @@ static int madt_init(fwts_framework *fw) return FWTS_ERROR; } } - - if (fadt_major >= 5 && fadt->header.length >= 268) - fadt_minor = fadt->minor_version; /* field added ACPI 5.1 */ + fwts_get_fadt_version(fw, &fadt_major, &fadt_minor); /* find the first occurrence for this version of MADT */ while (ms->num_types != 0) { diff --git a/src/sbbr/fadt/fadt.c b/src/sbbr/fadt/fadt.c index a9b409ae..649a0840 100644 --- a/src/sbbr/fadt/fadt.c +++ b/src/sbbr/fadt/fadt.c @@ -68,8 +68,7 @@ static int fadt_sbbr_revision(fwts_framework *fw) uint8_t major = fadt->header.revision; uint8_t minor = 0; - if ((major >= 5) && (fadt->header.length >= 268)) - minor = fadt->minor_version; /* field added ACPI 5.1 */ + fwts_get_fadt_version(fw, &major, &minor); fwts_log_info(fw, "FADT revision: %" PRIu8 ".%" PRIu8, major, minor);