Lines Matching +full:mode +full:- +full:bootloader
1 // SPDX-License-Identifier: GPL-2.0-or-later
66 if (skb->len != sizeof(*bda)) { in btintel_check_bdaddr()
69 return -EIO; in btintel_check_bdaddr()
72 bda = (struct hci_rp_read_bd_addr *)skb->data; in btintel_check_bdaddr()
79 if (!bacmp(&bda->bdaddr, BDADDR_INTEL)) { in btintel_check_bdaddr()
81 &bda->bdaddr); in btintel_check_bdaddr()
82 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_check_bdaddr()
98 bt_dev_err(hdev, "Entering manufacturer mode failed (%ld)", in btintel_enter_mfg()
114 * 0x00: Just disable the manufacturing mode (0x00). in btintel_exit_mfg()
115 * 0x01: Disable manufacturing mode and reset with patches deactivated. in btintel_exit_mfg()
116 * 0x02: Disable manufacturing mode and reset with patches activated. in btintel_exit_mfg()
123 bt_dev_err(hdev, "Exiting manufacturer mode failed (%ld)", in btintel_exit_mfg()
190 if (err == -ENODATA) in btintel_set_diag()
192 bt_dev_err(hdev, "Changing Intel diagnostic mode failed (%d)", in btintel_set_diag()
225 /* Legacy ROM device needs to be in the manufacturer mode to apply in btintel_set_diag_combined()
260 if (skb->len != 13) { in btintel_hw_error()
266 bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1)); in btintel_hw_error()
278 if (ver->hw_platform != 0x37) { in btintel_version_info()
280 ver->hw_platform); in btintel_version_info()
281 return -EINVAL; in btintel_version_info()
290 switch (ver->hw_variant) { in btintel_version_info()
291 case 0x07: /* WP - Legacy ROM */ in btintel_version_info()
292 case 0x08: /* StP - Legacy ROM */ in btintel_version_info()
302 ver->hw_variant); in btintel_version_info()
303 return -EINVAL; in btintel_version_info()
306 switch (ver->fw_variant) { in btintel_version_info()
311 variant = "Bootloader"; in btintel_version_info()
320 bt_dev_err(hdev, "Unsupported firmware variant(%02x)", ver->fw_variant); in btintel_version_info()
321 return -EINVAL; in btintel_version_info()
324 coredump_info.hw_variant = ver->hw_variant; in btintel_version_info()
325 coredump_info.fw_build_num = ver->fw_build_num; in btintel_version_info()
328 variant, ver->fw_revision >> 4, ver->fw_revision & 0x0f, in btintel_version_info()
329 ver->fw_build_num, ver->fw_build_ww, in btintel_version_info()
330 2000 + ver->fw_build_yy); in btintel_version_info()
353 plen -= fragment_len; in btintel_secure_send()
367 err = request_firmware_direct(&fw, ddc_name, &hdev->dev); in btintel_load_ddc_config()
376 fw_ptr = fw->data; in btintel_load_ddc_config()
379 * Length (1 byte), DDC ID (2 bytes), and DDC value (Length - 2). in btintel_load_ddc_config()
381 while (fw->size > fw_ptr - fw->data) { in btintel_load_ddc_config()
434 if (!skb || skb->len != sizeof(*ver)) { in btintel_read_version()
437 return -EILSEQ; in btintel_read_version()
440 memcpy(ver, skb->data, sizeof(*ver)); in btintel_read_version()
456 if (INTEL_HW_PLATFORM(version->cnvi_bt) != 0x37) { in btintel_version_info_tlv()
458 INTEL_HW_PLATFORM(version->cnvi_bt)); in btintel_version_info_tlv()
459 return -EINVAL; in btintel_version_info_tlv()
468 switch (INTEL_HW_VARIANT(version->cnvi_bt)) { in btintel_version_info_tlv()
471 case 0x19: /* Slr-F */ in btintel_version_info_tlv()
477 INTEL_HW_VARIANT(version->cnvi_bt)); in btintel_version_info_tlv()
478 return -EINVAL; in btintel_version_info_tlv()
481 switch (version->img_type) { in btintel_version_info_tlv()
483 variant = "Bootloader"; in btintel_version_info_tlv()
486 * that this bootloader does not send them, then abort the setup. in btintel_version_info_tlv()
488 if (version->limited_cce != 0x00) { in btintel_version_info_tlv()
490 version->limited_cce); in btintel_version_info_tlv()
491 return -EINVAL; in btintel_version_info_tlv()
495 if (version->sbe_type > 0x01) { in btintel_version_info_tlv()
497 version->sbe_type); in btintel_version_info_tlv()
498 return -EINVAL; in btintel_version_info_tlv()
501 bt_dev_info(hdev, "Device revision is %u", version->dev_rev_id); in btintel_version_info_tlv()
503 version->secure_boot ? "enabled" : "disabled"); in btintel_version_info_tlv()
505 version->otp_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
507 version->api_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
509 version->debug_lock ? "enabled" : "disabled"); in btintel_version_info_tlv()
511 version->min_fw_build_nn, version->min_fw_build_cw, in btintel_version_info_tlv()
512 2000 + version->min_fw_build_yy); in btintel_version_info_tlv()
518 bt_dev_err(hdev, "Unsupported image type(%02x)", version->img_type); in btintel_version_info_tlv()
519 return -EINVAL; in btintel_version_info_tlv()
522 coredump_info.hw_variant = INTEL_HW_VARIANT(version->cnvi_bt); in btintel_version_info_tlv()
523 coredump_info.fw_build_num = version->build_num; in btintel_version_info_tlv()
526 2000 + (version->timestamp >> 8), version->timestamp & 0xff, in btintel_version_info_tlv()
527 version->build_type, version->build_num); in btintel_version_info_tlv()
544 while (skb->len) { in btintel_parse_version_tlv()
548 if (skb->len < sizeof(*tlv)) in btintel_parse_version_tlv()
549 return -EINVAL; in btintel_parse_version_tlv()
551 tlv = (struct intel_tlv *)skb->data; in btintel_parse_version_tlv()
554 if (skb->len < tlv->len + sizeof(*tlv)) in btintel_parse_version_tlv()
555 return -EINVAL; in btintel_parse_version_tlv()
557 switch (tlv->type) { in btintel_parse_version_tlv()
559 version->cnvi_top = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
562 version->cnvr_top = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
565 version->cnvi_bt = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
568 version->cnvr_bt = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
571 version->dev_rev_id = get_unaligned_le16(tlv->val); in btintel_parse_version_tlv()
574 version->img_type = tlv->val[0]; in btintel_parse_version_tlv()
581 version->min_fw_build_cw = tlv->val[0]; in btintel_parse_version_tlv()
582 version->min_fw_build_yy = tlv->val[1]; in btintel_parse_version_tlv()
583 version->timestamp = get_unaligned_le16(tlv->val); in btintel_parse_version_tlv()
586 version->build_type = tlv->val[0]; in btintel_parse_version_tlv()
593 version->min_fw_build_nn = tlv->val[0]; in btintel_parse_version_tlv()
594 version->build_num = get_unaligned_le32(tlv->val); in btintel_parse_version_tlv()
597 version->secure_boot = tlv->val[0]; in btintel_parse_version_tlv()
600 version->otp_lock = tlv->val[0]; in btintel_parse_version_tlv()
603 version->api_lock = tlv->val[0]; in btintel_parse_version_tlv()
606 version->debug_lock = tlv->val[0]; in btintel_parse_version_tlv()
609 version->min_fw_build_nn = tlv->val[0]; in btintel_parse_version_tlv()
610 version->min_fw_build_cw = tlv->val[1]; in btintel_parse_version_tlv()
611 version->min_fw_build_yy = tlv->val[2]; in btintel_parse_version_tlv()
614 version->limited_cce = tlv->val[0]; in btintel_parse_version_tlv()
617 version->sbe_type = tlv->val[0]; in btintel_parse_version_tlv()
620 memcpy(&version->otp_bd_addr, tlv->val, in btintel_parse_version_tlv()
628 skb_pull(skb, tlv->len + sizeof(*tlv)); in btintel_parse_version_tlv()
641 return -EINVAL; in btintel_read_version_tlv()
650 if (skb->data[0]) { in btintel_read_version_tlv()
652 skb->data[0]); in btintel_read_version_tlv()
654 return -EIO; in btintel_read_version_tlv()
663 /* ------- REGMAP IBT SUPPORT ------- */
677 __u8 mode; member
698 return -EINVAL; in regmap_ibt_read()
702 cp.mode = IBT_REG_MODE_8BIT; in regmap_ibt_read()
705 cp.mode = IBT_REG_MODE_16BIT; in regmap_ibt_read()
708 cp.mode = IBT_REG_MODE_32BIT; in regmap_ibt_read()
711 return -EINVAL; in regmap_ibt_read()
714 /* regmap provides a little-endian formatted addr */ in regmap_ibt_read()
718 bt_dev_dbg(ctx->hdev, "Register (0x%x) read", le32_to_cpu(cp.addr)); in regmap_ibt_read()
720 skb = hci_cmd_sync(ctx->hdev, ctx->op_read, sizeof(cp), &cp, in regmap_ibt_read()
724 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error (%d)", in regmap_ibt_read()
729 if (skb->len != sizeof(*rp) + val_size) { in regmap_ibt_read()
730 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error, bad len", in regmap_ibt_read()
732 err = -EINVAL; in regmap_ibt_read()
736 rp = (struct ibt_rp_reg_access *)skb->data; in regmap_ibt_read()
738 if (rp->addr != cp.addr) { in regmap_ibt_read()
739 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) read error, bad addr", in regmap_ibt_read()
740 le32_to_cpu(rp->addr)); in regmap_ibt_read()
741 err = -EINVAL; in regmap_ibt_read()
745 memcpy(val, rp->data, val_size); in regmap_ibt_read()
760 u8 mode; in regmap_ibt_gather_write() local
764 return -EINVAL; in regmap_ibt_gather_write()
768 mode = IBT_REG_MODE_8BIT; in regmap_ibt_gather_write()
771 mode = IBT_REG_MODE_16BIT; in regmap_ibt_gather_write()
774 mode = IBT_REG_MODE_32BIT; in regmap_ibt_gather_write()
777 return -EINVAL; in regmap_ibt_gather_write()
782 return -ENOMEM; in regmap_ibt_gather_write()
784 /* regmap provides a little-endian formatted addr/value */ in regmap_ibt_gather_write()
785 cp->addr = *(__le32 *)addr; in regmap_ibt_gather_write()
786 cp->mode = mode; in regmap_ibt_gather_write()
787 cp->len = val_size; in regmap_ibt_gather_write()
788 memcpy(&cp->data, val, val_size); in regmap_ibt_gather_write()
790 bt_dev_dbg(ctx->hdev, "Register (0x%x) write", le32_to_cpu(cp->addr)); in regmap_ibt_gather_write()
792 skb = hci_cmd_sync(ctx->hdev, ctx->op_write, plen, cp, HCI_CMD_TIMEOUT); in regmap_ibt_gather_write()
795 bt_dev_err(ctx->hdev, "regmap: Register (0x%x) write error (%d)", in regmap_ibt_gather_write()
796 le32_to_cpu(cp->addr), err); in regmap_ibt_gather_write()
812 return -EINVAL; in regmap_ibt_write()
814 return regmap_ibt_gather_write(context, data, 4, data + 4, count - 4); in regmap_ibt_write()
843 bt_dev_info(hdev, "regmap: Init R%x-W%x region", opcode_read, in btintel_regmap_init()
848 return ERR_PTR(-ENOMEM); in btintel_regmap_init()
850 ctx->op_read = opcode_read; in btintel_regmap_init()
851 ctx->op_write = opcode_write; in btintel_regmap_init()
852 ctx->hdev = hdev; in btintel_regmap_init()
854 return regmap_init(&hdev->dev, ®map_ibt, ctx, ®map_ibt_cfg); in btintel_regmap_init()
890 if (skb->len != sizeof(*params)) { in btintel_read_boot_params()
893 return -EILSEQ; in btintel_read_boot_params()
896 memcpy(params, skb->data, sizeof(*params)); in btintel_read_boot_params()
900 if (params->status) { in btintel_read_boot_params()
902 params->status); in btintel_read_boot_params()
903 return -bt_to_errno(params->status); in btintel_read_boot_params()
907 le16_to_cpu(params->dev_revid)); in btintel_read_boot_params()
910 params->secure_boot ? "enabled" : "disabled"); in btintel_read_boot_params()
913 params->otp_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
916 params->api_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
919 params->debug_lock ? "enabled" : "disabled"); in btintel_read_boot_params()
922 params->min_fw_build_nn, params->min_fw_build_cw, in btintel_read_boot_params()
923 2000 + params->min_fw_build_yy); in btintel_read_boot_params()
937 err = btintel_secure_send(hdev, 0x00, 128, fw->data); in btintel_sfi_rsa_header_secure_send()
946 err = btintel_secure_send(hdev, 0x03, 256, fw->data + 128); in btintel_sfi_rsa_header_secure_send()
955 err = btintel_secure_send(hdev, 0x02, 256, fw->data + 388); in btintel_sfi_rsa_header_secure_send()
973 err = btintel_secure_send(hdev, 0x00, 128, fw->data + 644); in btintel_sfi_ecdsa_header_secure_send()
982 err = btintel_secure_send(hdev, 0x03, 96, fw->data + 644 + 128); in btintel_sfi_ecdsa_header_secure_send()
991 err = btintel_secure_send(hdev, 0x02, 96, fw->data + 644 + 224); in btintel_sfi_ecdsa_header_secure_send()
1008 fw_ptr = fw->data + offset; in btintel_download_firmware_payload()
1010 err = -EINVAL; in btintel_download_firmware_payload()
1012 while (fw_ptr - fw->data < fw->size) { in btintel_download_firmware_payload()
1015 frag_len += sizeof(*cmd) + cmd->plen; in btintel_download_firmware_payload()
1050 fw_ptr = fw->data; in btintel_firmware_version()
1052 while (fw_ptr - fw->data < fw->size) { in btintel_firmware_version()
1060 if (le16_to_cpu(cmd->opcode) == CMD_WRITE_BOOT_PARAMS) { in btintel_firmware_version()
1065 *boot_addr = le32_to_cpu(params->boot_addr); in btintel_firmware_version()
1069 bt_dev_info(hdev, "Firmware Version: %u-%u.%u", in btintel_firmware_version()
1070 params->fw_build_num, params->fw_build_ww, in btintel_firmware_version()
1071 params->fw_build_yy); in btintel_firmware_version()
1073 return (num == params->fw_build_num && in btintel_firmware_version()
1074 ww == params->fw_build_ww && in btintel_firmware_version()
1075 yy == params->fw_build_yy); in btintel_firmware_version()
1078 fw_ptr += sizeof(*cmd) + cmd->plen; in btintel_firmware_version()
1094 switch (ver->hw_variant) { in btintel_download_firmware()
1102 if (btintel_firmware_version(hdev, ver->fw_build_num, in btintel_download_firmware()
1103 ver->fw_build_ww, ver->fw_build_yy, in btintel_download_firmware()
1106 /* Return -EALREADY to indicate that the firmware has in btintel_download_firmware()
1109 return -EALREADY; in btintel_download_firmware()
1113 /* The firmware variant determines if the device is in bootloader in btintel_download_firmware()
1114 * mode or is running operational firmware. The value 0x06 identifies in btintel_download_firmware()
1115 * the bootloader and the value 0x23 identifies the operational in btintel_download_firmware()
1119 * to bootloader when operational so the new firmware can be loaded. in btintel_download_firmware()
1121 if (ver->fw_variant == 0x23) in btintel_download_firmware()
1122 return -EINVAL; in btintel_download_firmware()
1141 if (btintel_firmware_version(hdev, ver->min_fw_build_nn, in btintel_download_fw_tlv()
1142 ver->min_fw_build_cw, in btintel_download_fw_tlv()
1143 ver->min_fw_build_yy, in btintel_download_fw_tlv()
1146 /* Return -EALREADY to indicate that firmware has in btintel_download_fw_tlv()
1149 return -EALREADY; in btintel_download_fw_tlv()
1152 /* The firmware variant determines if the device is in bootloader in btintel_download_fw_tlv()
1153 * mode or is running operational firmware. The value 0x01 identifies in btintel_download_fw_tlv()
1154 * the bootloader and the value 0x03 identifies the operational in btintel_download_fw_tlv()
1158 * to bootloader when operational so the new firmware can be loaded. in btintel_download_fw_tlv()
1160 if (ver->img_type == 0x03) in btintel_download_fw_tlv()
1161 return -EINVAL; in btintel_download_fw_tlv()
1175 css_header_ver = get_unaligned_le32(fw->data + CSS_HEADER_OFFSET); in btintel_download_fw_tlv()
1178 return -EINVAL; in btintel_download_fw_tlv()
1185 return -EINVAL; in btintel_download_fw_tlv()
1197 if (fw->data[ECDSA_OFFSET] != 0x06) in btintel_download_fw_tlv()
1198 return -EINVAL; in btintel_download_fw_tlv()
1201 css_header_ver = get_unaligned_le32(fw->data + ECDSA_OFFSET + CSS_HEADER_OFFSET); in btintel_download_fw_tlv()
1204 return -EINVAL; in btintel_download_fw_tlv()
1236 * re-enumeration of BT controller. in btintel_reset_to_bootloader()
1267 * lines for 2ms when it receives Intel Reset in bootloader mode. in btintel_reset_to_bootloader()
1280 /* Intel controller supports two pages, each page is of 128-bit in btintel_read_debug_features()
1291 if (skb->len != (sizeof(features->page1) + 3)) { in btintel_read_debug_features()
1294 return -EILSEQ; in btintel_read_debug_features()
1297 memcpy(features->page1, skb->data + 3, sizeof(features->page1)); in btintel_read_debug_features()
1316 return -EINVAL; in btintel_set_debug_features()
1319 if (!(features->page1[0] & 0x3f)) { in btintel_set_debug_features()
1364 return -EINVAL; in btintel_reset_debug_features()
1367 if (!(features->page1[0] & 0x3f)) { in btintel_reset_debug_features()
1464 return -EOPNOTSUPP; in btintel_register_devcoredump_support()
1480 "intel/ibt-hw-%x.%x.%x-fw-%x.%x.%x.%x.%x.bseq", in btintel_legacy_rom_get_fw()
1481 ver->hw_platform, ver->hw_variant, ver->hw_revision, in btintel_legacy_rom_get_fw()
1482 ver->fw_variant, ver->fw_revision, ver->fw_build_num, in btintel_legacy_rom_get_fw()
1483 ver->fw_build_ww, ver->fw_build_yy); in btintel_legacy_rom_get_fw()
1485 ret = request_firmware(&fw, fwname, &hdev->dev); in btintel_legacy_rom_get_fw()
1487 if (ret == -EINVAL) { in btintel_legacy_rom_get_fw()
1499 snprintf(fwname, sizeof(fwname), "intel/ibt-hw-%x.%x.bseq", in btintel_legacy_rom_get_fw()
1500 ver->hw_platform, ver->hw_variant); in btintel_legacy_rom_get_fw()
1501 if (request_firmware(&fw, fwname, &hdev->dev) < 0) { in btintel_legacy_rom_get_fw()
1522 int remain = fw->size - (*fw_ptr - fw->data); in btintel_legacy_rom_patching()
1533 return -EINVAL; in btintel_legacy_rom_patching()
1536 remain--; in btintel_legacy_rom_patching()
1540 remain -= sizeof(*cmd); in btintel_legacy_rom_patching()
1545 if (remain < cmd->plen) { in btintel_legacy_rom_patching()
1547 return -EFAULT; in btintel_legacy_rom_patching()
1552 * disable the manufacturer mode, for example patch activation in btintel_legacy_rom_patching()
1556 if (*disable_patch && le16_to_cpu(cmd->opcode) == 0xfc8e) in btintel_legacy_rom_patching()
1560 *fw_ptr += cmd->plen; in btintel_legacy_rom_patching()
1561 remain -= cmd->plen; in btintel_legacy_rom_patching()
1572 remain--; in btintel_legacy_rom_patching()
1576 remain -= sizeof(*evt); in btintel_legacy_rom_patching()
1578 if (remain < evt->plen) { in btintel_legacy_rom_patching()
1580 return -EFAULT; in btintel_legacy_rom_patching()
1584 *fw_ptr += evt->plen; in btintel_legacy_rom_patching()
1585 remain -= evt->plen; in btintel_legacy_rom_patching()
1594 return -EFAULT; in btintel_legacy_rom_patching()
1597 skb = __hci_cmd_sync_ev(hdev, le16_to_cpu(cmd->opcode), cmd->plen, in btintel_legacy_rom_patching()
1598 cmd_param, evt->evt, HCI_INIT_TIMEOUT); in btintel_legacy_rom_patching()
1601 cmd->opcode, PTR_ERR(skb)); in btintel_legacy_rom_patching()
1609 if (skb->len != evt->plen) { in btintel_legacy_rom_patching()
1611 le16_to_cpu(cmd->opcode)); in btintel_legacy_rom_patching()
1613 return -EFAULT; in btintel_legacy_rom_patching()
1616 if (memcmp(skb->data, evt_param, evt->plen)) { in btintel_legacy_rom_patching()
1618 le16_to_cpu(cmd->opcode)); in btintel_legacy_rom_patching()
1620 return -EFAULT; in btintel_legacy_rom_patching()
1635 BT_DBG("%s", hdev->name); in btintel_legacy_rom_setup()
1641 if (ver->fw_patch_num) { in btintel_legacy_rom_setup()
1644 ver->fw_patch_num); in btintel_legacy_rom_setup()
1657 fw_ptr = fw->data; in btintel_legacy_rom_setup()
1659 /* Enable the manufacturer mode of the controller. in btintel_legacy_rom_setup()
1660 * Only while this mode is enabled, the driver can download the in btintel_legacy_rom_setup()
1682 * the manufacturer mode is disabled with reset and activating the in btintel_legacy_rom_setup()
1685 * If the firmware patching fails, the manufacturer mode is in btintel_legacy_rom_setup()
1691 while (fw->size > fw_ptr - fw->data) { in btintel_legacy_rom_setup()
1705 /* Patching completed successfully and disable the manufacturer mode in btintel_legacy_rom_setup()
1713 * every power-on boot in btintel_legacy_rom_setup()
1725 /* Disable the manufacturer mode without reset */ in btintel_legacy_rom_setup()
1737 /* Patching failed. Disable the manufacturer mode with reset and in btintel_legacy_rom_setup()
1770 if (err == -EINTR) { in btintel_download_wait()
1777 return -ETIMEDOUT; in btintel_download_wait()
1782 return -ENOEXEC; in btintel_download_wait()
1805 if (err == -EINTR) { in btintel_boot_wait()
1807 return -EINTR; in btintel_boot_wait()
1812 return -ETIMEDOUT; in btintel_boot_wait()
1840 /* The bootloader will not indicate when the device is ready. This in btintel_boot()
1848 if (err == -ETIMEDOUT) in btintel_boot()
1859 switch (ver->hw_variant) { in btintel_get_fw_name()
1862 snprintf(fw_name, len, "intel/ibt-%u-%u.%s", in btintel_get_fw_name()
1863 ver->hw_variant, in btintel_get_fw_name()
1864 le16_to_cpu(params->dev_revid), in btintel_get_fw_name()
1871 snprintf(fw_name, len, "intel/ibt-%u-%u-%u.%s", in btintel_get_fw_name()
1872 ver->hw_variant, in btintel_get_fw_name()
1873 ver->hw_revision, in btintel_get_fw_name()
1874 ver->fw_revision, in btintel_get_fw_name()
1878 return -EINVAL; in btintel_get_fw_name()
1895 return -EINVAL; in btintel_download_fw()
1897 /* The firmware variant determines if the device is in bootloader in btintel_download_fw()
1898 * mode or is running operational firmware. The value 0x06 identifies in btintel_download_fw()
1899 * the bootloader and the value 0x23 identifies the operational in btintel_download_fw()
1908 * case since that command is only available in bootloader mode. in btintel_download_fw()
1910 if (ver->fw_variant == 0x23) { in btintel_download_fw()
1917 switch (ver->hw_variant) { in btintel_download_fw()
1928 * details of the bootloader. in btintel_download_fw()
1936 * that this bootloader does not send them, then abort the setup. in btintel_download_fw()
1938 if (params->limited_cce != 0x00) { in btintel_download_fw()
1940 params->limited_cce); in btintel_download_fw()
1941 return -EINVAL; in btintel_download_fw()
1947 if (!bacmp(¶ms->otp_bdaddr, BDADDR_ANY)) { in btintel_download_fw()
1949 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_download_fw()
1953 /* With this Intel bootloader only the hardware variant and device in btintel_download_fw()
1957 * The firmware filename is ibt-<hw_variant>-<dev_revid>.sfi. in btintel_download_fw()
1971 * ibt-<hw_variant>-<hw_revision>-<fw_revision>.sfi. in btintel_download_fw()
1983 return -EINVAL; in btintel_download_fw()
1986 err = firmware_request_nowarn(&fw, fwname, &hdev->dev); in btintel_download_fw()
2001 if (fw->size < 644) { in btintel_download_fw()
2003 fw->size); in btintel_download_fw()
2004 err = -EBADF; in btintel_download_fw()
2015 if (err == -EALREADY) { in btintel_download_fw()
2029 /* Before switching the device into operational mode and with that in btintel_download_fw()
2030 * booting the loaded firmware, wait for the bootloader notification in btintel_download_fw()
2041 if (err == -ETIMEDOUT) in btintel_download_fw()
2058 BT_DBG("%s", hdev->name); in btintel_bootloader_setup()
2073 if (ver->fw_variant == 0x23) in btintel_bootloader_setup()
2088 /* Once the device is running in operational mode, it needs to in btintel_bootloader_setup()
2124 * ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step> in btintel_get_fw_name_tlv()
2126 snprintf(fw_name, len, "intel/ibt-%04x-%04x.%s", in btintel_get_fw_name_tlv()
2127 INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), in btintel_get_fw_name_tlv()
2128 INTEL_CNVX_TOP_STEP(ver->cnvi_top)), in btintel_get_fw_name_tlv()
2129 INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), in btintel_get_fw_name_tlv()
2130 INTEL_CNVX_TOP_STEP(ver->cnvr_top)), in btintel_get_fw_name_tlv()
2144 return -EINVAL; in btintel_prepare_fw_download_tlv()
2146 /* The firmware variant determines if the device is in bootloader in btintel_prepare_fw_download_tlv()
2147 * mode or is running operational firmware. The value 0x03 identifies in btintel_prepare_fw_download_tlv()
2148 * the bootloader and the value 0x23 identifies the operational in btintel_prepare_fw_download_tlv()
2157 * case since that command is only available in bootloader mode. in btintel_prepare_fw_download_tlv()
2159 if (ver->img_type == 0x03) { in btintel_prepare_fw_download_tlv()
2164 * Check for valid bd address in boot loader mode. Device in btintel_prepare_fw_download_tlv()
2168 if (!bacmp(&ver->otp_bd_addr, BDADDR_ANY)) { in btintel_prepare_fw_download_tlv()
2170 set_bit(HCI_QUIRK_INVALID_BDADDR, &hdev->quirks); in btintel_prepare_fw_download_tlv()
2175 err = firmware_request_nowarn(&fw, fwname, &hdev->dev); in btintel_prepare_fw_download_tlv()
2191 if (fw->size < 644) { in btintel_prepare_fw_download_tlv()
2193 fw->size); in btintel_prepare_fw_download_tlv()
2194 err = -EBADF; in btintel_prepare_fw_download_tlv()
2204 INTEL_HW_VARIANT(ver->cnvi_bt), in btintel_prepare_fw_download_tlv()
2205 ver->sbe_type); in btintel_prepare_fw_download_tlv()
2207 if (err == -EALREADY) { in btintel_prepare_fw_download_tlv()
2221 /* Before switching the device into operational mode and with that in btintel_prepare_fw_download_tlv()
2222 * booting the loaded firmware, wait for the bootloader notification in btintel_prepare_fw_download_tlv()
2233 if (err == -ETIMEDOUT) in btintel_prepare_fw_download_tlv()
2248 return -EINVAL; in btintel_get_codec_config_data()
2255 return -EINVAL; in btintel_get_codec_config_data()
2260 err = -ENOMEM; in btintel_get_codec_config_data()
2265 switch (codec->id) { in btintel_get_codec_config_data()
2273 err = -EINVAL; in btintel_get_codec_config_data()
2274 bt_dev_err(hdev, "Invalid codec id(%u)", codec->id); in btintel_get_codec_config_data()
2277 /* codec and its capabilities are pre-defined to ids in btintel_get_codec_config_data()
2310 if (skb->len < sizeof(*use_cases)) { in btintel_configure_offload()
2311 err = -EIO; in btintel_configure_offload()
2315 use_cases = (void *)skb->data; in btintel_configure_offload()
2317 if (use_cases->status) { in btintel_configure_offload()
2318 err = -bt_to_errno(skb->data[0]); in btintel_configure_offload()
2322 if (use_cases->preset[0] & 0x03) { in btintel_configure_offload()
2323 hdev->get_data_path_id = btintel_get_data_path_id; in btintel_configure_offload()
2324 hdev->get_codec_config_data = btintel_get_codec_config_data; in btintel_configure_offload()
2338 u32 domain, mode; in btintel_set_ppag() local
2342 switch (ver->cnvr_top & 0xFFF) { in btintel_set_ppag()
2347 ver->cnvr_top & 0xFFF); in btintel_set_ppag()
2360 bt_dev_dbg(hdev, "PPAG-BT: ACPI entry not found"); in btintel_set_ppag()
2363 bt_dev_warn(hdev, "PPAG-BT: ACPI Failure: %s", acpi_format_exception(status)); in btintel_set_ppag()
2368 if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) { in btintel_set_ppag()
2369 bt_dev_warn(hdev, "PPAG-BT: Invalid object type: %d or package count: %d", in btintel_set_ppag()
2370 p->type, p->package.count); in btintel_set_ppag()
2375 elements = p->package.elements; in btintel_set_ppag()
2380 domain = (u32)p->package.elements[0].integer.value; in btintel_set_ppag()
2381 mode = (u32)p->package.elements[1].integer.value; in btintel_set_ppag()
2385 bt_dev_dbg(hdev, "PPAG-BT: Bluetooth domain is disabled in ACPI firmware"); in btintel_set_ppag()
2389 /* PPAG mode in btintel_set_ppag()
2395 mode &= 0x03; in btintel_set_ppag()
2397 if (!mode) { in btintel_set_ppag()
2398 bt_dev_dbg(hdev, "PPAG-BT: EU, China mode are disabled in BIOS"); in btintel_set_ppag()
2402 ppag_cmd.ppag_enable_flags = cpu_to_le32(mode); in btintel_set_ppag()
2410 bt_dev_info(hdev, "PPAG-BT: Enabled (Mode %d)", mode); in btintel_set_ppag()
2424 ret = -ENODEV; in btintel_acpi_reset_method()
2429 if (p->package.count != 1 || p->type != ACPI_TYPE_PACKAGE) { in btintel_acpi_reset_method()
2431 ret = -EINVAL; in btintel_acpi_reset_method()
2435 ref = &p->package.elements[0]; in btintel_acpi_reset_method()
2436 if (ref->type != ACPI_TYPE_LOCAL_REFERENCE) { in btintel_acpi_reset_method()
2437 bt_dev_err(hdev, "Invalid object type: 0x%x", ref->type); in btintel_acpi_reset_method()
2438 ret = -EINVAL; in btintel_acpi_reset_method()
2442 status = acpi_evaluate_object(ref->reference.handle, "_RST", NULL, NULL); in btintel_acpi_reset_method()
2445 ret = -ENODEV; in btintel_acpi_reset_method()
2478 switch (ver_tlv->cnvi_top & 0xfff) { in btintel_set_dsm_reset_method()
2521 data->acpi_reset_method = btintel_acpi_reset_method; in btintel_set_dsm_reset_method()
2547 if (ver->img_type == 0x03) in btintel_bootloader_setup_tlv()
2557 /* Once the device is running in operational mode, it needs to in btintel_bootloader_setup_tlv()
2596 /* Legacy bootloader devices that supports MSFT Extension */ in btintel_set_msft_opcode()
2625 BT_DBG("%s", hdev->name); in btintel_setup_combined()
2668 if (skb->data[0]) { in btintel_setup_combined()
2670 skb->data[0]); in btintel_setup_combined()
2671 err = -EIO; in btintel_setup_combined()
2676 set_bit(HCI_QUIRK_STRICT_DUPLICATE_FILTER, &hdev->quirks); in btintel_setup_combined()
2677 set_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY, &hdev->quirks); in btintel_setup_combined()
2678 set_bit(HCI_QUIRK_NON_PERSISTENT_DIAG, &hdev->quirks); in btintel_setup_combined()
2681 hdev->set_quality_report = btintel_set_quality_report; in btintel_setup_combined()
2684 if (skb->len == sizeof(ver) && skb->data[1] == 0x37) { in btintel_setup_combined()
2687 memcpy(&ver, skb->data, sizeof(ver)); in btintel_setup_combined()
2707 * WBS for SdP - For the Legacy ROM products, only SdP in btintel_setup_combined()
2717 &hdev->quirks); in btintel_setup_combined()
2720 &hdev->quirks); in btintel_setup_combined()
2729 set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); in btintel_setup_combined()
2734 * All Legacy bootloader devices support WBS in btintel_setup_combined()
2737 &hdev->quirks); in btintel_setup_combined()
2740 set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks); in btintel_setup_combined()
2751 err = -EINVAL; in btintel_setup_combined()
2758 * to bootloader mode and are not populated in operational mode in btintel_setup_combined()
2771 err = -EINVAL; in btintel_setup_combined()
2787 /* Some legacy bootloader devices starting from JfP, in btintel_setup_combined()
2793 * be used because the firmware filename for legacy bootloader in btintel_setup_combined()
2801 * run the legacy bootloader setup. in btintel_setup_combined()
2809 * All Legacy bootloader devices support WBS in btintel_setup_combined()
2811 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); in btintel_setup_combined()
2814 set_bit(HCI_QUIRK_BROKEN_LE_CODED, &hdev->quirks); in btintel_setup_combined()
2817 set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); in btintel_setup_combined()
2837 set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); in btintel_setup_combined()
2840 set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); in btintel_setup_combined()
2856 err = -EINVAL; in btintel_setup_combined()
2903 hdev->manufacturer = 2; in btintel_configure_setup()
2904 hdev->setup = btintel_setup_combined; in btintel_configure_setup()
2905 hdev->shutdown = btintel_shutdown_combined; in btintel_configure_setup()
2906 hdev->hw_error = btintel_hw_error; in btintel_configure_setup()
2907 hdev->set_diag = btintel_set_diag_combined; in btintel_configure_setup()
2908 hdev->set_bdaddr = btintel_set_bdaddr; in btintel_configure_setup()
2918 struct intel_tlv *tlv = (void *)&skb->data[5]; in btintel_diagnostics()
2921 if (tlv->type != INTEL_TLV_TYPE_ID) in btintel_diagnostics()
2924 switch (tlv->val[0]) { in btintel_diagnostics()
2930 if (!hci_devcd_init(hdev, skb->len)) { in btintel_diagnostics()
2938 bt_dev_err(hdev, "Invalid exception type %02X", tlv->val[0]); in btintel_diagnostics()
2947 struct hci_event_hdr *hdr = (void *)skb->data; in btintel_recv_event()
2950 if (skb->len > HCI_EVENT_HDR_SIZE && hdr->evt == 0xff && in btintel_recv_event()
2951 hdr->plen > 0) { in btintel_recv_event()
2952 const void *ptr = skb->data + HCI_EVENT_HDR_SIZE + 1; in btintel_recv_event()
2953 unsigned int len = skb->len - HCI_EVENT_HDR_SIZE - 1; in btintel_recv_event()
2956 switch (skb->data[2]) { in btintel_recv_event()
2979 memcmp(&skb->data[2], diagnostics_hdr, in btintel_recv_event()
3009 if (evt->result) in btintel_secure_send_result()
3022 MODULE_FIRMWARE("intel/ibt-11-5.sfi");
3023 MODULE_FIRMWARE("intel/ibt-11-5.ddc");
3024 MODULE_FIRMWARE("intel/ibt-12-16.sfi");
3025 MODULE_FIRMWARE("intel/ibt-12-16.ddc");