From patchwork Tue Oct 11 08:26:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1688506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) 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: legolas.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=hix59MXz; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mmpmc17B5z23jn for ; Tue, 11 Oct 2022 19:27:10 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oiAbM-0007aB-Bu; Tue, 11 Oct 2022 08:27:00 +0000 Received: from smtp-relay-canonical-1.internal ([10.131.114.174] helo=smtp-relay-canonical-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1oiAbK-0007ZW-Bq for fwts-devel@lists.ubuntu.com; Tue, 11 Oct 2022 08:26:58 +0000 Received: from canonical.com (112-104-27-78.adsl.dynamic.seed.net.tw [112.104.27.78]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPSA id 36DED3FE1C for ; Tue, 11 Oct 2022 08:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1665476818; bh=2KTnhlq8UTL/V9AwhNNuN5S7nEr7JejTBG0CTEhEr7w=; h=From:To:Subject:Date:Message-Id:MIME-Version; b=hix59MXz4FDdh8eslgFEtHH7MBCIQ0dYeLYce5eYZV9hUPq9Abni6CFOhNP5NNAAe 35LY1OowmC/OcXneH+sJVaw6pm/wndlwzaWL/d1vp715GvhvZ0xov1QbgcTh6VIXUI Ka4fTWJf/N6lIKkWW30uk78QRl88zAo6ZtSd9Vv80s0j7rK5XFc9FWThC10JkDnGbB F3Bq3Ch8FVo35dBNwuLU2UHH5aGeT/FKQH4qMB5UEiEx7iLg7FljH7SIlq19eso89A Vt10HUgYomwNe7j9EZaS3X7CtuD0Uez4aZnfrH2qjvRt1C4uTVDNyU2cCQuZu6ZYLr m7JJnmaUv1mfA== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 1/2] acpi: cedt: add tests for ACPI CEDT table (mantis 2076) Date: Tue, 11 Oct 2022 16:26:52 +0800 Message-Id: <20221011082653.41440-1-ivan.hu@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" BugLink: https://bugs.launchpad.net/fwts/+bug/1992413 Signed-off-by: Ivan Hu --- src/Makefile.am | 1 + src/acpi/cedt/cedt.c | 245 ++++++++++++++++++++++++++++++++++++ src/lib/include/fwts_acpi.h | 61 +++++++++ 3 files changed, 307 insertions(+) create mode 100644 src/acpi/cedt/cedt.c diff --git a/src/Makefile.am b/src/Makefile.am index 3bb35e5c..128ddaa0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -68,6 +68,7 @@ fwts_SOURCES = main.c \ acpi/brightness/brightness-helper.c \ acpi/brightness/brightness.c \ acpi/brightness/autobrightness.c \ + acpi/cedt/cedt.c \ acpi/checksum/checksum.c \ acpi/cpep/cpep.c \ acpi/crsdump/crsdump.c \ diff --git a/src/acpi/cedt/cedt.c b/src/acpi/cedt/cedt.c new file mode 100644 index 00000000..847af25d --- /dev/null +++ b/src/acpi/cedt/cedt.c @@ -0,0 +1,245 @@ +/* + * Copyright (C) 2022 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. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +#include "fwts.h" + +#if defined(FWTS_HAS_ACPI) + +#include +#include +#include +#include +#include + +static fwts_acpi_table_info *table; +acpi_table_init(CEDT, &table) + +static void cedt_chbs_test( + fwts_framework *fw, + const fwts_acpi_table_cedt_chbs *entry, + bool *passed) +{ + fwts_log_info_verbatim(fw, " CXL Host Bridge Structure (CHBS):"); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Reserved: ", entry->header.reserved); + fwts_log_info_simp_int(fw, " Record Length: ", entry->header.record_length); + fwts_log_info_simp_int(fw, " UID: ", entry->uid); + fwts_log_info_simp_int(fw, " CXL Version: ", entry->cxl_version); + fwts_log_info_simp_int(fw, " Reserved: ", entry->reserved); + fwts_log_info_simp_int(fw, " Base: ", entry->base); + fwts_log_info_simp_int(fw, " Length: ", entry->length); + + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->header.reserved, passed); + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->reserved, passed); + + switch(entry->cxl_version) { + case 0: /* RCH */ + if (entry->length != 0x2000) { + *passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "CEDTBadCHBSLength", + "CEDT CHBS Length must be 0x2000, got " + "0x%" PRIx64 " instead", entry->length); + } + //fwts_acpi_fixed_value(fw, LOG_LEVEL_HIGH, "CEDT", "CHBS Length", entry->length, 0x2000, passed); + break; + case 1: /* Host Bridge */ + if (entry->length != 0x10000) { + *passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "CEDTBadCHBSLength", + "CEDT CHBS Length must be 0x10000, got " + "0x%" PRIx64 " instead", entry->length); + } + //fwts_acpi_fixed_value(fw, LOG_LEVEL_HIGH, "CEDT", "CHBS Length", entry->length, 0x10000, passed); + break; + default: + *passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "CEDTBadCXLVersion", + "CXL Version must have the value with 0 or 1, got " + "0x%" PRIx32 " instead", entry->cxl_version); + break; + } + +} + +static void cedt_cfmws_test( + fwts_framework *fw, + const fwts_acpi_table_cedt_cfmws *entry, + bool *passed) +{ + fwts_log_info_verbatim(fw, " CXL Fixed Memory Window Structure (CFMWS):"); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Reserved: ", entry->header.reserved); + fwts_log_info_simp_int(fw, " Record Length: ", entry->header.record_length); + fwts_log_info_simp_int(fw, " Reserved: ", entry->reserved1); + fwts_log_info_simp_int(fw, " Base HPA: ", entry->base_hpa); + fwts_log_info_simp_int(fw, " Window Size: ", entry->window_size); + fwts_log_info_simp_int(fw, " ENIW: ", entry->eniw); + fwts_log_info_simp_int(fw, " Interleave Arithmetic: ", entry->interleave_arithmetic); + fwts_log_info_simp_int(fw, " Reserved: ", entry->reserved2); + fwts_log_info_simp_int(fw, " HBIG: ", entry->hbig); + fwts_log_info_simp_int(fw, " Window Restrictions: ", entry->window_restrictions); + fwts_log_info_simp_int(fw, " QTG ID: ", entry->qtg_id); + fwts_log_info_verbatim(fw, " Interleave Target List"); /* TODO: dumping the raw data */ + + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->header.reserved, passed); + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->reserved1, passed); + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->reserved2, passed); + + if (entry->interleave_arithmetic > 1) { + *passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "CEDTBadInterleaveArithmetic", + "CEDT CFMWS interleave arithmetic must have the value with 0 or 1, got " + "0x%2.2" PRIx8 "instead", entry->interleave_arithmetic); + } + + fwts_acpi_reserved_bits("CEDT", "Window Restrictions", entry->window_restrictions, 5, 15, passed); + +} + +static void cedt_cxims_test( + fwts_framework *fw, + const fwts_acpi_table_cedt_cxims *entry, + bool *passed) +{ + int i; + + fwts_log_info_verbatim(fw, " CXL XOR Interleave Math Structure (CXIMS):"); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Reserved: ", entry->header.reserved); + fwts_log_info_simp_int(fw, " Record Length: ", entry->header.record_length); + fwts_log_info_simp_int(fw, " Reserved: ", entry->reserved); + fwts_log_info_simp_int(fw, " HBIG: ", entry->hbig); + fwts_log_info_simp_int(fw, " Number of Bitmap Entries(NIB): ", entry->nig); + for (i= 0; i < entry->nig; i++) + fwts_log_info_simp_int(fw, " XORMAP List ", entry->xormap_list[i]); + + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->header.reserved, passed); + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->reserved, passed); + +} + +static void cedt_rdpas_test( + fwts_framework *fw, + const fwts_acpi_table_cedt_rdpas *entry, + bool *passed) +{ + fwts_log_info_verbatim(fw, " RCEC Downstream Port Association Structure (RDPAS):"); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Reserved: ", entry->header.reserved); + fwts_log_info_simp_int(fw, " Record Length: ", entry->header.record_length); + fwts_log_info_simp_int(fw, " RCEC Segment Number ", entry->rece_seg_num); + fwts_log_info_simp_int(fw, " RCEC BDF: ", entry->rece_bdf); + fwts_log_info_simp_int(fw, " Protocol Type: ", entry->protocol_type); + fwts_log_info_simp_int(fw, " Base Address ", entry->base_addr); + + fwts_acpi_reserved_zero("CEDT", "Reserved", entry->header.reserved, passed); + + if (entry->protocol_type > 1) { + *passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "CEDTBadProtocolType", + "CEDT CFMWS protocol type must have the value with 0 or 1, got " + "0x%2.2" PRIx8 " instead", entry->protocol_type); + } + +} + +static void cedt_structure( + fwts_framework *fw, + fwts_acpi_table_cedt_header *entry, + bool *passed) +{ + switch(entry->type) { + case FWTS_CEDT_TYPE_CHBS: + cedt_chbs_test(fw, (fwts_acpi_table_cedt_chbs *)entry, passed); + break; + case FWTS_CEDT_TYPE_CFMWS: + cedt_cfmws_test(fw, (fwts_acpi_table_cedt_cfmws *)entry, passed); + break; + case FWTS_CEDT_TYPE_CXIMS: + cedt_cxims_test(fw, (fwts_acpi_table_cedt_cxims *)entry, passed); + break; + case FWTS_CEDT_TYPE_RDPAS: + cedt_rdpas_test(fw, (fwts_acpi_table_cedt_rdpas *)entry, passed); + break; + default: + *passed = false; + fwts_failed(fw, LOG_LEVEL_HIGH, + "CEDTBadSubtableType", + "CEDT must have subtable with Type 0 to 3, got " + "0x%4.4" PRIx16 " instead", entry->type); + break; + } +} + +static int cedt_test1(fwts_framework *fw) +{ + fwts_acpi_table_cedt_header *entry; + bool passed = true; + uint32_t offset; + + if (!fwts_acpi_table_length(fw, "CEDT", table->length, sizeof(fwts_acpi_table_cedt))) + return FWTS_OK; + + fwts_log_info_verbatim(fw, "CEDT CXL Early Discovery Table:"); + + entry = (fwts_acpi_table_cedt_header *) (table->data + sizeof(fwts_acpi_table_cedt)); + offset = sizeof(fwts_acpi_table_cedt); + while (offset < table->length) { + + if (fwts_acpi_structure_length_zero(fw, "CEDT", entry->record_length, offset)) { + passed = false; + break; + } + + cedt_structure(fw, entry, &passed); + + offset += entry->record_length; + if (fwts_acpi_structure_range(fw, "CEDT", table->length, offset)) { + passed = false; + break; + } + + entry = (fwts_acpi_table_cedt_header *) (table->data + offset); + fwts_log_nl(fw); + } + + if (passed) + fwts_passed(fw, "No issues found in CEDT table."); + + return FWTS_OK; +} + +static fwts_framework_minor_test cedt_tests[] = { + { cedt_test1, "Validate CEDT table." }, + { NULL, NULL } +}; + +static fwts_framework_ops cedt_ops = { + .description = "CEDT CXL Early Discovery Table test", + .init = CEDT_init, + .minor_tests = cedt_tests +}; + +FWTS_REGISTER("cedt", &cedt_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ACPI) + +#endif diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index a599710d..c367a936 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -2286,4 +2286,65 @@ typedef struct { fwts_acpi_table_svkl_key_structure key_struct[0]; } __attribute__ ((packed)) fwts_acpi_table_svkl; +/* + * ACPI CEDT (CXL Early Discovery Table) + * https://www.computeexpresslink.org/download-the-specification + */ +typedef struct { + fwts_acpi_table_header header; +} __attribute__ ((packed)) fwts_acpi_table_cedt; + +typedef enum { + FWTS_CEDT_TYPE_CHBS = 0, + FWTS_CEDT_TYPE_CFMWS = 1, + FWTS_CEDT_TYPE_CXIMS = 2, + FWTS_CEDT_TYPE_RDPAS = 3, + FWTS_CEDT_TYPE_RESERVED = 4, +} fwts_acpi_cedt_type; + +typedef struct { + uint8_t type; + uint8_t reserved; + uint16_t record_length; +} __attribute__ ((packed)) fwts_acpi_table_cedt_header; + +typedef struct { + fwts_acpi_table_cedt_header header; + uint32_t uid; + uint32_t cxl_version; + uint32_t reserved; + uint64_t base; + uint64_t length; +} __attribute__ ((packed)) fwts_acpi_table_cedt_chbs; + +typedef struct { + fwts_acpi_table_cedt_header header; + uint32_t reserved1; + uint64_t base_hpa; + uint64_t window_size; + uint8_t eniw; + uint8_t interleave_arithmetic; + uint16_t reserved2; + uint32_t hbig; + uint16_t window_restrictions; + uint16_t qtg_id; + uint32_t interleave_target_list[0]; +} __attribute__ ((packed)) fwts_acpi_table_cedt_cfmws; + +typedef struct { + fwts_acpi_table_cedt_header header; + uint16_t reserved; + uint8_t hbig; + uint8_t nig; + uint64_t xormap_list[0]; +} __attribute__ ((packed)) fwts_acpi_table_cedt_cxims; + +typedef struct { + fwts_acpi_table_cedt_header header; + uint16_t rece_seg_num; + uint16_t rece_bdf; + uint8_t protocol_type; + uint64_t base_addr; +} __attribute__ ((packed)) fwts_acpi_table_cedt_rdpas; + #endif From patchwork Tue Oct 11 08:26:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Hu X-Patchwork-Id: 1688507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) 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: legolas.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=aiYo7WdI; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Mmpmc2r0Kz23jw for ; Tue, 11 Oct 2022 19:27:12 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1oiAbR-0007fS-GU; Tue, 11 Oct 2022 08:27:05 +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 1oiAbO-0007bh-Rx for fwts-devel@lists.ubuntu.com; Tue, 11 Oct 2022 08:27:02 +0000 Received: from canonical.com (112-104-27-78.adsl.dynamic.seed.net.tw [112.104.27.78]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 9BF9E3FD72 for ; Tue, 11 Oct 2022 08:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1665476822; bh=MGhssi7FCxAcfTw5acum7Iisv4iv2NJd/pmqenZTwQA=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=aiYo7WdIMrDZ1FDghmtVsUpFZIlGCWPvvCea2g8U6X3cFRdb9LYq8nEfjb1FVvNfk hbc6f8knbAhdwD56aO2jxrYMLfH4oVNtDwjIhFsFSNLHJkz1Q2diBSpj7qnTzHi8g5 nUAKq5s4udC7dNqaLNSDZcbiBnRdwsUjEo+X4bzqVPfCR2qLXFq6X0UNd88kunUpHV mvuSc9fxGoF9FcxYcHH50Ohd8QdfK2G5aEmkdJ+Ei1LadKTm3kE0mqWvbMpMsU7e2N MSq2z2wi44prZZ3D9rEcmFm4kjAvbV97T6ew4fXDZCoGlfsQg2A4skcUK+qLBiv6Ur aupWs8JlxLpJw== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] fwts-test: add regression tests for CEDT Date: Tue, 11 Oct 2022 16:26:53 +0800 Message-Id: <20221011082653.41440-2-ivan.hu@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221011082653.41440-1-ivan.hu@canonical.com> References: <20221011082653.41440-1-ivan.hu@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: Ivan Hu --- Makefile.am | 2 + fwts-test/cedt-0001/acpidump-0001.log | 36 +++++++++++ fwts-test/cedt-0001/acpidump-0002.log | 40 ++++++++++++ fwts-test/cedt-0001/cedt-0001.log | 54 ++++++++++++++++ fwts-test/cedt-0001/cedt-0002.log | 92 +++++++++++++++++++++++++++ fwts-test/cedt-0001/test-0001.sh | 23 +++++++ fwts-test/cedt-0001/test-0002.sh | 23 +++++++ 7 files changed, 270 insertions(+) create mode 100644 fwts-test/cedt-0001/acpidump-0001.log create mode 100644 fwts-test/cedt-0001/acpidump-0002.log create mode 100644 fwts-test/cedt-0001/cedt-0001.log create mode 100644 fwts-test/cedt-0001/cedt-0002.log create mode 100755 fwts-test/cedt-0001/test-0001.sh create mode 100755 fwts-test/cedt-0001/test-0002.sh diff --git a/Makefile.am b/Makefile.am index 7f121ed5..06cd282c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,6 +96,8 @@ TESTS = fwts-test/acpidump-0001/test-0001.sh \ fwts-test/bgrt-0001/test-0002.sh \ fwts-test/boot-0001/test-0001.sh \ fwts-test/boot-0001/test-0002.sh \ + fwts-test/cedt-0001/test-0001.sh \ + fwts-test/cedt-0001/test-0002.sh \ fwts-test/checksum-0001/test-0001.sh \ fwts-test/checksum-0001/test-0003.sh \ fwts-test/checksum-0001/test-0004.sh \ diff --git a/fwts-test/cedt-0001/acpidump-0001.log b/fwts-test/cedt-0001/acpidump-0001.log new file mode 100644 index 00000000..a09ee9e0 --- /dev/null +++ b/fwts-test/cedt-0001/acpidump-0001.log @@ -0,0 +1,36 @@ +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 .... + +CEDT @ 0x0000000000000000 + 0000: 43 45 44 54 94 00 00 00 01 87 49 4e 54 45 4c 20 CEDT......INTEL + 0010: 54 45 4d 50 4c 41 54 45 00 00 00 00 49 4e 54 4c TEMPLATE....INTL + 0020: 17 12 21 20 00 00 20 00 00 5e ba 00 00 00 00 00 ..! .. ..^...... + 0030: 00 00 00 00 00 10 00 00 00 00 00 00 00 20 00 00 ............. .. + 0040: 00 00 00 00 01 00 28 00 00 00 00 00 00 00 00 00 ......(......... + 0050: 00 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 ................ + 0060: 03 00 00 00 06 00 01 00 00 5e ba 00 02 00 18 00 .....^...^...... + 0070: 00 00 03 02 01 02 03 04 05 06 07 08 01 02 03 04 ................ + 0080: 05 06 07 08 03 00 10 00 01 09 00 00 00 00 00 00 ................ + 0090: 01 00 00 00 .... diff --git a/fwts-test/cedt-0001/acpidump-0002.log b/fwts-test/cedt-0001/acpidump-0002.log new file mode 100644 index 00000000..61519efe --- /dev/null +++ b/fwts-test/cedt-0001/acpidump-0002.log @@ -0,0 +1,40 @@ +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 .... + +CEDT @ 0x0000000000000000 + 0000: 43 45 44 54 d4 00 00 00 01 87 49 4e 54 45 4c 20 CEDT......INTEL + 0010: 54 45 4d 50 4c 41 54 45 00 00 00 00 49 4e 54 4c TEMPLATE....INTL + 0020: 17 12 21 20 00 00 20 00 00 5e ba 00 00 00 00 00 ..! .. ..^...... + 0030: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 ............. .. + 0040: 00 00 00 00 00 00 20 00 00 5e ba 00 01 00 00 00 ..! .. ..^...... + 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 ............. .. + 0060: 00 00 00 00 00 00 20 00 00 5e ba 00 02 00 00 00 ..! .. ..^...... + 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 20 00 00 ............. .. + 0080: 00 00 00 00 01 00 28 00 01 00 00 00 00 00 00 00 ......(......... + 0090: 00 01 00 00 00 00 00 00 00 01 00 00 00 00 02 00 ................ + 00a0: 03 00 00 00 06 01 01 00 00 5e ba 00 02 00 18 00 .....^...^...... + 00b0: 01 00 03 02 01 02 03 04 05 06 07 08 01 02 03 04 ................ + 00c0: 05 06 07 08 03 00 10 00 00 00 09 01 02 00 00 00 ................ + 00d0: 01 00 00 00 .... diff --git a/fwts-test/cedt-0001/cedt-0001.log b/fwts-test/cedt-0001/cedt-0001.log new file mode 100644 index 00000000..3aa609a7 --- /dev/null +++ b/fwts-test/cedt-0001/cedt-0001.log @@ -0,0 +1,54 @@ +cedt cedt: CEDT CXL Early Discovery Table test +cedt ---------------------------------------------------------- +cedt Test 1 of 1: Validate CEDT table. +cedt CEDT CXL Early Discovery Table: +cedt CXL Host Bridge Structure (CHBS): +cedt Type: 0x00 +cedt Reserved: 0x00 +cedt Record Length: 0x0020 +cedt UID: 0x00ba5e00 +cedt CXL Version: 0x00000000 +cedt Reserved: 0x00000000 +cedt Base: 0x0000000000001000 +cedt Length: 0x0000000000002000 +cedt +cedt CXL Fixed Memory Window Structure (CFMWS): +cedt Type: 0x01 +cedt Reserved: 0x00 +cedt Record Length: 0x0028 +cedt Reserved: 0x00000000 +cedt Base HPA: 0x0000010000000000 +cedt Window Size: 0x0000010000000000 +cedt ENIW: 0x00 +cedt Interleave Arithmetic: 0x00 +cedt Reserved: 0x0000 +cedt HBIG: 0x00000003 +cedt Window Restrictions: 0x0006 +cedt QTG ID: 0x0001 +cedt Interleave Target List +cedt +cedt CXL XOR Interleave Math Structure (CXIMS): +cedt Type: 0x02 +cedt Reserved: 0x00 +cedt Record Length: 0x0018 +cedt Reserved: 0x0000 +cedt HBIG: 0x03 +cedt Number of Bitmap Entries(NIB): 0x02 +cedt XORMAP List 0x0807060504030201 +cedt XORMAP List 0x0807060504030201 +cedt +cedt RCEC Downstream Port Association Structure (RDPAS): +cedt Type: 0x03 +cedt Reserved: 0x00 +cedt Record Length: 0x0010 +cedt RCEC Segment Number 0x0901 +cedt RCEC BDF: 0x0000 +cedt Protocol Type: 0x00 +cedt Base Address 0x0000000001000000 +cedt +cedt PASSED: Test 1, No issues found in CEDT table. +cedt +cedt ========================================================== +cedt 1 passed, 0 failed, 0 warning, 0 aborted, 0 skipped, 0 +cedt info only. +cedt ========================================================== diff --git a/fwts-test/cedt-0001/cedt-0002.log b/fwts-test/cedt-0001/cedt-0002.log new file mode 100644 index 00000000..4706f058 --- /dev/null +++ b/fwts-test/cedt-0001/cedt-0002.log @@ -0,0 +1,92 @@ +cedt cedt: CEDT CXL Early Discovery Table test +cedt ---------------------------------------------------------- +cedt Test 1 of 1: Validate CEDT table. +cedt CEDT CXL Early Discovery Table: +cedt CXL Host Bridge Structure (CHBS): +cedt Type: 0x00 +cedt Reserved: 0x00 +cedt Record Length: 0x0020 +cedt UID: 0x00ba5e00 +cedt CXL Version: 0x00000000 +cedt Reserved: 0x00000001 +cedt Base: 0x0000000000000000 +cedt Length: 0x0000000000010000 +cedt FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved +cedt field must be zero, got 0x00000001 instead +cedt FAILED [HIGH] CEDTBadCHBSLength: Test 1, CEDT CHBS Length +cedt must be 0x2000, got 0x10000 instead +cedt +cedt CXL Host Bridge Structure (CHBS): +cedt Type: 0x00 +cedt Reserved: 0x00 +cedt Record Length: 0x0020 +cedt UID: 0x00ba5e00 +cedt CXL Version: 0x00000001 +cedt Reserved: 0x00000000 +cedt Base: 0x0000000000000000 +cedt Length: 0x0000000000002000 +cedt FAILED [HIGH] CEDTBadCHBSLength: Test 1, CEDT CHBS Length +cedt must be 0x10000, got 0x2000 instead +cedt +cedt CXL Host Bridge Structure (CHBS): +cedt Type: 0x00 +cedt Reserved: 0x00 +cedt Record Length: 0x0020 +cedt UID: 0x00ba5e00 +cedt CXL Version: 0x00000002 +cedt Reserved: 0x00000000 +cedt Base: 0x0000000000000000 +cedt Length: 0x0000000000002000 +cedt FAILED [HIGH] CEDTBadCXLVersion: Test 1, CXL Version must +cedt have the value with 0 or 1, got 0x2 instead +cedt +cedt CXL Fixed Memory Window Structure (CFMWS): +cedt Type: 0x01 +cedt Reserved: 0x00 +cedt Record Length: 0x0028 +cedt Reserved: 0x00000001 +cedt Base HPA: 0x0000010000000000 +cedt Window Size: 0x0000010000000000 +cedt ENIW: 0x00 +cedt Interleave Arithmetic: 0x00 +cedt Reserved: 0x0002 +cedt HBIG: 0x00000003 +cedt Window Restrictions: 0x0106 +cedt QTG ID: 0x0001 +cedt Interleave Target List +cedt FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved +cedt field must be zero, got 0x00000001 instead +cedt FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved +cedt field must be zero, got 0x0002 instead +cedt FAILED [HIGH] CEDTReservedBitsNonZero: Test 1, CEDT Window +cedt Restrictions Bits [15..5] must be zero, got 0x0106 instead +cedt +cedt CXL XOR Interleave Math Structure (CXIMS): +cedt Type: 0x02 +cedt Reserved: 0x00 +cedt Record Length: 0x0018 +cedt Reserved: 0x0001 +cedt HBIG: 0x03 +cedt Number of Bitmap Entries(NIB): 0x02 +cedt XORMAP List 0x0807060504030201 +cedt XORMAP List 0x0807060504030201 +cedt FAILED [MEDIUM] CEDTReservedNonZero: Test 1, CEDT Reserved +cedt field must be zero, got 0x0001 instead +cedt +cedt RCEC Downstream Port Association Structure (RDPAS): +cedt Type: 0x03 +cedt Reserved: 0x00 +cedt Record Length: 0x0010 +cedt RCEC Segment Number 0x0000 +cedt RCEC BDF: 0x0109 +cedt Protocol Type: 0x02 +cedt Base Address 0x0000000001000000 +cedt FAILED [HIGH] CEDTBadProtocolType: Test 1, CEDT CFMWS +cedt protocol type must have the value with 0 or 1, got 0x02 +cedt instead +cedt +cedt +cedt ========================================================== +cedt 0 passed, 9 failed, 0 warning, 0 aborted, 0 skipped, 0 +cedt info only. +cedt ========================================================== diff --git a/fwts-test/cedt-0001/test-0001.sh b/fwts-test/cedt-0001/test-0001.sh new file mode 100755 index 00000000..393ac88b --- /dev/null +++ b/fwts-test/cedt-0001/test-0001.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test acpitables against CEDT" +NAME=test-0001.sh +TMPLOG=$TMP/cedt.log.$$ + +$FWTS --show-tests | grep cedt > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/cedt-0001/acpidump-0001.log cedt - | cut -c7- | grep "^cedt" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/cedt-0001/cedt-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/cedt-0001/test-0002.sh b/fwts-test/cedt-0001/test-0002.sh new file mode 100755 index 00000000..1bf7c7c6 --- /dev/null +++ b/fwts-test/cedt-0001/test-0002.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# +TEST="Test acpitables against CEDT" +NAME=test-0001.sh +TMPLOG=$TMP/cedt.log.$$ + +$FWTS --show-tests | grep cedt > /dev/null +if [ $? -eq 1 ]; then + echo SKIP: $TEST, $NAME + exit 77 +fi + +$FWTS --log-format="%line %owner " -w 80 --dumpfile=$FWTSTESTDIR/cedt-0001/acpidump-0002.log cedt - | cut -c7- | grep "^cedt" > $TMPLOG +diff $TMPLOG $FWTSTESTDIR/cedt-0001/cedt-0002.log >> $FAILURE_LOG +ret=$? +if [ $ret -eq 0 ]; then + echo PASSED: $TEST, $NAME +else + echo FAILED: $TEST, $NAME +fi + +rm $TMPLOG +exit $ret