From patchwork Tue Jan 26 22:10:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "An, Tedd" X-Patchwork-Id: 371681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1053BC433E0 for ; Wed, 27 Jan 2021 10:34:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8205820731 for ; Wed, 27 Jan 2021 10:34:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S314150AbhAZW7r (ORCPT ); Tue, 26 Jan 2021 17:59:47 -0500 Received: from mga06.intel.com ([134.134.136.31]:28032 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728245AbhAZWLC (ORCPT ); Tue, 26 Jan 2021 17:11:02 -0500 IronPort-SDR: dC5/hGj5HsfWdaPqczG7lKy9v0DQWYMyVTTqxGZUnZBg5MzxOc8IWaGe2950GBME4vWPpTOdI2 8XGvCteBPynw== X-IronPort-AV: E=McAfee;i="6000,8403,9876"; a="241509398" X-IronPort-AV: E=Sophos;i="5.79,377,1602572400"; d="scan'208";a="241509398" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2021 14:10:13 -0800 IronPort-SDR: 9g2sPZqZFimITIFKh/9K/ndSCx1Wq8sy4I510ruWGfuzqCgV0eJkqx8A4qlvm+wQLcGk7ew9h7 oliPNCofn/JA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,377,1602572400"; d="scan'208";a="429860711" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga001.jf.intel.com with ESMTP; 26 Jan 2021 14:10:12 -0800 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 26 Jan 2021 14:10:12 -0800 Received: from orsmsx602.amr.corp.intel.com (10.22.229.15) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Tue, 26 Jan 2021 14:10:12 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 26 Jan 2021 14:10:12 -0800 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (104.47.57.170) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.1713.5; Tue, 26 Jan 2021 14:10:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RTAKHvHInimIaCqglpjb6VYvtxQUo83WCeiNedbnp5m3EnXMyEuMd722jR8vB2+sjNojywZuTM3qGjnmfyRpUX04vb7HvzXuM8xZMyPMZSYDKqQhJ3XjaxmCcMRbLFIi7oTEpmRduN3lr8VFFTVevVxo4IzwetFv0ZL5eTYaQfqRSG4NHgtS/8dH8arP/LTLMvaYTLTQx0mRyUDzs/3YJEFmwyEm3I3hBHjzi1DY3fmX9qHKuqFJAEFZhzkMyxqAYFztvzKEyadz1B7LhIxHfJ0f7jLg+QRISxOMhKOhQWAEhu69G5IQorRRsFOLW0AldQu7YK5gkkX3zoScXgdcyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vHMjNjMc/CiLUWls32VTsnS7hQOu/jI4dRb3Y3kZ5Uc=; b=kcmI7fx/wPVm0pZRq/KU3JJUrOg54krDVgAVdjBQf7Pdwc1tWXHu5QZeiEIF5l5JbKUC6cv1hiPtHWpUH/133sPOlDf13VN/DvXfT4rxuzULiqpUyp6wHtsGmJo3NUW0vZsVkopXOx7zMuMX8jyLbvK/TQaevnzPgkivAnIU86fh3L8BAJeeN3OcYpCjbsa9p3i8AT8k1i3xw9HKrLUyliXyEBXdA0ZtHs/vuB4urOrcniSQjgnrebMcPCooA7keW1V5g8QkTPGGbBmgU8Qj2FNNJnvb/cEdpGPLVo//FdsCt5jFeVT1wZ7SKjM1wfv3U1Q4KGu3Q44Hxp+XKjPKrw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vHMjNjMc/CiLUWls32VTsnS7hQOu/jI4dRb3Y3kZ5Uc=; b=rxijwcz9T6KK5WJ6RdjJTTPrlCv8QtERsEt68CUd39VPw718zkchptk7/0F9CEyEMQFo7F0T72kZO2TEpo8eJIFL6tNdPvvb76rYR6wmSYNU38OtWu+7Dq0seKhmYmoySEE9WfylhYuEHJ8GopQN0MXco+dNDtdDZHtkMtTBfMI= Received: from MW3PR11MB4748.namprd11.prod.outlook.com (2603:10b6:303:2e::9) by CO1PR11MB5121.namprd11.prod.outlook.com (2603:10b6:303:94::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.13; Tue, 26 Jan 2021 22:10:11 +0000 Received: from MW3PR11MB4748.namprd11.prod.outlook.com ([fe80::9d55:273b:c716:25f9]) by MW3PR11MB4748.namprd11.prod.outlook.com ([fe80::9d55:273b:c716:25f9%6]) with mapi id 15.20.3784.019; Tue, 26 Jan 2021 22:10:11 +0000 From: "An, Tedd" To: "linux-bluetooth@vger.kernel.org" Subject: [PATCH] tools/bluemoon: Display FW version of firmware file Thread-Topic: [PATCH] tools/bluemoon: Display FW version of firmware file Thread-Index: AQHW9DADuycBAge1VE63yZ+r/+It8A== Date: Tue, 26 Jan 2021 22:10:11 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Evolution 3.36.5 (3.36.5-1.fc32) authentication-results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=intel.com; x-originating-ip: [2601:1c0:6a01:30d0:a96a:4337:f1:68f0] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cf576f4e-1027-4a92-31ab-08d8c247262b x-ms-traffictypediagnostic: CO1PR11MB5121: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3826; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 2xt/6hCcNt/68pT9n3E0fQZrIQaxHVdxpfUMGSIqzJ+9WNSVxCCLlCID9JrZ+yFogea7pSI6/T2+NrhNXYhqprXRBUPJwvVOQwbaC3Qi1W17k93aqGFHw4wnrgsEMu0da6dFdgMlvrsQdMcAwIzfRKAJyDq8eAJOkKbBAmbQo2ox3k9LkWwNHbhZV7evfKzjMQYQBJIi1FO78qjY1np+7OOsqjgI9gzwieuQ6XPE49dyjycDllPHQTXx6FgZDLoxrc0m2RqovCQpOYTnB/BBNVwO0zXidqj0b2xsVUUsOnSYv0g0W8ON5Ac+m9UA3t8v/B0tQTtwppHCDMzus5flu8yrw3NOOwIbk0kQ4oZJtYh6wc0/2tlld188rZnOd8lNWxUZf6hUEUFiC54jTXGis/CaQ6rmaIMi/M83d47El9uv1uc2/69AqlXXVs/acOwEE82AUNrqWCoFMQUdV1fZoWJ30qRaRvzdzKpZ1S/NRGa/SqPRQYoSlIC9lhEK0RqEDVWehDMKuk6Ek6s0GkG4BQ== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW3PR11MB4748.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(39860400002)(376002)(346002)(396003)(366004)(136003)(6916009)(86362001)(66556008)(83380400001)(5660300002)(71200400001)(66476007)(2906002)(2616005)(478600001)(66946007)(6486002)(186003)(64756008)(76116006)(6506007)(316002)(66446008)(6512007)(8676002)(8936002)(36756003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?utf-8?q?wQ1+6enSzKatKbLR41Cm+3Dp4Jq?= =?utf-8?q?QfEIlrjQEHMyPDSY/Uv+0uKKE/crG2zvTjY4tfeaECuffnboaD3IaaUB?= =?utf-8?q?QHlb8VHD5QdTMRu3Z7zmwsMQ4D1EmTi0pyqOkFWDWUFBZQT3a/Q1BAZT?= =?utf-8?q?N7oCxWjallHz7kA8rdwaazwE+e0O4blnIc83FJrLlxHXpCi21ISPxKCm?= =?utf-8?q?JMTkh9Zc9drPEnYfwbg/6Ie93FR1yslUl19Qw/y68Kr7y8S4W8WpsFYN?= =?utf-8?q?8b2sYAu+CPgVkyI67Josmcy2Wp21BxjaNuoTcdAfi8WT6ftQiMikmaBR?= =?utf-8?q?Opl5tBEzZGNEZUzQyxYF07MmKlDV49217VDWgK4DLIXD6+HXtc1+1RjK?= =?utf-8?q?3Se0ogKMneKgxQAiUfr47iqd8SWrnjx00fkzkFt1zorZSU5qz72MJNL0?= =?utf-8?q?gmzIW9sgHkkU3fPnystGfJzVWd2sdRjLQNqRIHsluh2OmVNAAzLIwXRH?= =?utf-8?q?JA9dQTiBWarv0BD2KGAVFGg02JfVsKv+f+PHl8z6hhYjmTS9vqqX6nxm?= =?utf-8?q?FV0QdSp1D8yQ6PLIAb+ve0LNjy4xdCwpzLlDA07WvFnnWsEXc/kT0BaC?= =?utf-8?q?ddyd6CHWMHnUTm20RyjiixGSWSvcwdzNpGqGzk51z9XixTaEikpSHzYs?= =?utf-8?q?J6pTAgZP0+nrs/7OnK6GEFbOBbW0DDInN0T9FUZlOjjN64eQ92mjDVhQ?= =?utf-8?q?9jlml9cGpVtfVOUD5Zzfgwis2Z/A6Gh6XZcdYswmPW5pInM/M05nN8iN?= =?utf-8?q?PPLrePwOPfzKB+GjzQ3bjfDY5wuE2trofArQzU0yeDZ1oTsmohLM8PdM?= =?utf-8?q?FExPQ+oRvldzZwMgkO9zHGSl7L6h3hJdywht1cFyZKgQRT4WCOLeygv2?= =?utf-8?q?xq9Huhp9B3aRCAbbGOeENjGuOJU4Z3nqw3AIzmdPhdE/K21qQVVRvdnM?= =?utf-8?q?UahxBSxM3FFOXMqwTwcGfagGw+YLlZU+Rqoc8ykAidYbCC996wRvEj+M?= =?utf-8?q?lVhoHnsoxEqMEougiWWOLgDYQaHYn0+jDPgemBPD2Qr7jbCRneb1owCO?= =?utf-8?q?8Yfq3BiVRdGQ6xIAxCwEb3PO5XMXo+Tft0bBeYpOvkgR26QL8tpiwcL4?= =?utf-8?q?oMunQz9faudBjvcMlxxp/B/fMVJoipwdzp0h7hGEkVVAKNiqVFVmMkVY?= =?utf-8?q?IQ/MU?= x-ms-exchange-transport-forked: True Content-ID: <85ECD1AE3B5E964C9AD6A23DBB39F2B0@namprd11.prod.outlook.com> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4748.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cf576f4e-1027-4a92-31ab-08d8c247262b X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jan 2021 22:10:11.0691 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: UadTr1H6NigPJxAQci8RfTaw0PvqWap6uoyxaRDh2PmyZpEEooNF6gH3geqAVc1E3kApvuiHfPtvAcZ7FpVfuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR11MB5121 X-OriginatorOrg: intel.com Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Tedd Ho-Jeong An This patch displays a FW version after parsing the WRITE_BOOT_PARAMS command in the firmeare file. It also change the display type for Module vendor and Date in the CSS header to hex for easy read. --- tools/bluemoon.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) -- 2.26.2 diff --git a/tools/bluemoon.c b/tools/bluemoon.c index 8b62b1e7b..912f4f2a9 100644 --- a/tools/bluemoon.c +++ b/tools/bluemoon.c @@ -805,8 +805,10 @@ static void analyze_firmware(const char *path) le32_to_cpu(css->header_version) >> 16, le32_to_cpu(css->header_version) & 0xffff); printf("Module ID:\t%u\n", le32_to_cpu(css->module_id)); - printf("Module vendor:\t%u\n", le32_to_cpu(css->module_vendor)); - printf("Date:\t\t%u\n", le32_to_cpu(css->date)); + printf("Module vendor:\t0x%x\n", le32_to_cpu(css->module_vendor)); + printf("Date:\t\t%04x-%02x-%02x\n", le32_to_cpu(css->date) >> 16, + le32_to_cpu(css->date) >> 8 & 0xff, + le32_to_cpu(css->date) & 0xff); printf("Size:\t\t%u DWORDs / %u bytes\n", le32_to_cpu(css->size), le32_to_cpu(css->size) * 4); printf("Key size:\t%u DWORDs / %u bytes\n", @@ -840,13 +842,29 @@ static void analyze_firmware(const char *path) while (firmware_offset < firmware_size) { uint16_t opcode; uint8_t dlen; + struct cmd_write_boot_params *params; opcode = get_le16(firmware_data + firmware_offset); dlen = firmware_data[firmware_offset + 2]; switch (opcode) { - case CMD_NO_OPERATION: case CMD_WRITE_BOOT_PARAMS: + params = (void *)&firmware_data[firmware_offset + 3]; + printf("Boot Parameters\n"); + printf("Boot Address:\t0x%08x\n", + le32_to_cpu(params->boot_addr)); + printf("FW Version(yy):\t%d (0x%02X)\n", + params->fw_build_yy + 2000, + params->fw_build_yy); + printf("FW Version(cw):\t%d (0x%02X)\n", + params->fw_build_cw, + params->fw_build_cw); + printf("FW Version(nn):\t%d (0x%02X)\n", + params->fw_build_nn, + params->fw_build_nn); + + printf("\n"); + case CMD_NO_OPERATION: case CMD_MEMORY_WRITE: break; default: