Lines Matching +full:mode +full:- +full:bootloader
1 // SPDX-License-Identifier: GPL-2.0-or-later
69 if (skb->len != sizeof(*bda)) { in btintel_check_bdaddr()
72 return -EIO; in btintel_check_bdaddr()
75 bda = (struct hci_rp_read_bd_addr *)skb->data; in btintel_check_bdaddr()
82 if (!bacmp(&bda->bdaddr, BDADDR_INTEL)) { in btintel_check_bdaddr()
84 &bda->bdaddr); in btintel_check_bdaddr()
85 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_check_bdaddr()
101 bt_dev_err(hdev, "Entering manufacturer mode failed (%ld)", in btintel_enter_mfg()
117 * 0x00: Just disable the manufacturing mode (0x00). in btintel_exit_mfg()
118 * 0x01: Disable manufacturing mode and reset with patches deactivated. in btintel_exit_mfg()
119 * 0x02: Disable manufacturing mode and reset with patches activated. in btintel_exit_mfg()
126 bt_dev_err(hdev, "Exiting manufacturer mode failed (%ld)", in btintel_exit_mfg()
193 if (err == -ENODATA) in btintel_set_diag()
195 bt_dev_err(hdev, "Changing Intel diagnostic mode failed (%d)", in btintel_set_diag()
228 /* Legacy ROM device needs to be in the manufacturer mode to apply in btintel_set_diag_combined()
263 if (skb->len != 13) { in btintel_hw_error()
269 bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1)); in btintel_hw_error()
282 if (ver->hw_platform != 0x37) { in btintel_version_info()
284 ver->hw_platform); in btintel_version_info()
285 return -EINVAL; in btintel_version_info()
294 switch (ver->hw_variant) { in btintel_version_info()
295 case 0x07: /* WP - Legacy ROM */ in btintel_version_info()
296 case 0x08: /* StP - Legacy ROM */ in btintel_version_info()
306 ver->hw_variant); in btintel_version_info()
307 return -EINVAL; in btintel_version_info()
310 switch (ver->fw_variant) { in btintel_version_info()
315 variant = "Bootloader"; in btintel_version_info()
324 bt_dev_err(hdev, "Unsupported firmware variant(%02x)", ver->fw_variant); in btintel_version_info()
325 return -EINVAL; in btintel_version_info()
328 coredump_info.hw_variant = ver->hw_variant; in btintel_version_info()
329 coredump_info.fw_build_num = ver->fw_build_num; in btintel_version_info()
332 variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f, in btintel_version_info()
333 ver->fw_build_num, ver->fw_build_ww, in btintel_version_info()
334 2000 + ver->fw_build_yy); in btintel_version_info()
357 plen -= fragment_len; in btintel_secure_send()
371 err = request_firmware_direct(&fw, ddc_name, &hdev->dev); in btintel_load_ddc_config()
380 fw_ptr = fw->data; in btintel_load_ddc_config()
383 * Length (1 byte), DDC ID (2 bytes), and DDC value (Length - 2). in btintel_load_ddc_config()
385 while (fw->size > fw_ptr - fw->data) { in btintel_load_ddc_config()
438 if (!skb || skb->len != sizeof(*ver)) { in btintel_read_version()
441 return -EILSEQ; in btintel_read_version()
444 memcpy(ver, skb->data, sizeof(*ver)); in btintel_read_version()
460 if (INTEL_HW_PLATFORM(version->cnvi_bt) != 0x37) { in btintel_version_info_tlv()
462 INTEL_HW_PLATFORM(version->cnvi_bt)); in btintel_version_info_tlv()
463 return -EINVAL; in btintel_version_info_tlv()
472 switch (INTEL_HW_VARIANT(version->cnvi_bt)) { in btintel_version_info_tlv()
475 case 0x19: /* Slr-F */ in btintel_version_info_tlv()
483 INTEL_HW_VARIANT(version->cnvi_bt)); in btintel_version_info_tlv()
484 return -EINVAL; in btintel_version_info_tlv()
487 switch (version->img_type) { in btintel_version_info_tlv()
489 variant = "Bootloader"; in btintel_version_info_tlv()
492 * that this bootloader does not send them, then abort the setup. in btintel_version_info_tlv()
494 if (version->limited_cce != 0x00) { in btintel_version_info_tlv()
496 version->limited_cce); in btintel_version_info_tlv()
497 return -EINVAL; in btintel_version_info_tlv()
501 if (version->sbe_type > 0x01) { in btintel_version_info_tlv()
503 version->sbe_type); in btintel_version_info_tlv()
504 return -EINVAL; in btintel_version_info_tlv()
507 bt_dev_info(hdev, "Device revision is %u", version->dev_rev_id); in btintel_version_info_tlv()
509 version->secure_boot ? "enabled" : "disabled"); in btintel_version_info_tlv()
511 version->otp_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
513 version->api_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
515 version->debug_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
517 version->min_fw_build_nn, version->min_fw_build_cw, in btintel_version_info_tlv()
518 2000 + version->min_fw_build_yy); in btintel_version_info_tlv()
527 bt_dev_err(hdev, "Unsupported image type(%02x)", version->img_type); in btintel_version_info_tlv()
528 return -EINVAL; in btintel_version_info_tlv()
531 coredump_info.hw_variant = INTEL_HW_VARIANT(version->cnvi_bt); in btintel_version_info_tlv()
532 coredump_info.fw_build_num = version->build_num; in btintel_version_info_tlv()
535 2000 + (version->timestamp >> 8), version->timestamp & 0xff, in btintel_version_info_tlv()
536 version->build_type, version->build_num); in btintel_version_info_tlv()
537 if (version->img_type == BTINTEL_IMG_OP) in btintel_version_info_tlv()
538 bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1); in btintel_version_info_tlv()
556 while (skb->len) { in btintel_parse_version_tlv()
560 if (skb->len < sizeof(*tlv)) in btintel_parse_version_tlv()
561 return -EINVAL; in btintel_parse_version_tlv()
563 tlv = (struct intel_tlv *)skb->data; in btintel_parse_version_tlv()
566 if (skb->len < tlv->len + sizeof(*tlv)) in btintel_parse_version_tlv()
567 return -EINVAL; in btintel_parse_version_tlv()
569 switch (tlv->type) { in btintel_parse_version_tlv()
571 version->cnvi_top = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
574 version->cnvr_top = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
577 version->cnvi_bt = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
580 version->cnvr_bt = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
583 version->dev_rev_id = get_unaligned_le16(tlv->val); in btintel_parse_version_tlv()
586 version->img_type = tlv->val[0]; in btintel_parse_version_tlv()
593 version->min_fw_build_cw = tlv->val[0]; in btintel_parse_version_tlv()
594 version->min_fw_build_yy = tlv->val[1]; in btintel_parse_version_tlv()
595 version->timestamp = get_unaligned_le16(tlv->val); in btintel_parse_version_tlv()
598 version->build_type = tlv->val[0]; in btintel_parse_version_tlv()
605 version->min_fw_build_nn = tlv->val[0]; in btintel_parse_version_tlv()
606 version->build_num = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
609 version->secure_boot = tlv->val[0]; in btintel_parse_version_tlv()
612 version->otp_lock = tlv->val[0]; in btintel_parse_version_tlv()
615 version->api_lock = tlv->val[0]; in btintel_parse_version_tlv()
618 version->debug_lock = tlv->val[0]; in btintel_parse_version_tlv()
621 version->min_fw_build_nn = tlv->val[0]; in btintel_parse_version_tlv()
622 version->min_fw_build_cw = tlv->val[1]; in btintel_parse_version_tlv()
623 version->min_fw_build_yy = tlv->val[2]; in btintel_parse_version_tlv()
626 version->limited_cce = tlv->val[0]; in btintel_parse_version_tlv()
629 version->sbe_type = tlv->val[0]; in btintel_parse_version_tlv()
632 memcpy(&version->otp_bd_addr, tlv->val, in btintel_parse_version_tlv()
636 version->git_sha1 = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
639 snprintf(version->fw_id, sizeof(version->fw_id), in btintel_parse_version_tlv()
640 "%s", tlv->val); in btintel_parse_version_tlv()
647 skb_pull(skb, tlv->len + sizeof(*tlv)); in btintel_parse_version_tlv()
661 return -EINVAL; in btintel_read_version_tlv()
670 if (skb->data[0]) { in btintel_read_version_tlv()
672 skb->data[0]); in btintel_read_version_tlv()
674 return -EIO; in btintel_read_version_tlv()
683 /* ------- REGMAP IBT SUPPORT ------- */
697 __u8 mode; member
718 return -EINVAL; in regmap_ibt_read()
722 cp.mode = IBT_REG_MODE_8BIT; in regmap_ibt_read()
725 cp.mode = IBT_REG_MODE_16BIT; in regmap_ibt_read()
728 cp.mode = IBT_REG_MODE_32BIT; in regmap_ibt_read()
731 return -EINVAL; in regmap_ibt_read()
734 /* regmap provides a little-endian formatted addr */ in regmap_ibt_read()
738 bt_dev_dbg(ctx->hdev, "Register (0x%x) read", le32_to_cpu(cp.addr)); in regmap_ibt_read()
740 skb = hci_cmd_sync(ctx->hdev, ctx->op_read, sizeof(cp), &cp, in regmap_ibt_read()
744 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error (%d)", in regmap_ibt_read()
749 if (skb->len != sizeof(*rp) + val_size) { in regmap_ibt_read()
750 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error, bad len", in regmap_ibt_read()
752 err = -EINVAL; in regmap_ibt_read()
756 rp = (struct ibt_rp_reg_access *)skb->data; in regmap_ibt_read()
758 if (rp->addr != cp.addr) { in regmap_ibt_read()
759 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error, bad addr", in regmap_ibt_read()
760 le32_to_cpu(rp->addr)); in regmap_ibt_read()
761 err = -EINVAL; in regmap_ibt_read()
765 memcpy(val, rp->data, val_size); in regmap_ibt_read()
780 u8 mode; in regmap_ibt_gather_write() local
784 return -EINVAL; in regmap_ibt_gather_write()
788 mode = IBT_REG_MODE_8BIT; in regmap_ibt_gather_write()
791 mode = IBT_REG_MODE_16BIT; in regmap_ibt_gather_write()
794 mode = IBT_REG_MODE_32BIT; in regmap_ibt_gather_write()
797 return -EINVAL; in regmap_ibt_gather_write()
802 return -ENOMEM; in regmap_ibt_gather_write()
804 /* regmap provides a little-endian formatted addr/value */ in regmap_ibt_gather_write()
805 cp->addr = *(__le32 *)addr; in regmap_ibt_gather_write()
806 cp->mode = mode; in regmap_ibt_gather_write()
807 cp->len = val_size; in regmap_ibt_gather_write()
808 memcpy(&cp->data, val, val_size); in regmap_ibt_gather_write()
810 bt_dev_dbg(ctx->hdev, "Register (0x%x) write", le32_to_cpu(cp->addr)); in regmap_ibt_gather_write()
812 skb = hci_cmd_sync(ctx->hdev, ctx->op_write, plen, cp, HCI_CMD_TIMEOUT); in regmap_ibt_gather_write()
815 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) write error (%d)", in regmap_ibt_gather_write()
816 le32_to_cpu(cp->addr), err); in regmap_ibt_gather_write()
832 return -EINVAL; in regmap_ibt_write()
834 return regmap_ibt_gather_write(context, data, 4, data + 4, count - 4); in regmap_ibt_write()
863 bt_dev_info(hdev, "regmap: Init R%x-W%x region", opcode_read, in btintel_regmap_init()
868 return ERR_PTR(-ENOMEM); in btintel_regmap_init()
870 ctx->op_read = opcode_read; in btintel_regmap_init()
871 ctx->op_write = opcode_write; in btintel_regmap_init()
872 ctx->hdev = hdev; in btintel_regmap_init()
874 return regmap_init(&hdev->dev, ®map_ibt, ctx, ®map_ibt_cfg); in btintel_regmap_init()
910 if (skb->len != sizeof(*params)) { in btintel_read_boot_params()
913 return -EILSEQ; in btintel_read_boot_params()
916 memcpy(params, skb->data, sizeof(*params)); in btintel_read_boot_params()
920 if (params->status) { in btintel_read_boot_params()
922 params->status); in btintel_read_boot_params()
923 return -bt_to_errno(params->status); in btintel_read_boot_params()
927 le16_to_cpu(params->dev_revid)); in btintel_read_boot_params()
930 params->secure_boot ? "enabled" : "disabled"); in btintel_read_boot_params()
933 params->otp_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
936 params->api_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
939 params->debug_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
942 params->min_fw_build_nn, params->min_fw_build_cw, in btintel_read_boot_params()
943 2000 + params->min_fw_build_yy); in btintel_read_boot_params()
957 err = btintel_secure_send(hdev, 0x00, 128, fw->data); in btintel_sfi_rsa_header_secure_send()
966 err = btintel_secure_send(hdev, 0x03, 256, fw->data + 128); in btintel_sfi_rsa_header_secure_send()
975 err = btintel_secure_send(hdev, 0x02, 256, fw->data + 388); in btintel_sfi_rsa_header_secure_send()
993 err = btintel_secure_send(hdev, 0x00, 128, fw->data + 644); in btintel_sfi_ecdsa_header_secure_send()
1002 err = btintel_secure_send(hdev, 0x03, 96, fw->data + 644 + 128); in btintel_sfi_ecdsa_header_secure_send()
1011 err = btintel_secure_send(hdev, 0x02, 96, fw->data + 644 + 224); in btintel_sfi_ecdsa_header_secure_send()
1028 fw_ptr = fw->data + offset; in btintel_download_firmware_payload()
1030 err = -EINVAL; in btintel_download_firmware_payload()
1032 while (fw_ptr - fw->data < fw->size) { in btintel_download_firmware_payload()
1035 frag_len += sizeof(*cmd) + cmd->plen; in btintel_download_firmware_payload()
1070 fw_ptr = fw->data; in btintel_firmware_version()
1072 while (fw_ptr - fw->data < fw->size) { in btintel_firmware_version()
1080 if (le16_to_cpu(cmd->opcode) == CMD_WRITE_BOOT_PARAMS) { in btintel_firmware_version()
1085 *boot_addr = le32_to_cpu(params->boot_addr); in btintel_firmware_version()
1089 bt_dev_info(hdev, "Firmware Version: %u-%u.%u", in btintel_firmware_version()
1090 params->fw_build_num, params->fw_build_ww, in btintel_firmware_version()
1091 params->fw_build_yy); in btintel_firmware_version()
1093 return (num == params->fw_build_num && in btintel_firmware_version()
1094 ww == params->fw_build_ww && in btintel_firmware_version()
1095 yy == params->fw_build_yy); in btintel_firmware_version()
1098 fw_ptr += sizeof(*cmd) + cmd->plen; in btintel_firmware_version()
1114 switch (ver->hw_variant) { in btintel_download_firmware()
1122 if (btintel_firmware_version(hdev, ver->fw_build_num, in btintel_download_firmware()
1123 ver->fw_build_ww, ver->fw_build_yy, in btintel_download_firmware()
1126 /* Return -EALREADY to indicate that the firmware has in btintel_download_firmware()
1129 return -EALREADY; in btintel_download_firmware()
1133 /* The firmware variant determines if the device is in bootloader in btintel_download_firmware()
1134 * mode or is running operational firmware. The value 0x06 identifies in btintel_download_firmware()
1135 * the bootloader and the value 0x23 identifies the operational in btintel_download_firmware()
1139 * to bootloader when operational so the new firmware can be loaded. in btintel_download_firmware()
1141 if (ver->fw_variant == 0x23) in btintel_download_firmware()
1142 return -EINVAL; in btintel_download_firmware()
1161 if (btintel_firmware_version(hdev, ver->min_fw_build_nn, in btintel_download_fw_tlv()
1162 ver->min_fw_build_cw, in btintel_download_fw_tlv()
1163 ver->min_fw_build_yy, in btintel_download_fw_tlv()
1166 /* Return -EALREADY to indicate that firmware has in btintel_download_fw_tlv()
1169 return -EALREADY; in btintel_download_fw_tlv()
1172 /* The firmware variant determines if the device is in bootloader in btintel_download_fw_tlv()
1173 * mode or is running operational firmware. The value 0x01 identifies in btintel_download_fw_tlv()
1174 * the bootloader and the value 0x03 identifies the operational in btintel_download_fw_tlv()
1178 * to bootloader when operational so the new firmware can be loaded. in btintel_download_fw_tlv()
1180 if (ver->img_type == BTINTEL_IMG_OP) in btintel_download_fw_tlv()
1181 return -EINVAL; in btintel_download_fw_tlv()
1195 css_header_ver = get_unaligned_le32(fw->data + CSS_HEADER_OFFSET); in btintel_download_fw_tlv()
1198 return -EINVAL; in btintel_download_fw_tlv()
1205 return -EINVAL; in btintel_download_fw_tlv()
1217 if (fw->data[ECDSA_OFFSET] != 0x06) in btintel_download_fw_tlv()
1218 return -EINVAL; in btintel_download_fw_tlv()
1221 css_header_ver = get_unaligned_le32(fw->data + ECDSA_OFFSET + CSS_HEADER_OFFSET); in btintel_download_fw_tlv()
1224 return -EINVAL; in btintel_download_fw_tlv()
1256 * re-enumeration of BT controller. in btintel_reset_to_bootloader()
1287 * lines for 2ms when it receives Intel Reset in bootloader mode. in btintel_reset_to_bootloader()
1300 /* Intel controller supports two pages, each page is of 128-bit in btintel_read_debug_features()
1311 if (skb->len != (sizeof(features->page1) + 3)) { in btintel_read_debug_features()
1314 return -EILSEQ; in btintel_read_debug_features()
1317 memcpy(features->page1, skb->data + 3, sizeof(features->page1)); in btintel_read_debug_features()
1336 return -EINVAL; in btintel_set_debug_features()
1339 if (!(features->page1[0] & 0x3f)) { in btintel_set_debug_features()
1384 return -EINVAL; in btintel_reset_debug_features()
1387 if (!(features->page1[0] & 0x3f)) { in btintel_reset_debug_features()
1484 return -EOPNOTSUPP; in btintel_register_devcoredump_support()
1500 "intel/ibt-hw-%x.%x.%x-fw-%x.%x.%x.%x.%x.bseq", in btintel_legacy_rom_get_fw()
1501 ver->hw_platform, ver->hw_variant, ver->hw_revision, in btintel_legacy_rom_get_fw()
1502 ver->fw_variant, ver->fw_revision, ver->fw_build_num, in btintel_legacy_rom_get_fw()
1503 ver->fw_build_ww, ver->fw_build_yy); in btintel_legacy_rom_get_fw()
1505 ret = request_firmware(&fw, fwname, &hdev->dev); in btintel_legacy_rom_get_fw()
1507 if (ret == -EINVAL) { in btintel_legacy_rom_get_fw()
1519 snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq", in btintel_legacy_rom_get_fw()
1520 ver->hw_platform, ver->hw_variant); in btintel_legacy_rom_get_fw()
1521 if (request_firmware(&fw, fwname, &hdev->dev) < 0) { in btintel_legacy_rom_get_fw()
1542 int remain = fw->size - (*fw_ptr - fw->data); in btintel_legacy_rom_patching()
1553 return -EINVAL; in btintel_legacy_rom_patching()
1556 remain--; in btintel_legacy_rom_patching()
1560 remain -= sizeof(*cmd); in btintel_legacy_rom_patching()
1565 if (remain < cmd->plen) { in btintel_legacy_rom_patching()
1567 return -EFAULT; in btintel_legacy_rom_patching()
1572 * disable the manufacturer mode, for example patch activation in btintel_legacy_rom_patching()
1576 if (*disable_patch && le16_to_cpu(cmd->opcode) == 0xfc8e) in btintel_legacy_rom_patching()
1580 *fw_ptr += cmd->plen; in btintel_legacy_rom_patching()
1581 remain -= cmd->plen; in btintel_legacy_rom_patching()
1592 remain--; in btintel_legacy_rom_patching()
1596 remain -= sizeof(*evt); in btintel_legacy_rom_patching()
1598 if (remain < evt->plen) { in btintel_legacy_rom_patching()
1600 return -EFAULT; in btintel_legacy_rom_patching()
1604 *fw_ptr += evt->plen; in btintel_legacy_rom_patching()
1605 remain -= evt->plen; in btintel_legacy_rom_patching()
1614 return -EFAULT; in btintel_legacy_rom_patching()
1617 skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen, in btintel_legacy_rom_patching()
1618 cmd_param, evt->evt, HCI_INIT_TIMEOUT); in btintel_legacy_rom_patching()
1621 cmd->opcode, PTR_ERR(skb)); in btintel_legacy_rom_patching()
1629 if (skb->len != evt->plen) { in btintel_legacy_rom_patching()
1631 le16_to_cpu(cmd->opcode)); in btintel_legacy_rom_patching()
1633 return -EFAULT; in btintel_legacy_rom_patching()
1636 if (memcmp(skb->data, evt_param, evt->plen)) { in btintel_legacy_rom_patching()
1638 le16_to_cpu(cmd->opcode)); in btintel_legacy_rom_patching()
1640 return -EFAULT; in btintel_legacy_rom_patching()
1655 BT_DBG("%s", hdev->name); in btintel_legacy_rom_setup()
1661 if (ver->fw_patch_num) { in btintel_legacy_rom_setup()
1664 ver->fw_patch_num); in btintel_legacy_rom_setup()
1677 fw_ptr = fw->data; in btintel_legacy_rom_setup()
1679 /* Enable the manufacturer mode of the controller. in btintel_legacy_rom_setup()
1680 * Only while this mode is enabled, the driver can download the in btintel_legacy_rom_setup()
1702 * the manufacturer mode is disabled with reset and activating the in btintel_legacy_rom_setup()
1705 * If the firmware patching fails, the manufacturer mode is in btintel_legacy_rom_setup()
1711 while (fw->size > fw_ptr - fw->data) { in btintel_legacy_rom_setup()
1725 /* Patching completed successfully and disable the manufacturer mode in btintel_legacy_rom_setup()
1733 * every power-on boot in btintel_legacy_rom_setup()
1745 /* Disable the manufacturer mode without reset */ in btintel_legacy_rom_setup()
1757 /* Patching failed. Disable the manufacturer mode with reset and in btintel_legacy_rom_setup()
1790 if (err == -EINTR) { in btintel_download_wait()
1797 return -ETIMEDOUT; in btintel_download_wait()
1802 return -ENOEXEC; in btintel_download_wait()
1825 if (err == -EINTR) { in btintel_boot_wait()
1827 return -EINTR; in btintel_boot_wait()
1832 return -ETIMEDOUT; in btintel_boot_wait()
1860 /* The bootloader will not indicate when the device is ready. This in btintel_boot()
1868 if (err == -ETIMEDOUT) in btintel_boot()
1879 switch (ver->hw_variant) { in btintel_get_fw_name()
1882 snprintf(fw_name, len, "intel/ibt-%u-%u.%s", in btintel_get_fw_name()
1883 ver->hw_variant, in btintel_get_fw_name()
1884 le16_to_cpu(params->dev_revid), in btintel_get_fw_name()
1891 snprintf(fw_name, len, "intel/ibt-%u-%u-%u.%s", in btintel_get_fw_name()
1892 ver->hw_variant, in btintel_get_fw_name()
1893 ver->hw_revision, in btintel_get_fw_name()
1894 ver->fw_revision, in btintel_get_fw_name()
1898 return -EINVAL; in btintel_get_fw_name()
1915 return -EINVAL; in btintel_download_fw()
1917 /* The firmware variant determines if the device is in bootloader in btintel_download_fw()
1918 * mode or is running operational firmware. The value 0x06 identifies in btintel_download_fw()
1919 * the bootloader and the value 0x23 identifies the operational in btintel_download_fw()
1928 * case since that command is only available in bootloader mode. in btintel_download_fw()
1930 if (ver->fw_variant == 0x23) { in btintel_download_fw()
1937 switch (ver->hw_variant) { in btintel_download_fw()
1948 * details of the bootloader. in btintel_download_fw()
1956 * that this bootloader does not send them, then abort the setup. in btintel_download_fw()
1958 if (params->limited_cce != 0x00) { in btintel_download_fw()
1960 params->limited_cce); in btintel_download_fw()
1961 return -EINVAL; in btintel_download_fw()
1967 if (!bacmp(¶ms->otp_bdaddr, BDADDR_ANY)) { in btintel_download_fw()
1969 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_download_fw()
1973 /* With this Intel bootloader only the hardware variant and device in btintel_download_fw()
1977 * The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi. in btintel_download_fw()
1991 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi. in btintel_download_fw()
2003 return -EINVAL; in btintel_download_fw()
2006 err = firmware_request_nowarn(&fw, fwname, &hdev->dev); in btintel_download_fw()
2021 if (fw->size < 644) { in btintel_download_fw()
2023 fw->size); in btintel_download_fw()
2024 err = -EBADF; in btintel_download_fw()
2035 if (err == -EALREADY) { in btintel_download_fw()
2049 /* Before switching the device into operational mode and with that in btintel_download_fw()
2050 * booting the loaded firmware, wait for the bootloader notification in btintel_download_fw()
2061 if (err == -ETIMEDOUT) in btintel_download_fw()
2078 BT_DBG("%s", hdev->name); in btintel_bootloader_setup()
2093 if (ver->fw_variant == 0x23) in btintel_bootloader_setup()
2108 /* Once the device is running in operational mode, it needs to in btintel_bootloader_setup()
2146 cnvi = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), in btintel_get_fw_name_tlv()
2147 INTEL_CNVX_TOP_STEP(ver->cnvi_top)); in btintel_get_fw_name_tlv()
2149 cnvr = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), in btintel_get_fw_name_tlv()
2150 INTEL_CNVX_TOP_STEP(ver->cnvr_top)); in btintel_get_fw_name_tlv()
2155 if (INTEL_HW_VARIANT(ver->cnvi_bt) >= 0x1e) { in btintel_get_fw_name_tlv()
2158 if (ver->img_type == BTINTEL_IMG_BOOTLOADER) { in btintel_get_fw_name_tlv()
2159 format = "intel/ibt-%04x-%04x-iml.%s"; in btintel_get_fw_name_tlv()
2166 /* ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step-fw_id> */ in btintel_get_fw_name_tlv()
2167 if (memcmp(ver->fw_id, zero, sizeof(zero))) { in btintel_get_fw_name_tlv()
2168 format = "intel/ibt-%04x-%04x-%s.%s"; in btintel_get_fw_name_tlv()
2170 ver->fw_id, suffix); in btintel_get_fw_name_tlv()
2178 * ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step> in btintel_get_fw_name_tlv()
2180 format = "intel/ibt-%04x-%04x.%s"; in btintel_get_fw_name_tlv()
2191 cnvi = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), in btintel_get_iml_tlv()
2192 INTEL_CNVX_TOP_STEP(ver->cnvi_top)); in btintel_get_iml_tlv()
2194 cnvr = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), in btintel_get_iml_tlv()
2195 INTEL_CNVX_TOP_STEP(ver->cnvr_top)); in btintel_get_iml_tlv()
2197 format = "intel/ibt-%04x-%04x-iml.%s"; in btintel_get_iml_tlv()
2211 return -EINVAL; in btintel_prepare_fw_download_tlv()
2213 /* The firmware variant determines if the device is in bootloader in btintel_prepare_fw_download_tlv()
2214 * mode or is running operational firmware. The value 0x03 identifies in btintel_prepare_fw_download_tlv()
2215 * the bootloader and the value 0x23 identifies the operational in btintel_prepare_fw_download_tlv()
2224 * case since that command is only available in bootloader mode. in btintel_prepare_fw_download_tlv()
2226 if (ver->img_type == BTINTEL_IMG_OP) { in btintel_prepare_fw_download_tlv()
2231 * Check for valid bd address in boot loader mode. Device in btintel_prepare_fw_download_tlv()
2235 if (!bacmp(&ver->otp_bd_addr, BDADDR_ANY)) { in btintel_prepare_fw_download_tlv()
2237 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_prepare_fw_download_tlv()
2241 if (ver->img_type == BTINTEL_IMG_OP) { in btintel_prepare_fw_download_tlv()
2247 if (INTEL_HW_VARIANT(ver->cnvi_bt) >= 0x1e) in btintel_prepare_fw_download_tlv()
2255 err = firmware_request_nowarn(&fw, fwname, &hdev->dev); in btintel_prepare_fw_download_tlv()
2271 if (fw->size < 644) { in btintel_prepare_fw_download_tlv()
2273 fw->size); in btintel_prepare_fw_download_tlv()
2274 err = -EBADF; in btintel_prepare_fw_download_tlv()
2284 INTEL_HW_VARIANT(ver->cnvi_bt), in btintel_prepare_fw_download_tlv()
2285 ver->sbe_type); in btintel_prepare_fw_download_tlv()
2287 if (err == -EALREADY) { in btintel_prepare_fw_download_tlv()
2301 /* Before switching the device into operational mode and with that in btintel_prepare_fw_download_tlv()
2302 * booting the loaded firmware, wait for the bootloader notification in btintel_prepare_fw_download_tlv()
2313 if (err == -ETIMEDOUT) in btintel_prepare_fw_download_tlv()
2328 return -EINVAL; in btintel_get_codec_config_data()
2335 return -EINVAL; in btintel_get_codec_config_data()
2340 err = -ENOMEM; in btintel_get_codec_config_data()
2345 switch (codec->id) { in btintel_get_codec_config_data()
2353 err = -EINVAL; in btintel_get_codec_config_data()
2354 bt_dev_err(hdev, "Invalid codec id(%u)", codec->id); in btintel_get_codec_config_data()
2357 /* codec and its capabilities are pre-defined to ids in btintel_get_codec_config_data()
2390 if (skb->len < sizeof(*use_cases)) { in btintel_configure_offload()
2391 err = -EIO; in btintel_configure_offload()
2395 use_cases = (void *)skb->data; in btintel_configure_offload()
2397 if (use_cases->status) { in btintel_configure_offload()
2398 err = -bt_to_errno(skb->data[0]); in btintel_configure_offload()
2402 if (use_cases->preset[0] & 0x03) { in btintel_configure_offload()
2403 hdev->get_data_path_id = btintel_get_data_path_id; in btintel_configure_offload()
2404 hdev->get_codec_config_data = btintel_get_codec_config_data; in btintel_configure_offload()
2418 u32 domain, mode; in btintel_set_ppag() local
2422 switch (ver->cnvr_top & 0xFFF) { in btintel_set_ppag()
2427 ver->cnvr_top & 0xFFF); in btintel_set_ppag()
2440 bt_dev_dbg(hdev, "PPAG-BT: ACPI entry not found"); in btintel_set_ppag()
2443 bt_dev_warn(hdev, "PPAG-BT: ACPI Failure: %s", acpi_format_exception(status)); in btintel_set_ppag()
2448 if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) { in btintel_set_ppag()
2449 bt_dev_warn(hdev, "PPAG-BT: Invalid object type: %d or package count: %d", in btintel_set_ppag()
2450 p->type, p->package.count); in btintel_set_ppag()
2455 elements = p->package.elements; in btintel_set_ppag()
2460 domain = (u32)p->package.elements[0].integer.value; in btintel_set_ppag()
2461 mode = (u32)p->package.elements[1].integer.value; in btintel_set_ppag()
2465 bt_dev_dbg(hdev, "PPAG-BT: Bluetooth domain is disabled in ACPI firmware"); in btintel_set_ppag()
2469 /* PPAG mode in btintel_set_ppag()
2475 mode &= 0x03; in btintel_set_ppag()
2477 if (!mode) { in btintel_set_ppag()
2478 bt_dev_dbg(hdev, "PPAG-BT: EU, China mode are disabled in BIOS"); in btintel_set_ppag()
2482 ppag_cmd.ppag_enable_flags = cpu_to_le32(mode); in btintel_set_ppag()
2490 bt_dev_info(hdev, "PPAG-BT: Enabled (Mode %d)", mode); in btintel_set_ppag()
2504 ret = -ENODEV; in btintel_acpi_reset_method()
2509 if (p->package.count != 1 || p->type != ACPI_TYPE_PACKAGE) { in btintel_acpi_reset_method()
2511 ret = -EINVAL; in btintel_acpi_reset_method()
2515 ref = &p->package.elements[0]; in btintel_acpi_reset_method()
2516 if (ref->type != ACPI_TYPE_LOCAL_REFERENCE) { in btintel_acpi_reset_method()
2517 bt_dev_err(hdev, "Invalid object type: 0x%x", ref->type); in btintel_acpi_reset_method()
2518 ret = -EINVAL; in btintel_acpi_reset_method()
2522 status = acpi_evaluate_object(ref->reference.handle, "_RST", NULL, NULL); in btintel_acpi_reset_method()
2525 ret = -ENODEV; in btintel_acpi_reset_method()
2558 switch (ver_tlv->cnvi_top & 0xfff) { in btintel_set_dsm_reset_method()
2601 data->acpi_reset_method = btintel_acpi_reset_method; in btintel_set_dsm_reset_method()
2613 __u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle); in btintel_classify_pkt_type()
2633 * header - defines revision number of the structure
2634 * dsbr - defines drive strength BRI response
2636 * 0 - instructs bluetooth firmware to use default values
2637 * 1 - instructs bluetooth firmware to override default values
2645 * 1. 0xF1 - indicates that the resistor on board is 33 Ohm
2646 * 2. 0x00 or 0xB1 - indicates that the resistor on board is 10 Ohm
2647 * 3. Non existing UEFI variable or invalid (none of the above) - indicates
2666 return -EOPNOTSUPP; in btintel_uefi_get_dsbr()
2669 return -EOPNOTSUPP; in btintel_uefi_get_dsbr()
2675 return -EIO; in btintel_uefi_get_dsbr()
2681 return -ENXIO; in btintel_uefi_get_dsbr()
2704 apply_dsbr = (ver->img_type == BTINTEL_IMG_IML && in btintel_set_dsbr()
2705 ((ver->cnvi_top & 0xfff) == BTINTEL_CNVI_BLAZARI) && in btintel_set_dsbr()
2706 INTEL_CNVX_TOP_STEP(ver->cnvi_top) == 0x01); in btintel_set_dsbr()
2725 return -bt_to_errno(PTR_ERR(skb)); in btintel_set_dsbr()
2727 status = skb->data[0]; in btintel_set_dsbr()
2731 return -bt_to_errno(status); in btintel_set_dsbr()
2759 if (ver->img_type == BTINTEL_IMG_OP) in btintel_bootloader_setup_tlv()
2780 if (ver->img_type == BTINTEL_IMG_IML) { in btintel_bootloader_setup_tlv()
2793 /* Once the device is running in operational mode, it needs to in btintel_bootloader_setup_tlv()
2833 /* Legacy bootloader devices that supports MSFT Extension */ in btintel_set_msft_opcode()
2871 if (skb->len < (sizeof(u32) * 16 + 2)) { in btintel_print_fseq_info()
2873 skb->len); in btintel_print_fseq_info()
2918 p = skb->data; in btintel_print_fseq_info()
2923 p = skb->data; in btintel_print_fseq_info()
2979 BT_DBG("%s", hdev->name); in btintel_setup_combined()
3022 if (skb->data[0]) { in btintel_setup_combined()
3024 skb->data[0]); in btintel_setup_combined()
3025 err = -EIO; in btintel_setup_combined()
3030 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); in btintel_setup_combined()
3031 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); in btintel_setup_combined()
3032 set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks); in btintel_setup_combined()
3035 hdev->set_quality_report = btintel_set_quality_report; in btintel_setup_combined()
3038 if (skb->len == sizeof(ver) && skb->data[1] == 0x37) { in btintel_setup_combined()
3041 memcpy(&ver, skb->data, sizeof(ver)); in btintel_setup_combined()
3061 * WBS for SdP - For the Legacy ROM products, only SdP in btintel_setup_combined()
3071 &hdev->quirks); in btintel_setup_combined()
3084 * All Legacy bootloader devices support WBS in btintel_setup_combined()
3087 &hdev->quirks); in btintel_setup_combined()
3090 set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks); in btintel_setup_combined()
3101 err = -EINVAL; in btintel_setup_combined()
3113 * to bootloader mode and are not populated in operational mode in btintel_setup_combined()
3126 err = -EINVAL; in btintel_setup_combined()
3142 /* Some legacy bootloader devices starting from JfP, in btintel_setup_combined()
3148 * be used because the firmware filename for legacy bootloader in btintel_setup_combined()
3156 * run the legacy bootloader setup. in btintel_setup_combined()
3164 * All Legacy bootloader devices support WBS in btintel_setup_combined()
3166 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); in btintel_setup_combined()
3169 set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks); in btintel_setup_combined()
3179 /* Re-classify packet type for controllers with LE audio */ in btintel_setup_combined()
3180 hdev->classify_pkt_type = btintel_classify_pkt_type; in btintel_setup_combined()
3194 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); in btintel_setup_combined()
3211 err = -EINVAL; in btintel_setup_combined()
3263 hdev->manufacturer = 2; in btintel_configure_setup()
3264 hdev->setup = btintel_setup_combined; in btintel_configure_setup()
3265 hdev->shutdown = btintel_shutdown_combined; in btintel_configure_setup()
3266 hdev->hw_error = btintel_hw_error; in btintel_configure_setup()
3267 hdev->set_diag = btintel_set_diag_combined; in btintel_configure_setup()
3268 hdev->set_bdaddr = btintel_set_bdaddr; in btintel_configure_setup()
3278 struct intel_tlv *tlv = (void *)&skb->data[5]; in btintel_diagnostics()
3281 if (tlv->type != INTEL_TLV_TYPE_ID) in btintel_diagnostics()
3284 switch (tlv->val[0]) { in btintel_diagnostics()
3290 if (!hci_devcd_init(hdev, skb->len)) { in btintel_diagnostics()
3298 bt_dev_err(hdev, "Invalid exception type %02X", tlv->val[0]); in btintel_diagnostics()
3307 struct hci_event_hdr *hdr = (void *)skb->data; in btintel_recv_event()
3310 if (skb->len > HCI_EVENT_HDR_SIZE && hdr->evt == 0xff && in btintel_recv_event()
3311 hdr->plen > 0) { in btintel_recv_event()
3312 const void *ptr = skb->data + HCI_EVENT_HDR_SIZE + 1; in btintel_recv_event()
3313 unsigned int len = skb->len - HCI_EVENT_HDR_SIZE - 1; in btintel_recv_event()
3316 switch (skb->data[2]) { in btintel_recv_event()
3339 memcmp(&skb->data[2], diagnostics_hdr, in btintel_recv_event()
3369 if (evt->result) in btintel_secure_send_result()
3382 MODULE_FIRMWARE("intel/ibt-11-5.sfi");
3383 MODULE_FIRMWARE("intel/ibt-11-5.ddc");
3384 MODULE_FIRMWARE("intel/ibt-12-16.sfi");
3385 MODULE_FIRMWARE("intel/ibt-12-16.ddc");