From patchwork Thu Sep 1 09:09:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ivanhu X-Patchwork-Id: 1672759 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=SdqJEYHM; 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 4MJFc23tTGz1yn9 for ; Thu, 1 Sep 2022 19:09:37 +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 1oTgCb-0000pZ-5n; Thu, 01 Sep 2022 09:09:33 +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 1oTgCZ-0000pC-Hf for fwts-devel@lists.ubuntu.com; Thu, 01 Sep 2022 09:09:31 +0000 Received: from canonical.com (unknown [175.182.177.2]) (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 90B484094A for ; Thu, 1 Sep 2022 09:09:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1662023371; bh=lg7B6s0R0x905kvOcILwwxb8/RfSBbqbYK86tilRf+c=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=SdqJEYHMhOXND7gMqSrdnZhBqg13wYcoyALQ7RoPqt1f9i+gEgnjvC0AF9Zs73VQ+ 3GEc0F4EOVmiYT26t35PH1F5UVmZQpBlTP/C+rnPlOyvKtSDLR/dwIvWFTyM0RGy7z v41nF01pf/T/m63UsnIAqRVzWqmCYJ8qWF90QNM+7gh7DNZvO7j92OGTSq/+VRh9HS TcsUmVuQhbsVqdIyvMGT2H3e3cITok2OlXsNhq3YiWLBYxCaElgnxvsrlyVk87VmUH K3b8nktTsTL0cERuQgbwNDSTtEl1+d07pJqQ+pmAQmN+11DxNtfupiGbWl/aL167WZ 25iagI1+8tbfw== From: Ivan Hu To: fwts-devel@lists.ubuntu.com Subject: [PATCH 2/2] acpi: nhltdump: add endpoint discriptor string description Date: Thu, 1 Sep 2022 17:09:14 +0800 Message-Id: <20220901090914.9309-2-ivan.hu@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220901090914.9309-1-ivan.hu@canonical.com> References: <20220901090914.9309-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 --- src/acpi/nhltdump/nhltdump.c | 106 ++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 3 deletions(-) diff --git a/src/acpi/nhltdump/nhltdump.c b/src/acpi/nhltdump/nhltdump.c index 0869acf9..90837154 100644 --- a/src/acpi/nhltdump/nhltdump.c +++ b/src/acpi/nhltdump/nhltdump.c @@ -42,6 +42,102 @@ static void nhltdump_data_hexdump(fwts_framework *fw, uint8_t *data, size_t size } } +static char *nhltdump_linktype_to_string(const uint8_t linktype) +{ + char *str; + + switch (linktype) { + case 0: + str = "HD-Audio"; + break; + case 1: + str = "DSP "; + break; + case 2: + str = "PDM"; + break; + case 3: + str = "SSP"; + break; + case 4: + str = "Slimbus"; + break; + case 5: + str = "SoundWire"; + break; + default: + str = "reserved"; + break; + } + + return str; +} + +static char *nhltdump_devtype_to_string(const uint8_t linktype, const uint8_t devtype) +{ + char *str; + + if (linktype == 2) { + switch (devtype) { + case 0: + str = "PDM on cAVS1.8 (CNL+) platforms only"; + break; + case 1: + str = "PDM on cAVS1.5 (KBL) based platforms"; + break; + default: + str = "reserved"; + break; + } + } else if (linktype == 3) { + switch (devtype) { + case 0: + str = "BT Sideband"; + break; + case 1: + str = "FM"; + break; + case 2: + str = "Modem"; + break; + case 4: + str = "SSP Analog Codec"; + break; + default: + str = "reserved"; + break; + } + } else + str = "TBD"; + + return str; +} + +static char *nhltdump_direction_to_string(const uint8_t direction) +{ + char *str; + + switch (direction) { + case 0: + str = "Render"; + break; + case 1: + str = "Capture"; + break; + case 2: + str = "Render with loopback / feedback"; + break; + case 3: + str = "Feedback for render (smartamp)"; + break; + default: + str = ""; + break; + } + + return str; +} + /* * NHLT Table * see https://01.org/sites/default/files/595976_intel_sst_nhlt.pdf @@ -58,6 +154,7 @@ static int nhltdump_test1(fwts_framework *fw) char guid_str[37]; uint32_t table_length = table->length; uint32_t offset = 0; + char *str_info; fwts_log_info_simp_int(fw, "TableLength: ", table_length); offset += sizeof(fwts_acpi_table_nhlt); @@ -76,14 +173,17 @@ static int nhltdump_test1(fwts_framework *fw) } fwts_log_info_verbatim(fw, " EndpointDescriptor %" PRIu8, (i + 1)); fwts_log_info_simp_int(fw, " EndpointDescriptorLength: ", ep_descriptor->ep_descriptor_len); - fwts_log_info_simp_int(fw, " LinkType: ", ep_descriptor->link_type); + str_info = nhltdump_linktype_to_string(ep_descriptor->link_type); + fwts_log_info_verbatim(fw, " LinkType: %" PRIu8 " (%s)", ep_descriptor->link_type, str_info); fwts_log_info_simp_int(fw, " Instance ID: ", ep_descriptor->instance_id); fwts_log_info_simp_int(fw, " Vendor ID: ", ep_descriptor->vendor_id); fwts_log_info_simp_int(fw, " Device ID: ", ep_descriptor->device_id); fwts_log_info_simp_int(fw, " Revision ID: ", ep_descriptor->revision_id); fwts_log_info_simp_int(fw, " Subsystem ID: ", ep_descriptor->subsystem_id); - fwts_log_info_simp_int(fw, " Device Type: ", ep_descriptor->device_type); - fwts_log_info_simp_int(fw, " Direction: ", ep_descriptor->direction); + str_info = nhltdump_devtype_to_string(ep_descriptor->link_type, ep_descriptor->device_type); + fwts_log_info_verbatim(fw, " Device Type: %" PRIu8 " (%s)", ep_descriptor->device_type, str_info); + str_info = nhltdump_direction_to_string(ep_descriptor->direction); + fwts_log_info_verbatim(fw, " Direction: %" PRIu8 " (%s)", ep_descriptor->direction, str_info); fwts_log_info_simp_int(fw, " Virtual Bus ID: ", ep_descriptor->virtual_bus_id); spec_config = (fwts_acpi_table_nhlt_specific_config *)((uint8_t *)ep_descriptor