Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp188737lql; Sun, 10 Mar 2024 21:38:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVOz1qTkxHAVOvhIEtnFcOI4vzUIUlN0Op3MhleziOITRXxIWr5J5vWv74CZyMKEFWVN9d8PQbPpdbe8zm/acmWuqrbaXkc9pLALbiQJA== X-Google-Smtp-Source: AGHT+IHiOA3TfGQDOlULG9lm1WSj/26QOwiq0MQLaPe+1IJoyZml2FwjjFKZzONSp/Oq7HXDPf+T X-Received: by 2002:a05:6358:b244:b0:17e:7c52:288c with SMTP id lo4-20020a056358b24400b0017e7c52288cmr845460rwc.3.1710131926081; Sun, 10 Mar 2024 21:38:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710131926; cv=pass; d=google.com; s=arc-20160816; b=Q3D5KWbEYZ0m074W3idVV1G4HXsjU1sJxGtvNUnlyH1KmWoVVPuMdM7Ql526B8L1H2 DleV/Nel8Agz3R4FzOdhnMsnLe4Ux+Vhy+qtGTDHH+5Pm97KcDy9yRN90a8iPYA7lf1d 49QKpbqTBgFlkRQG0rEIIb2ggD2Tta0yED6YQ1iPh4RCosWTKzaaqomEas26d+dePAKP 238k+jCp5uqZOxsXYwcuiGZkzoUFfj8eQSwuFfiJd3qGwGoIkoGD23/qlEBKQtUHNWGu bip3HKwMMcIFZY3GpQHFgJ7urxIcreM2eac1xLLt4aHJ6Q1uFS3qPc5hWZJdxZG/SjRQ vstw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=nF4HRwcQsyoCE8HpYpIoV+twKiP1LljXa5GIjuapCIs=; fh=0GNeY39Cl4xRhSi2TAvxQ7Q3gtM1UYmjYULYBkUvepo=; b=MHQEG15U8pBH+ttlZEFfWP0oDRQOKZZgcwzLYXCiNKwYe3vQAfIzvvvDNLdG9zioqI mCvkALbToQ4X4YlONROjZwHy2Nhdb0NZV+HNHLsINQiXThKMIL7CHgwWKCAH/7N6VKmA XTF0i8gWMR8EhIvcmBth7+a6PeUsuZ1YQq0EIpN/hB0HED/ghQsovEHlZuC3FryS4XRM EDUqYqTzyjVZ5I0h+x730LO5f8yx/Z8j9KBDtGf6WtI1y1m12irM3LqPdS9IPYLFfTpq 1z56SZfoBXzrmXwkow/F+hsOpAJg/AZGqeiFRkcBCR4BJw6nGdWk1UQW9X69+C9F9w/u 8BiQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=oC6HifiN; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2411-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id z16-20020a656650000000b005dc425eab0esi4151693pgv.461.2024.03.10.21.38.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 21:38:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-2411-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=oC6HifiN; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-bluetooth+bounces-2411-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-2411-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 68B56B20C20 for ; Mon, 11 Mar 2024 04:38:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CB4696FCC; Mon, 11 Mar 2024 04:38:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="oC6HifiN" X-Original-To: linux-bluetooth@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5700963AE for ; Mon, 11 Mar 2024 04:38:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710131913; cv=none; b=fmvrUc+bqIQIMz8keC2b61b2kbAjJOc4AG2BgYIo+IxAMjHtzDRvmGa6McBSLKp42C9Gp563zV6XJoI0gPCN6Eeu/ieZbnW2nrYdh9BUqNmaP+ZTOJTYqF2bTJZZQMrA9+vOepffZNjBYf7Zyzapr8MKOmhCRMgYtWZuA2Vqt1I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710131913; c=relaxed/simple; bh=pu9k6Eldd+MPhU0XJjYhdafbK7zhZ4wPgH85YbAGgeo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=a0v/o2Pm5KM6SA+By2NrCn2jKz2ll9GJL82HowW3gCqBzL+MiwtjnUwa0lT21WdFJG70Ps8f5btFwHT4pBabeUthN0MoCYROotp5rtHbr7yMfnNWhgqS0UdpmAehJrKc8yT1QZXcQT6rGXP+MYuSXl3Zu1O2t69TMKB54BprxuQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=oC6HifiN; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1710131911; x=1741667911; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pu9k6Eldd+MPhU0XJjYhdafbK7zhZ4wPgH85YbAGgeo=; b=oC6HifiNLFyslNYuWdfejJUSmG25rGVKH6EmoBa6SjL7cUKif+H9h7LE PdFOW2N4CP1v51SK3of+Amr7xNsIv2QyPHn+8a8wrISGfyruBlkSpm5kH cQ2zonEN4kkG7H9xARGnpQgAjEOQ19w8eEbAidSlGQwoMqjSAy2WnjaQ9 Xn0ulsKlkBCLITNFdTln0v1VKrHfVbuS2TbQNtuqea4f3uhsL80seDxlR Mf2l9tJiWPD2aciedvdZsLhECOu39EafA5FBob3hvkz9VcfnQcdhmwar0 xOjrVbBhhyZaKo3+3FFdYqtZ+wqsinTC/6yhaYWqXMpNsrYQmBI7jKah1 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,11009"; a="15339150" X-IronPort-AV: E=Sophos;i="6.07,115,1708416000"; d="scan'208";a="15339150" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2024 21:38:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,115,1708416000"; d="scan'208";a="10925130" Received: from intel-lenovo-legion-y540-15irh-pg0.iind.intel.com ([10.224.186.95]) by fmviesa009.fm.intel.com with ESMTP; 10 Mar 2024 21:38:29 -0700 From: Kiran K To: linux-bluetooth@vger.kernel.org Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com, Kiran K Subject: [PATCH v4 1/2] Bluetooth: btintel: Define macros for image types Date: Mon, 11 Mar 2024 10:22:13 +0530 Message-Id: <20240311045214.350475-1-kiran.k@intel.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Use macro for image type instead of using hard code number. Signed-off-by: Kiran K --- drivers/bluetooth/btintel.c | 12 ++++++------ drivers/bluetooth/btintel.h | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 6ba7f5d1b837..2abe75f06e9c 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -489,7 +489,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev, } switch (version->img_type) { - case 0x01: + case BTINTEL_IMG_BOOTLOADER: variant = "Bootloader"; /* It is required that every single firmware fragment is acknowledged * with a command complete event. If the boot parameters indicate @@ -521,7 +521,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev, version->min_fw_build_nn, version->min_fw_build_cw, 2000 + version->min_fw_build_yy); break; - case 0x03: + case BTINTEL_IMG_OP: variant = "Firmware"; break; default: @@ -535,7 +535,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev, bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u", variant, 2000 + (version->timestamp >> 8), version->timestamp & 0xff, version->build_type, version->build_num); - if (version->img_type == 0x03) + if (version->img_type == BTINTEL_IMG_OP) bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1); return 0; @@ -1172,7 +1172,7 @@ static int btintel_download_fw_tlv(struct hci_dev *hdev, * If the firmware version has changed that means it needs to be reset * to bootloader when operational so the new firmware can be loaded. */ - if (ver->img_type == 0x03) + if (ver->img_type == BTINTEL_IMG_OP) return -EINVAL; /* iBT hardware variants 0x0b, 0x0c, 0x11, 0x12, 0x13, 0x14 support @@ -2230,7 +2230,7 @@ static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev, * It is not possible to use the Secure Boot Parameters in this * case since that command is only available in bootloader mode. */ - if (ver->img_type == 0x03) { + if (ver->img_type == BTINTEL_IMG_OP) { btintel_clear_flag(hdev, INTEL_BOOTLOADER); btintel_check_bdaddr(hdev); } else { @@ -2600,7 +2600,7 @@ static int btintel_bootloader_setup_tlv(struct hci_dev *hdev, return err; /* check if controller is already having an operational firmware */ - if (ver->img_type == 0x03) + if (ver->img_type == BTINTEL_IMG_OP) goto finish; err = btintel_boot(hdev, boot_param); diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h index d19fcdb9ff0b..d961a33bfbd6 100644 --- a/drivers/bluetooth/btintel.h +++ b/drivers/bluetooth/btintel.h @@ -51,6 +51,9 @@ struct intel_tlv { u8 val[]; } __packed; +#define BTINTEL_IMG_BOOTLOADER 0x01 /* Bootloader image */ +#define BTINTEL_IMG_OP 0x03 /* Operational image */ + struct intel_version_tlv { u32 cnvi_top; u32 cnvr_top; -- 2.34.1