From patchwork Fri Apr 9 02:27:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1464131 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=) 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 4FGhqs5Yb2z9sSC for ; Fri, 9 Apr 2021 12:27:52 +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 1lUgs7-0002Wh-2r; Fri, 09 Apr 2021 02:27:47 +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 1lUgs5-0002Wb-IO for fwts-devel@lists.ubuntu.com; Fri, 09 Apr 2021 02:27:45 +0000 Received: from [104.157.111.226] (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 1lUgs5-00026l-38; Fri, 09 Apr 2021 02:27:45 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/3] acpi: lib: add three helper functions Date: Thu, 8 Apr 2021 20:27:38 -0600 Message-Id: <20210409022740.501168-1-alex.hung@canonical.com> X-Mailer: git-send-email 2.31.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" Includes: fwts_acpi_structure_length_zero_check fwts_acpi_structure_range_check fwts_acpi_structure_type_error Signed-off-by: Alex Hung --- src/lib/include/fwts_acpi_tables.h | 3 ++ src/lib/src/fwts_acpi_tables.c | 62 ++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/src/lib/include/fwts_acpi_tables.h b/src/lib/include/fwts_acpi_tables.h index 56414730..7b62af8f 100644 --- a/src/lib/include/fwts_acpi_tables.h +++ b/src/lib/include/fwts_acpi_tables.h @@ -76,6 +76,9 @@ void fwts_acpi_reserved_bits_check_(fwts_framework *fw, const char *table, const void fwts_acpi_reserved_type_check(fwts_framework *fw, const char *table, uint8_t value, uint8_t min, uint8_t reserved, bool *passed); bool fwts_acpi_table_length_check(fwts_framework *fw, const char *table, uint32_t length, uint32_t size); bool fwts_acpi_structure_length_check(fwts_framework *fw, const char *table, uint8_t subtable_type, uint32_t subtable_length, uint32_t size); +bool fwts_acpi_structure_length_zero_check(fwts_framework *fw, const char *table, uint16_t length, uint32_t offset); +bool fwts_acpi_structure_range_check(fwts_framework *fw, const char *table, uint32_t table_length, uint32_t offset); +void fwts_acpi_structure_type_error(fwts_framework *fw, const char *table, uint8_t max_type, uint8_t type); void fwts_acpi_fixed_value_check(fwts_framework *fw, fwts_log_level level, const char *table, const char *field, uint8_t actual, uint8_t must_be, bool *passed); void fwts_acpi_space_id_check(fwts_framework *fw, const char *table, const char *field, bool *passed, uint8_t actual, uint8_t num_type, ...); diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c index dc42a8bd..45908c28 100644 --- a/src/lib/src/fwts_acpi_tables.c +++ b/src/lib/src/fwts_acpi_tables.c @@ -1738,6 +1738,68 @@ bool fwts_acpi_structure_length_check( return true; } +/* + * fwts_acpi_structure_length_zero_check() + * verify whether sub structure length is outside table + */ +bool fwts_acpi_structure_length_zero_check( + fwts_framework *fw, + const char *table, + uint16_t length, + uint32_t offset) +{ + if (length == 0) { + char label[30]; + strncpy(label, table, 4); /* ACPI name is 4 char long */ + strncpy(label + 4, "StructLengthZero", sizeof(label) - 4); + fwts_failed(fw, LOG_LEVEL_CRITICAL, label, + "%4.4s structure (offset 0x%4.4" PRIx32 ") " + "length cannot be 0", table, offset); + return true; + } + return false; +} + +/* + * fwts_acpi_structure_range_check() + * verify whether sub structure length is zero + */ +bool fwts_acpi_structure_range_check( + fwts_framework *fw, + const char *table, + uint32_t table_length, + uint32_t offset) +{ + if (offset > table_length) { + char label[30]; + strncpy(label, table, 4); /* ACPI name is 4 char long */ + strncpy(label + 4, "BadTableLength", sizeof(label) - 4); + fwts_failed(fw, LOG_LEVEL_CRITICAL, label, + "%4.4s has more subtypes than its size can handle", table); + + return true; + } + return false; +} + +/* + * fwts_acpi_structure_type_range() + * output failure for out-of-range type + */ +void fwts_acpi_structure_type_error( + fwts_framework *fw, + const char *table, + uint8_t max_type, + uint8_t type) +{ + char label[30]; + strncpy(label, table, 4); /* ACPI name is 4 char long */ + strncpy(label + 4, "BadSubtableType", sizeof(label) - 4); + fwts_failed(fw, LOG_LEVEL_HIGH, label, + "%4.4s must have subtable with Type 0..%" PRId8 + " got %" PRId8 " instead", table, max_type, type); +} + static uint32_t acpi_version; /* * fwts_get_acpi_version() From patchwork Fri Apr 9 02:27: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: 1464132 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=) 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 4FGhqt6Rc9z9sW1 for ; Fri, 9 Apr 2021 12:27:54 +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 1lUgsC-0002Y5-68; Fri, 09 Apr 2021 02:27:52 +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 1lUgs9-0002XZ-Ka for fwts-devel@lists.ubuntu.com; Fri, 09 Apr 2021 02:27:49 +0000 Received: from [104.157.111.226] (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 1lUgs9-00026x-1k; Fri, 09 Apr 2021 02:27:49 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/3] acpi: phat: add a test for PHAT table Date: Thu, 8 Apr 2021 20:27:39 -0600 Message-Id: <20210409022740.501168-2-alex.hung@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210409022740.501168-1-alex.hung@canonical.com> References: <20210409022740.501168-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 --- src/Makefile.am | 1 + src/acpi/phat/phat.c | 153 ++++++++++++++++++++++++++++++++++++ src/lib/include/fwts_acpi.h | 40 ++++++++++ 3 files changed, 194 insertions(+) create mode 100644 src/acpi/phat/phat.c diff --git a/src/Makefile.am b/src/Makefile.am index a26a197b..95293080 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -118,6 +118,7 @@ fwts_SOURCES = main.c \ acpi/pdtt/pdtt.c \ acpi/powerbutton/powerbutton.c \ acpi/plddump/plddump.c \ + acpi/phat/phat.c \ acpi/pmtt/pmtt.c \ acpi/pptt/pptt.c \ acpi/rasf/rasf.c \ diff --git a/src/acpi/phat/phat.c b/src/acpi/phat/phat.c new file mode 100644 index 00000000..066d1313 --- /dev/null +++ b/src/acpi/phat/phat.c @@ -0,0 +1,153 @@ +/* + * Copyright (C) 2021 Canonical + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include "fwts.h" + +#if defined(FWTS_HAS_ACPI) + +#include +#include +#include +#include +#include +#include + +static fwts_acpi_table_info *table; +acpi_table_init(PHAT, &table) + +static void print_record_header(fwts_framework *fw, const fwts_acpi_table_phat_header *header) +{ + fwts_log_info_simp_int(fw, " Type: ", header->type); + fwts_log_info_simp_int(fw, " Record Length: ", header->length); + fwts_log_info_simp_int(fw, " Revision: ", header->revision); +} + +static void phat_version_test(fwts_framework *fw, fwts_acpi_table_phat_version *entry, bool *passed) +{ + uint32_t reserved, i; + + reserved = entry->reserved[0] + (entry->reserved[1] << 8) + (entry->reserved[2] << 16); + + fwts_log_info_verbatim(fw, " Firmware Version Data Record (Type 0):"); + print_record_header(fw, &entry->header); + fwts_log_info_simp_int(fw, " Reserved: ", reserved); + fwts_log_info_simp_int(fw, " Record Count: ", entry->element_count); + + for (i = 0 ; i < entry->element_count; i++) { + char guid[37]; + fwts_acpi_table_phat_version_elem *element = + (fwts_acpi_table_phat_version_elem *) ((char *)entry + sizeof(fwts_acpi_table_phat_version)); + + fwts_guid_buf_to_str(element->component_id, guid, sizeof(guid)); + + fwts_log_info_verbatim(fw, " Component ID: %s", guid); + fwts_log_info_simp_int(fw, " Version: ", element->version); + fwts_log_info_simp_int(fw, " Producer ID: ", element->producer_id); + } + + fwts_acpi_reserved_zero_check("PHAT", "Reserved", reserved, passed); +} + +static void phat_health_test(fwts_framework *fw, fwts_acpi_table_phat_health *entry, bool *passed) +{ + char *device_path; + char guid[37]; + + fwts_guid_buf_to_str(entry->data_signature, guid, sizeof(guid)); + device_path = (char *)entry + sizeof(fwts_acpi_table_phat_health); + + fwts_log_info_verbatim(fw, " Firmware Health Data Record (Type 1):"); + print_record_header(fw, &entry->header); + fwts_log_info_simp_int(fw, " Reserved: ", entry->reserved); + fwts_log_info_simp_int(fw, " AmHealthy: ", entry->healthy); + fwts_log_info_verbatim(fw, " Device Signature: %s", guid); + fwts_log_info_simp_int(fw, " Device-specific Data Offset: ", entry->data_offset); + fwts_log_info_verbatim(fw, " Device Path: %s", device_path); + + if (entry->data_offset != 0) { + uint16_t i; + + for (i = entry->data_offset; i < entry->header.length; i++) { + uint8_t *vendor_data = (uint8_t *)entry + i; + fwts_log_info_simp_int(fw, " Vendor Data: ", *vendor_data); + } + } + + fwts_acpi_reserved_zero_check("PHAT", "Reserved", entry->reserved, passed); + + if (entry->data_offset > entry->header.length) { + fwts_failed(fw, LOG_LEVEL_CRITICAL, + "PHATOutOfRangeOffset", + "PHAT Type 1's Data Offset is out of range"); + *passed = false; + } +} + +static int phat_test1(fwts_framework *fw) +{ + fwts_acpi_table_phat_header *entry; + bool passed = true; + uint32_t offset; + + fwts_log_info_verbatim(fw, "PHAT Platform Health Assessment Table:"); + + entry = (fwts_acpi_table_phat_header *) (table->data + sizeof(fwts_acpi_table_phat)); + offset = sizeof(fwts_acpi_table_phat); + while (offset < table->length) { + + if (fwts_acpi_structure_length_zero_check(fw, "PHAT", entry->length, offset)) { + passed = false; + break; + } + + if (entry->type == FWTS_ACPI_PHAT_VERSION) { + phat_version_test(fw, (fwts_acpi_table_phat_version *) entry, &passed); + } else if (entry->type == FWTS_ACPI_PHAT_HEALTH) { + phat_health_test(fw, (fwts_acpi_table_phat_health *) entry, &passed); + } else { + fwts_acpi_structure_type_error(fw, "PHAT", FWTS_ACPI_PHAT_END - 1, entry->type); + passed = false; + break; + } + + offset += entry->length; + if (fwts_acpi_structure_range_check(fw, "PHAT", table->length, offset)) { + passed = false; + break; + } + + entry = (fwts_acpi_table_phat_header *) (table->data + offset); + fwts_log_nl(fw); + } + + if (passed) + fwts_passed(fw, "No issues found in PHAT table."); + + return FWTS_OK; +} + +static fwts_framework_minor_test phat_tests[] = { + { phat_test1, "Validate PHAT table." }, + { NULL, NULL } +}; + +static fwts_framework_ops phat_ops = { + .description = "PHAT Platform Health Assessment Table test.", + .init = PHAT_init, + .minor_tests = phat_tests +}; + +FWTS_REGISTER("phat", &phat_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_TEST_ACPI) + +#endif diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index d223d934..e9ccdb0c 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -1512,6 +1512,46 @@ typedef struct { uint16_t spin_rev; } __attribute__ ((packed)) fwts_acpi_table_pptt_id; +/* + * ACPI PHAT (Platform Health Assessment Table), 5.2.30 + */ +typedef struct { + fwts_acpi_table_header header; +} __attribute__ ((packed)) fwts_acpi_table_phat; + +typedef enum { + FWTS_ACPI_PHAT_VERSION = 0, + FWTS_ACPI_PHAT_HEALTH = 1, + FWTS_ACPI_PHAT_END +} fwts_acpi_phat_type; + +typedef struct { + uint16_t type; + uint16_t length; + uint8_t revision; +} __attribute__ ((packed)) fwts_acpi_table_phat_header; + +/* 0: Firmware Version Data Record */ +typedef struct { + fwts_acpi_table_phat_header header; + uint8_t reserved[3]; + uint32_t element_count; +} __attribute__ ((packed)) fwts_acpi_table_phat_version; + +typedef struct { + uint8_t component_id[16]; + uint64_t version; + uint32_t producer_id; +} __attribute__ ((packed)) fwts_acpi_table_phat_version_elem; + +/* 1: Firmware Health Data Record */ +typedef struct { + fwts_acpi_table_phat_header header; + uint16_t reserved; + uint8_t healthy; + uint8_t data_signature[16]; + uint32_t data_offset; +} __attribute__ ((packed)) fwts_acpi_table_phat_health; /* * ACPI PCCT (Platform Communications Channel Table), 14.1 From patchwork Fri Apr 9 02:27:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Hung X-Patchwork-Id: 1464133 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=) 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 4FGhqy6yw0z9sSC for ; Fri, 9 Apr 2021 12:27:58 +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 1lUgsG-0002Z2-8u; Fri, 09 Apr 2021 02:27:56 +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 1lUgsD-0002Ya-H3 for fwts-devel@lists.ubuntu.com; Fri, 09 Apr 2021 02:27:53 +0000 Received: from [104.157.111.226] (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 1lUgsC-000276-W2; Fri, 09 Apr 2021 02:27:53 +0000 From: Alex Hung To: fwts-devel@lists.ubuntu.com Subject: [PATCH 3/3] fwts-test: sync up with phat test Date: Thu, 8 Apr 2021 20:27:40 -0600 Message-Id: <20210409022740.501168-3-alex.hung@canonical.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210409022740.501168-1-alex.hung@canonical.com> References: <20210409022740.501168-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: Colin Ian KIng --- Makefile.am | 3 ++ fwts-test/phat-0001/acpidump-0001.log | 42 ++++++++++++++++++ fwts-test/phat-0001/acpidump-0002.log | 41 ++++++++++++++++++ fwts-test/phat-0001/acpidump-0003.log | 41 ++++++++++++++++++ fwts-test/phat-0001/phat-0001.log | 62 +++++++++++++++++++++++++++ fwts-test/phat-0001/phat-0002.log | 45 +++++++++++++++++++ fwts-test/phat-0001/phat-0003.log | 59 +++++++++++++++++++++++++ fwts-test/phat-0001/test-0001.sh | 23 ++++++++++ fwts-test/phat-0001/test-0002.sh | 23 ++++++++++ fwts-test/phat-0001/test-0003.sh | 23 ++++++++++ 10 files changed, 362 insertions(+) create mode 100644 fwts-test/phat-0001/acpidump-0001.log create mode 100644 fwts-test/phat-0001/acpidump-0002.log create mode 100644 fwts-test/phat-0001/acpidump-0003.log create mode 100644 fwts-test/phat-0001/phat-0001.log create mode 100644 fwts-test/phat-0001/phat-0002.log create mode 100644 fwts-test/phat-0001/phat-0003.log create mode 100755 fwts-test/phat-0001/test-0001.sh create mode 100755 fwts-test/phat-0001/test-0002.sh create mode 100755 fwts-test/phat-0001/test-0003.sh diff --git a/Makefile.am b/Makefile.am index d4eee175..9e141292 100644 --- a/Makefile.am +++ b/Makefile.am @@ -158,6 +158,9 @@ TESTS = fwts-test/acpidump-0001/test-0001.sh \ fwts-test/pcct-0001/test-0002.sh \ fwts-test/pdtt-0001/test-0001.sh \ fwts-test/pdtt-0001/test-0002.sh \ + fwts-test/phat-0001/test-0001.sh \ + fwts-test/phat-0001/test-0002.sh \ + fwts-test/phat-0001/test-0003.sh \ fwts-test/pmtt-0001/test-0001.sh \ fwts-test/pmtt-0001/test-0002.sh \ fwts-test/pptt-0001/test-0001.sh \ diff --git a/fwts-test/phat-0001/acpidump-0001.log b/fwts-test/phat-0001/acpidump-0001.log new file mode 100644 index 00000000..1a4a1f4a --- /dev/null +++ b/fwts-test/phat-0001/acpidump-0001.log @@ -0,0 +1,42 @@ +FACS @ 0x00000000 + 0000: 46 41 43 53 40 00 00 00 00 00 00 00 00 00 00 00 FACS@........... + 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + +FACP @ 0x00000000 + 0000: 46 41 43 50 f4 00 00 00 03 f9 41 4d 44 20 20 20 FACP......AMD + 0010: 47 55 41 4d 20 20 20 20 00 00 04 06 41 4d 44 20 GUAM ....AMD + 0020: 40 42 0f 00 c0 2f e9 af 92 47 e8 af 00 02 09 00 @B.../...G...... + 0030: b0 00 00 00 f0 f1 00 00 00 80 00 00 00 00 00 00 ................ + 0040: 04 80 00 00 00 00 00 00 00 82 00 00 08 80 00 00 ................ + 0050: 20 80 00 00 00 00 00 00 04 02 01 04 08 00 00 00 ............... + 0060: 65 00 e9 03 00 00 00 00 01 00 0d 00 32 00 00 00 e...........2... + 0070: a5 c1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0080: 00 00 00 00 c0 2f e9 af 00 00 00 00 92 47 e8 af ...../.......G.. + 0090: 00 00 00 00 01 20 00 00 00 80 00 00 00 00 00 00 ..... .......... + 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 01 10 00 00 ................ + 00b0: 04 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 00c0: 00 00 00 00 01 08 00 00 00 82 00 00 00 00 00 00 ................ + 00d0: 01 20 00 00 08 80 00 00 00 00 00 00 01 40 00 00 . ...........@.. + 00e0: 20 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ............... + 00f0: 00 00 00 00 .... + +PHAT @ 0x0000000000000000 + 0000: 50 48 41 54 DA 00 00 00 01 20 49 4E 54 45 4C 20 PHAT..... INTEL + 0010: 54 65 6D 70 6C 61 74 65 01 00 00 00 49 4E 54 4C Template....INTL + 0020: 31 03 21 20 00 00 28 00 00 00 00 00 01 00 00 00 1.! ..(......... + 0030: 30 05 AF 91 86 5D 0E 47 A6 B0 0A 2D B9 40 82 49 0....].G...-.@.I + 0040: 08 07 06 05 04 03 02 01 0C 0B 0A 09 00 00 28 00 ..............(. + 0050: 00 00 00 00 01 00 00 00 3C 73 2E 1E 0D 79 44 46 ........ /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/phat-0001/acpidump-0001.log phat - | cut -c7- | grep "^phat" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/phat-0001/phat-0001.log >> $FAILURE_LOG +ret=$? +if [ $ret -eq 0 ]; then + echo PASSED: $TEST, $NAME +else + echo FAILED: $TEST, $NAME +fi + +rm $TMPLOG +exit $ret diff --git a/fwts-test/phat-0001/test-0002.sh b/fwts-test/phat-0001/test-0002.sh new file mode 100755 index 00000000..f3813565 --- /dev/null +++ b/fwts-test/phat-0001/test-0002.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test acpitables against invalid PHAT" +NAME=test-0001.sh +TMPLOG=$TMP/phat.log.$$ + +$FWTS --show-tests | grep phat > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/phat-0001/acpidump-0002.log phat - | cut -c7- | grep "^phat" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/phat-0001/phat-0002.log >> $FAILURE_LOG +ret=$? +if [ $ret -eq 0 ]; then + echo PASSED: $TEST, $NAME +else + echo FAILED: $TEST, $NAME +fi + +rm $TMPLOG +exit $ret diff --git a/fwts-test/phat-0001/test-0003.sh b/fwts-test/phat-0001/test-0003.sh new file mode 100755 index 00000000..86187ccc --- /dev/null +++ b/fwts-test/phat-0001/test-0003.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test acpitables against PHAT" +NAME=test-0003.sh +TMPLOG=$TMP/phat.log.$$ + +$FWTS --show-tests | grep phat > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/phat-0001/acpidump-0003.log phat - | cut -c7- | grep "^phat" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/phat-0001/phat-0003.log >> $FAILURE_LOG +ret=$? +if [ $ret -eq 0 ]; then + echo PASSED: $TEST, $NAME +else + echo FAILED: $TEST, $NAME +fi + +rm $TMPLOG +exit $ret