Add support for new generation Intel controllers
cover Add support for new generation Intel controllers
Hi All,
This patchset series defines a structure and few helper functions required to enable new generation Intel controllers
Raghuram Hegde (4):
Bluetooth: btintel: Define tlv structure to enable firmware download
Bluetooth: btintel: Add helper functions to dump boot/firmware info
Bluetooth: btintel: Add helper functions to parse firmware name
Bluetooth: btintel: Add helper function to help controller type
drivers/bluetooth/btintel.c | 173 ++++++++++++++++++++++++++++++++++++ drivers/bluetooth/btintel.h | 49 ++++++++++ 2 files changed, 222 insertions(+)
Signature · 1 line
2.17.1
PATCH 1/4 Bluetooth: btintel: Define tlv structure to enable firmware download
From: Raghuram Hegde <[email protected]>
Define tlv structure to enable FW download for new generation Intel controllers
--- drivers/bluetooth/btintel.h | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+)
drivers/bluetooth/btintel.h +40 -0
@@ -19,6 +19,46 @@ struct intel_version {u8 fw_patch_num; } __packed; +struct intel_version_tlv { +u8 status; +u32 cnvi_top; +u32 cnvr_top; +u32 cnvi_bt; +u32 cnvr_bt; +u16 cnvi_otp; +u16 cnvr_otp; +u16 dev_rev_id; +u16 usb_vid; +u16 usb_pid; +u16 pcie_vendor_id; +u16 pcie_dev_id; +u16 pcie_subsys_id; +u8 img_type; +u16 timestamp; +u8 build_type; +u32 build_num; +u8 fw_build_prod; +u8 fw_build_hw; +u8 fw_build_step; +u8 bt_spec_ver; +u16 mfg_name; +u16 hci_rev; +u16 lmp_sub_ver; +u8 otp_patch_ver; +u8 secure_boot; +u8 key_from_hdr; +u8 otp_lock; +u8 api_lock; +u8 debug_lock; +u8 min_fw_build_nn; +u8 min_fw_build_cw; +u8 min_fw_build_yy; +u8 limited_cce; +u8 sbe_type; +bdaddr_t otp_bd_addr; +u8 unlocked_state; +} __packed; +struct intel_boot_params {__u8 status;__u8 otp_format;
Signature · 1 line
2.17.1
PATCH 2/4 Bluetooth: btintel: Add helper functions to dump boot/firmware info
In reply to Kiran KFrom: Raghuram Hegde <[email protected]>
Add helper functions to print boot/firmware version information
--- drivers/bluetooth/btintel.c | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
drivers/bluetooth/btintel.c +47 -0
@@ -226,6 +226,53 @@ void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver) }EXPORT_SYMBOL_GPL (btintel_version_info); +void btintel_boot_info (struct hci_dev *hdev, +struct intel_version_tlv *ver) +{ +const char *variant; + +switch (ver->img_type) { +case 0x01 : + variant ="Bootloader" ; +break ; +case 0x03 : + variant ="Firmware" ; +break ; +default : +bt_dev_err (hdev,"Unsupported image type %x" , ver->img_type); +return ; + } + +bt_dev_info (hdev,"%s timestamp %u.%u buildtype %u build %u" , + variant,2000 + (ver->timestamp >>8 ), + ver->timestamp &0xff , ver->build_type, ver->build_num); +} +EXPORT_SYMBOL_GPL (btintel_boot_info); + +void btintel_boot_info_tlv (struct hci_dev *hdev, +struct intel_version_tlv *ver) +{ +bt_dev_info (hdev,"Device revision is %u" , + ver->dev_rev_id); + +bt_dev_info (hdev,"Secure boot is %s" , + ver->secure_boot ?"enabled" :"disabled" ); + +bt_dev_info (hdev,"OTP lock is %s" , + ver->otp_lock ?"enabled" :"disabled" ); + +bt_dev_info (hdev,"API lock is %s" , + ver->api_lock ?"enabled" :"disabled" ); + +bt_dev_info (hdev,"Debug lock is %s" , + ver->debug_lock ?"enabled" :"disabled" ); + +bt_dev_info (hdev,"Minimum firmware build %u week %u %u" , + ver->min_fw_build_nn, ver->min_fw_build_cw, +2000 + ver->min_fw_build_yy); +} +EXPORT_SYMBOL_GPL (btintel_boot_info_tlv); +int btintel_secure_send (struct hci_dev *hdev,u8 fragment_type,u32 plen,const void *param) {
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH 2/4] Bluetooth: btintel: Add helper functions to dump boot/firmware info
Thank you for the patch! Perhaps something to improve:
Hi Kiran,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on v5.7 next-20200611]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kiran-K/Add-support-for-new-generation-Intel-controllers/20200611-194619 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: x86_64-allyesconfig (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project bc2b70982be8f5250cd0082a7190f8b417bd4dfe)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> drivers/bluetooth/btintel.c:229:6: warning: no previous prototype for function 'btintel_boot_info' [-Wmissing-prototypes]
void btintel_boot_info(struct hci_dev *hdev,
^drivers/bluetooth/btintel.c:229:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void btintel_boot_info(struct hci_dev *hdev,
^
static
>> drivers/bluetooth/btintel.c:252:6: warning: no previous prototype for function 'btintel_boot_info_tlv' [-Wmissing-prototypes]
void btintel_boot_info_tlv(struct hci_dev *hdev,
^drivers/bluetooth/btintel.c:252:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void btintel_boot_info_tlv(struct hci_dev *hdev,
^
static
2 warnings generated.
vim +/btintel_boot_info +229 drivers/bluetooth/btintel.c
228
> 229 void btintel_boot_info(struct hci_dev *hdev,
230 struct intel_version_tlv *ver)
231 {
232 const char *variant;
233
234 switch (ver->img_type) {
235 case 0x01:
236 variant = "Bootloader";
237 break;
238 case 0x03:
239 variant = "Firmware";
240 break;
241 default:
242 bt_dev_err(hdev, "Unsupported image type %x", ver->img_type);
243 return;
244 }
245
246 bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u",
247 variant, 2000 + (ver->timestamp >> 8),
248 ver->timestamp & 0xff, ver->build_type, ver->build_num);
249 }
250 EXPORT_SYMBOL_GPL(btintel_boot_info);
251
> 252 void btintel_boot_info_tlv(struct hci_dev *hdev, 253 struct intel_version_tlv *ver)
254 {
255 bt_dev_info(hdev, "Device revision is %u",
256 ver->dev_rev_id);
257
258 bt_dev_info(hdev, "Secure boot is %s",
259 ver->secure_boot ? "enabled" : "disabled");
260
261 bt_dev_info(hdev, "OTP lock is %s",
262 ver->otp_lock ? "enabled" : "disabled");
263
264 bt_dev_info(hdev, "API lock is %s",
265 ver->api_lock ? "enabled" : "disabled");
266
267 bt_dev_info(hdev, "Debug lock is %s",
268 ver->debug_lock ? "enabled" : "disabled");
269
270 bt_dev_info(hdev, "Minimum firmware build %u week %u %u",
271 ver->min_fw_build_nn, ver->min_fw_build_cw,
272 2000 + ver->min_fw_build_yy);
273 }
274 EXPORT_SYMBOL_GPL(btintel_boot_info_tlv);
275
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH 2/4] Bluetooth: btintel: Add helper functions to dump boot/firmware info
In reply to Kiran KThank you for the patch! Perhaps something to improve:
Hi Kiran,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on bluetooth/master v5.7 next-20200611] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kiran-K/Add-support-for-new-generation-Intel-controllers/20200611-194619 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: nds32-randconfig-r014-20200612 (attached as .config) compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from ./arch/nds32/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/nds32/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/bluetooth/btintel.c:9:include/linux/dma-mapping.h: In function 'dma_map_resource':arch/nds32/include/asm/memory.h:82:32: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 82 | #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
| ^~include/asm-generic/bug.h:139:27: note: in definition of macro 'WARN_ON_ONCE'
139 | int __ret_warn_once = !!(condition); | ^~~~~~~~~include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~drivers/bluetooth/btintel.c: At top level:
>> drivers/bluetooth/btintel.c:229:6: warning: no previous prototype for 'btintel_boot_info' [-Wmissing-prototypes] 229 | void btintel_boot_info(struct hci_dev *hdev, | ^~~~~~~~~~~~~~~~~ >> drivers/bluetooth/btintel.c:252:6: warning: no previous prototype for 'btintel_boot_info_tlv' [-Wmissing-prototypes]
252 | void btintel_boot_info_tlv(struct hci_dev *hdev,
| ^~~~~~~~~~~~~~~~~~~~~
vim +/btintel_boot_info +229 drivers/bluetooth/btintel.c
228
> 229 void btintel_boot_info(struct hci_dev *hdev,
230 struct intel_version_tlv *ver)
231 {
232 const char *variant;
233
234 switch (ver->img_type) {
235 case 0x01:
236 variant = "Bootloader";
237 break;
238 case 0x03:
239 variant = "Firmware";
240 break;
241 default:
242 bt_dev_err(hdev, "Unsupported image type %x", ver->img_type);
243 return;
244 }
245
246 bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u",
247 variant, 2000 + (ver->timestamp >> 8),
248 ver->timestamp & 0xff, ver->build_type, ver->build_num);
249 }
250 EXPORT_SYMBOL_GPL(btintel_boot_info);
251
> 252 void btintel_boot_info_tlv(struct hci_dev *hdev, 253 struct intel_version_tlv *ver)
254 {
255 bt_dev_info(hdev, "Device revision is %u",
256 ver->dev_rev_id);
257
258 bt_dev_info(hdev, "Secure boot is %s",
259 ver->secure_boot ? "enabled" : "disabled");
260
261 bt_dev_info(hdev, "OTP lock is %s",
262 ver->otp_lock ? "enabled" : "disabled");
263
264 bt_dev_info(hdev, "API lock is %s",
265 ver->api_lock ? "enabled" : "disabled");
266
267 bt_dev_info(hdev, "Debug lock is %s",
268 ver->debug_lock ? "enabled" : "disabled");
269
270 bt_dev_info(hdev, "Minimum firmware build %u week %u %u",
271 ver->min_fw_build_nn, ver->min_fw_build_cw,
272 2000 + ver->min_fw_build_yy);
273 }
274 EXPORT_SYMBOL_GPL(btintel_boot_info_tlv);
275
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH 3/4 Bluetooth: btintel: Add helper functions to parse firmware name
In reply to Kiran KFrom: Raghuram Hegde <[email protected]>
Define helper functions to construct firmware file name as the format of legacy differs from new generation Intel controllers
--- drivers/bluetooth/btintel.c | 75 +++++++++++++++++++++++++++++++++++++ drivers/bluetooth/btintel.h | 6 +++ 2 files changed, 81 insertions(+)
drivers/bluetooth/btintel.c +75 -0
@@ -382,6 +382,81 @@ int btintel_set_event_mask_mfg(struct hci_dev *hdev, bool debug) }EXPORT_SYMBOL_GPL (btintel_set_event_mask_mfg); +bool btintel_get_fw_name (struct intel_version *ver, +struct intel_boot_params *params, +char *fw_name,size_t len, +const char *suffix) +{ +/* This is for legacy HCI_Intel_Read_Version command. +* +* With this Intel bootloader only the hardware variant and device +* revision information are used to select the right firmware for SfP +* and WsP. +* +* The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi. +* +* Currently the supported hardware variants are: +* 11 (0x0b) for iBT3.0 (LnP/SfP) +* 12 (0x0c) for iBT3.5 (WsP) +* +* For ThP/JfP and for future SKU's, the FW name varies based on HW +* variant, HW revision and FW revision, as these are dependent on CNVi +* and RF Combination. +* +* 17 (0x11) for iBT3.5 (JfP) +* 18 (0x12) for iBT3.5 (ThP) +* +* The firmware file name for these will be +* ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi. +* +*/ + +switch (ver->hw_variant) { +case 0x0b :/* SfP */ +case 0x0c :/* WsP */ +snprintf (fw_name, len,"intel/ibt-%u-%u.%s" , +le16_to_cpu (ver->hw_variant), +le16_to_cpu (params->dev_revid), + suffix); +break ; +case 0x11 :/* JfP */ +case 0x12 :/* ThP */ +case 0x13 :/* HrP */ +case 0x14 :/* CcP */ +snprintf (fw_name, len,"intel/ibt-%u-%u-%u.%s" , +le16_to_cpu (ver->hw_variant), +le16_to_cpu (ver->hw_revision), +le16_to_cpu (ver->fw_revision), + suffix); +break ; +default : +return false; + } +return true; +} +EXPORT_SYMBOL_GPL (btintel_get_fw_name); + +void btintel_get_fw_name_tlv (struct intel_version_tlv *ver, +char *fw_name,size_t len, +const char *suffix) +{ +/* This is for legacy HCI_Intel_Read_Version command. +* The firmware file name for these will be +* ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step> +* +* Currently the supported hardware variants are: +* iBT4.2 23 (0x17) for TyP +* iBT4.2 24 (0x18) for Solar +*/ +snprintf (fw_name, len,"intel/ibt-%04x-%04x.%s" , +INTEL_CNVX_TOP_PACK_SWAB (INTEL_CNVX_TOP_TYPE (ver->cnvi_top), +INTEL_CNVX_TOP_STEP (ver->cnvi_top)), +INTEL_CNVX_TOP_PACK_SWAB (INTEL_CNVX_TOP_TYPE (ver->cnvr_top), +INTEL_CNVX_TOP_STEP (ver->cnvr_top)), + suffix); +} +EXPORT_SYMBOL_GPL (btintel_get_fw_name_tlv); +int btintel_read_version (struct hci_dev *hdev,struct intel_version *ver) {struct sk_buff *skb;
drivers/bluetooth/btintel.h +6 -0
@@ -106,6 +106,12 @@ struct intel_debug_features {__u8 page1[16 ]; } __packed; +#define INTEL_CNVX_TOP_TYPE_MASK 0x00000fff +#define INTEL_CNVX_TOP_STEP_MASK 0x0f000000 +#define INTEL_CNVX_TOP_TYPE (cnvx_top) ((cnvx_top) & INTEL_CNVX_TOP_TYPE_MASK) +#define INTEL_CNVX_TOP_STEP (cnvx_top) (((cnvx_top) & INTEL_CNVX_TOP_STEP_MASK) >> 24) +#define INTEL_CNVX_TOP_PACK_SWAB (t, s) __swab16(((__u16)(((t) << 4) | (s)))) +#if IS_ENABLED (CONFIG_BT_INTEL )int btintel_check_bdaddr (struct hci_dev *hdev);
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH 3/4] Bluetooth: btintel: Add helper functions to parse firmware name
Thank you for the patch! Perhaps something to improve:
Hi Kiran,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20200611]
[cannot apply to bluetooth/master v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kiran-K/Add-support-for-new-generation-Intel-controllers/20200611-194619 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: powerpc-randconfig-s031-20200611 (attached as .config) compiler: powerpc64le-linux-gcc (GCC) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.1-250-g42323db3-dirty # save the attached .config to linux build tree make W=1 C=1 ARCH=powerpc CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
sparse warnings: (new ones prefixed by >>)
>> drivers/bluetooth/btintel.c:418:26: sparse: sparse: cast to restricted __le16
drivers/bluetooth/btintel.c:427:26: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btintel.c:428:26: sparse: sparse: cast to restricted __le16 drivers/bluetooth/btintel.c:429:26: sparse: sparse: cast to restricted __le16
vim +418 drivers/bluetooth/btintel.c
384
385 bool btintel_get_fw_name(struct intel_version *ver,
386 struct intel_boot_params *params,
387 char *fw_name, size_t len,
388 const char *suffix)
389 {
390 /* This is for legacy HCI_Intel_Read_Version command.
391 *
392 * With this Intel bootloader only the hardware variant and device
393 * revision information are used to select the right firmware for SfP
394 * and WsP.
395 *
396 * The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi.
397 *
398 * Currently the supported hardware variants are:
399 * 11 (0x0b) for iBT3.0 (LnP/SfP)
400 * 12 (0x0c) for iBT3.5 (WsP)
401 *
402 * For ThP/JfP and for future SKU's, the FW name varies based on HW
403 * variant, HW revision and FW revision, as these are dependent on CNVi
404 * and RF Combination.
405 *
406 * 17 (0x11) for iBT3.5 (JfP)
407 * 18 (0x12) for iBT3.5 (ThP)
408 *
409 * The firmware file name for these will be
410 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi.
411 *
412 */
413
414 switch (ver->hw_variant) {
415 case 0x0b: /* SfP */
416 case 0x0c: /* WsP */
417 snprintf(fw_name, len, "intel/ibt-%u-%u.%s",
> 418 le16_to_cpu(ver->hw_variant),
419 le16_to_cpu(params->dev_revid),
420 suffix);
421 break;
422 case 0x11: /* JfP */
423 case 0x12: /* ThP */
424 case 0x13: /* HrP */
425 case 0x14: /* CcP */
426 snprintf(fw_name, len, "intel/ibt-%u-%u-%u.%s",
427 le16_to_cpu(ver->hw_variant),
428 le16_to_cpu(ver->hw_revision),
429 le16_to_cpu(ver->fw_revision),
430 suffix);
431 break;
432 default:
433 return false;
434 }
435 return true;
436 }
437 EXPORT_SYMBOL_GPL(btintel_get_fw_name);
438
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botRe: [PATCH 3/4] Bluetooth: btintel: Add helper functions to parse firmware name
In reply to Kiran KThank you for the patch! Perhaps something to improve:
Hi Kiran,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20200611]
[cannot apply to bluetooth/master v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kiran-K/Add-support-for-new-generation-Intel-controllers/20200611-194619 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: nds32-randconfig-r014-20200612 (attached as .config) compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from ./arch/nds32/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/nds32/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/bluetooth/btintel.c:9:include/linux/dma-mapping.h: In function 'dma_map_resource':arch/nds32/include/asm/memory.h:82:32: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 82 | #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
| ^~include/asm-generic/bug.h:139:27: note: in definition of macro 'WARN_ON_ONCE'
139 | int __ret_warn_once = !!(condition); | ^~~~~~~~~include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~drivers/bluetooth/btintel.c: At top level:drivers/bluetooth/btintel.c:229:6: warning: no previous prototype for 'btintel_boot_info' [-Wmissing-prototypes] 229 | void btintel_boot_info(struct hci_dev *hdev,
| ^~~~~~~~~~~~~~~~~drivers/bluetooth/btintel.c:252:6: warning: no previous prototype for 'btintel_boot_info_tlv' [-Wmissing-prototypes] 252 | void btintel_boot_info_tlv(struct hci_dev *hdev,
| ^~~~~~~~~~~~~~~~~~~~~
<< from drivers/bluetooth/btintel.c:9:
>> drivers/bluetooth/btintel.c:385:6: warning: no previous prototype for 'btintel_get_fw_name' [-Wmissing-prototypes] 385 | bool btintel_get_fw_name(struct intel_version *ver, | ^~~~~~~~~~~~~~~~~~~ << from drivers/bluetooth/btintel.c:9: >> drivers/bluetooth/btintel.c:439:6: warning: no previous prototype for 'btintel_get_fw_name_tlv' [-Wmissing-prototypes]
439 | void btintel_get_fw_name_tlv(struct intel_version_tlv *ver,
| ^~~~~~~~~~~~~~~~~~~~~~~
vim +/btintel_get_fw_name +385 drivers/bluetooth/btintel.c
384
> 385 bool btintel_get_fw_name(struct intel_version *ver,
386 struct intel_boot_params *params,
387 char *fw_name, size_t len,
388 const char *suffix)
389 {
390 /* This is for legacy HCI_Intel_Read_Version command.
391 *
392 * With this Intel bootloader only the hardware variant and device
393 * revision information are used to select the right firmware for SfP
394 * and WsP.
395 *
396 * The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi.
397 *
398 * Currently the supported hardware variants are:
399 * 11 (0x0b) for iBT3.0 (LnP/SfP)
400 * 12 (0x0c) for iBT3.5 (WsP)
401 *
402 * For ThP/JfP and for future SKU's, the FW name varies based on HW
403 * variant, HW revision and FW revision, as these are dependent on CNVi
404 * and RF Combination.
405 *
406 * 17 (0x11) for iBT3.5 (JfP)
407 * 18 (0x12) for iBT3.5 (ThP)
408 *
409 * The firmware file name for these will be
410 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi.
411 *
412 */
413
414 switch (ver->hw_variant) {
415 case 0x0b: /* SfP */
416 case 0x0c: /* WsP */
417 snprintf(fw_name, len, "intel/ibt-%u-%u.%s",
418 le16_to_cpu(ver->hw_variant),
419 le16_to_cpu(params->dev_revid),
420 suffix);
421 break;
422 case 0x11: /* JfP */
423 case 0x12: /* ThP */
424 case 0x13: /* HrP */
425 case 0x14: /* CcP */
426 snprintf(fw_name, len, "intel/ibt-%u-%u-%u.%s",
427 le16_to_cpu(ver->hw_variant),
428 le16_to_cpu(ver->hw_revision),
429 le16_to_cpu(ver->fw_revision),
430 suffix);
431 break;
432 default:
433 return false;
434 }
435 return true;
436 }
437 EXPORT_SYMBOL_GPL(btintel_get_fw_name);
438
> 439 void btintel_get_fw_name_tlv(struct intel_version_tlv *ver, 440 char *fw_name, size_t len,
441 const char *suffix)
442 {
443 /* This is for legacy HCI_Intel_Read_Version command.
444 * The firmware file name for these will be
445 * ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step>
446 *
447 * Currently the supported hardware variants are:
448 * iBT4.2 23 (0x17) for TyP
449 * iBT4.2 24 (0x18) for Solar
450 */
451 snprintf(fw_name, len, "intel/ibt-%04x-%04x.%s",
452 INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top),
453 INTEL_CNVX_TOP_STEP(ver->cnvi_top)),
454 INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top),
455 INTEL_CNVX_TOP_STEP(ver->cnvr_top)),
456 suffix);
457 }
458 EXPORT_SYMBOL_GPL(btintel_get_fw_name_tlv);
459
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
PATCH 4/4 Bluetooth: btintel: Add helper function to help controller type
In reply to Kiran KFrom: Raghuram Hegde <[email protected]>
As the firmware download flow for new generation controller changes from legacy controller, this function helps in deciding the download flow to be used
--- drivers/bluetooth/btintel.c | 51 +++++++++++++++++++++++++++++++++++++ drivers/bluetooth/btintel.h | 3 +++ 2 files changed, 54 insertions(+)
drivers/bluetooth/btintel.c +51 -0
@@ -482,6 +482,57 @@ int btintel_read_version(struct hci_dev *hdev, struct intel_version *ver) }EXPORT_SYMBOL_GPL (btintel_read_version); +int btintel_read_version_tlv (struct hci_dev *hdev,bool *is_tlv_format, +struct sk_buff **skb_out) +{ +u8 param; +u8 status; +u8 tlv_check_octet; +u8 *data; +struct sk_buff *skb; + + param =0xFF ; + skb_out =NULL ; + + skb =__hci_cmd_sync (hdev,0xfc05 ,1 , ¶m,HCI_CMD_TIMEOUT ); +if (IS_ERR (skb)) { +bt_dev_err (hdev,"Intel read version command failed (%ld)" , +PTR_ERR (skb)); +return PTR_ERR (skb); + } + +/* Check status */ + data = skb->data; + status = *data; +if (status) { +bt_dev_err (hdev,"Intel Read Version failed (%02x)" , + status); +kfree_skb (skb); +return -bt_to_errno (status); + } + +/* There are two variants of HCI_Intel_Read_Version_Command_Complete +* depending on SKU type (legacy and TLV format).If the skb->len +* parameter is equal to INTEL_VERSION_LEN and the first octet +* after the status parameter is 0x37 then it's the legacy format, +* otherwise it's TLV format +*/ + +/* Fetch the octet after status */ + tlv_check_octet = *(data +1 ); + +if (skb->len ==INTEL_VERSION_LEN && tlv_check_octet ==0x37 ) { +bt_dev_dbg (hdev,"Using Legacy Intel Version command" ); + *is_tlv_format = false; + }else { +bt_dev_dbg (hdev,"Using TLV format Version command" ); + *is_tlv_format = true; + } + *skb_out = skb; +return 0 ; +} +EXPORT_SYMBOL_GPL (btintel_read_version_tlv); +/* ------- REGMAP IBT SUPPORT ------- */ #define IBT_REG_MODE_8BIT 0x00
drivers/bluetooth/btintel.h +3 -0
@@ -6,6 +6,9 @@* Copyright (C) 2015 Intel Corporation */ +/* Length of intel_version structure*/ +#define INTEL_VERSION_LEN 10 +struct intel_version {u8 status;u8 hw_platform;
Signature · 1 line
2.17.1
kernel test robot
build botRe: [PATCH 4/4] Bluetooth: btintel: Add helper function to help controller type
Thank you for the patch! Perhaps something to improve:
Hi Kiran,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on next-20200611]
[cannot apply to bluetooth/master v5.7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Kiran-K/Add-support-for-new-generation-Intel-controllers/20200611-194619 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: nds32-randconfig-r014-20200612 (attached as .config) compiler: nds32le-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=nds32
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>, old ones prefixed by <<):
In file included from ./arch/nds32/include/generated/asm/bug.h:1,
from include/linux/bug.h:5,
from include/linux/thread_info.h:12,
from include/asm-generic/preempt.h:5,
from ./arch/nds32/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:78,
from include/linux/spinlock.h:51,
from include/linux/seqlock.h:36,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:13,
from drivers/bluetooth/btintel.c:9:include/linux/dma-mapping.h: In function 'dma_map_resource':arch/nds32/include/asm/memory.h:82:32: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits] 82 | #define pfn_valid(pfn) ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
| ^~include/asm-generic/bug.h:139:27: note: in definition of macro 'WARN_ON_ONCE'
139 | int __ret_warn_once = !!(condition); | ^~~~~~~~~include/linux/dma-mapping.h:352:19: note: in expansion of macro 'pfn_valid'
352 | if (WARN_ON_ONCE(pfn_valid(PHYS_PFN(phys_addr))))
| ^~~~~~~~~drivers/bluetooth/btintel.c: At top level:drivers/bluetooth/btintel.c:229:6: warning: no previous prototype for 'btintel_boot_info' [-Wmissing-prototypes] 229 | void btintel_boot_info(struct hci_dev *hdev,
| ^~~~~~~~~~~~~~~~~drivers/bluetooth/btintel.c:252:6: warning: no previous prototype for 'btintel_boot_info_tlv' [-Wmissing-prototypes] 252 | void btintel_boot_info_tlv(struct hci_dev *hdev,
| ^~~~~~~~~~~~~~~~~~~~~drivers/bluetooth/btintel.c:385:6: warning: no previous prototype for 'btintel_get_fw_name' [-Wmissing-prototypes] 385 | bool btintel_get_fw_name(struct intel_version *ver,
| ^~~~~~~~~~~~~~~~~~~drivers/bluetooth/btintel.c:439:6: warning: no previous prototype for 'btintel_get_fw_name_tlv' [-Wmissing-prototypes] 439 | void btintel_get_fw_name_tlv(struct intel_version_tlv *ver,
| ^~~~~~~~~~~~~~~~~~~~~~~
<< from drivers/bluetooth/btintel.c:9:
>> drivers/bluetooth/btintel.c:485:5: warning: no previous prototype for 'btintel_read_version_tlv' [-Wmissing-prototypes]
485 | int btintel_read_version_tlv(struct hci_dev *hdev, bool *is_tlv_format,
| ^~~~~~~~~~~~~~~~~~~~~~~~
vim +/btintel_read_version_tlv +485 drivers/bluetooth/btintel.c
484
> 485 int btintel_read_version_tlv(struct hci_dev *hdev, bool *is_tlv_format,
486 struct sk_buff **skb_out)
487 {
488 u8 param;
489 u8 status;
490 u8 tlv_check_octet;
491 u8 *data;
492 struct sk_buff *skb;
493
494 param = 0xFF;
495 skb_out = NULL;
496
497 skb = __hci_cmd_sync(hdev, 0xfc05, 1, ¶m, HCI_CMD_TIMEOUT);
498 if (IS_ERR(skb)) {
499 bt_dev_err(hdev, "Intel read version command failed (%ld)",
500 PTR_ERR(skb));
501 return PTR_ERR(skb);
502 }
503
504 /* Check status */
505 data = skb->data;
506 status = *data;
507 if (status) {
508 bt_dev_err(hdev, "Intel Read Version failed (%02x)",
509 status);
510 kfree_skb(skb);
511 return -bt_to_errno(status);
512 }
513
514 /* There are two variants of HCI_Intel_Read_Version_Command_Complete
515 * depending on SKU type (legacy and TLV format).If the skb->len
516 * parameter is equal to INTEL_VERSION_LEN and the first octet
517 * after the status parameter is 0x37 then it's the legacy format,
518 * otherwise it's TLV format
519 */
520
521 /* Fetch the octet after status */
522 tlv_check_octet = *(data + 1);
523
524 if (skb->len == INTEL_VERSION_LEN && tlv_check_octet == 0x37) {
525 bt_dev_dbg(hdev, "Using Legacy Intel Version command");
526 *is_tlv_format = false;
527 } else {
528 bt_dev_dbg(hdev, "Using TLV format Version command");
529 *is_tlv_format = true;
530 }
531 *skb_out = skb;
532 return 0;
533 }
534 EXPORT_SYMBOL_GPL(btintel_read_version_tlv);
535
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Please ignore this patchset. I started uploading newer patches with smaller changes and more refactoring.
Quoted 24 lines
-----Original Message-----
From: K, Kiran <[email protected]>
Sent: Thursday, June 11, 2020 5:15 PM
To: [email protected]
Cc: Srivatsa, Ravishankar <[email protected]>; [email protected]; K, Kiran <[email protected]>
Subject: [PATCH 0/4] Add support for new generation Intel controllersHi All,
This patchset series defines a structure and few helper functions required to enable new generation Intel controllersRaghuram Hegde (4):
Bluetooth: btintel: Define tlv structure to enable firmware download
Bluetooth: btintel: Add helper functions to dump boot/firmware info
Bluetooth: btintel: Add helper functions to parse firmware name
Bluetooth: btintel: Add helper function to help controller typedrivers/bluetooth/btintel.c | 173 ++++++++++++++++++++++++++++++++++++ drivers/bluetooth/btintel.h | 49 ++++++++++ 2 files changed, 222 insertions(+)--
2.17.1