Bluetooth: btintel: Define macros for image types

Use macro for image type instead of using hard code number.

Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
Kiran K 2024-03-11 14:16:25 +05:30 committed by Luiz Augusto von Dentz
parent 5c1672705a
commit 5ec6feb14f
2 changed files with 9 additions and 6 deletions

View File

@ -489,7 +489,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,
} }
switch (version->img_type) { switch (version->img_type) {
case 0x01: case BTINTEL_IMG_BOOTLOADER:
variant = "Bootloader"; variant = "Bootloader";
/* It is required that every single firmware fragment is acknowledged /* It is required that every single firmware fragment is acknowledged
* with a command complete event. If the boot parameters indicate * with a command complete event. If the boot parameters indicate
@ -521,7 +521,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,
version->min_fw_build_nn, version->min_fw_build_cw, version->min_fw_build_nn, version->min_fw_build_cw,
2000 + version->min_fw_build_yy); 2000 + version->min_fw_build_yy);
break; break;
case 0x03: case BTINTEL_IMG_OP:
variant = "Firmware"; variant = "Firmware";
break; break;
default: default:
@ -535,7 +535,7 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,
bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u", variant, bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u", variant,
2000 + (version->timestamp >> 8), version->timestamp & 0xff, 2000 + (version->timestamp >> 8), version->timestamp & 0xff,
version->build_type, version->build_num); version->build_type, version->build_num);
if (version->img_type == 0x03) if (version->img_type == BTINTEL_IMG_OP)
bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1); bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1);
return 0; return 0;
@ -1172,7 +1172,7 @@ static int btintel_download_fw_tlv(struct hci_dev *hdev,
* If the firmware version has changed that means it needs to be reset * If the firmware version has changed that means it needs to be reset
* to bootloader when operational so the new firmware can be loaded. * to bootloader when operational so the new firmware can be loaded.
*/ */
if (ver->img_type == 0x03) if (ver->img_type == BTINTEL_IMG_OP)
return -EINVAL; return -EINVAL;
/* iBT hardware variants 0x0b, 0x0c, 0x11, 0x12, 0x13, 0x14 support /* iBT hardware variants 0x0b, 0x0c, 0x11, 0x12, 0x13, 0x14 support
@ -2230,7 +2230,7 @@ static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev,
* It is not possible to use the Secure Boot Parameters in this * It is not possible to use the Secure Boot Parameters in this
* case since that command is only available in bootloader mode. * case since that command is only available in bootloader mode.
*/ */
if (ver->img_type == 0x03) { if (ver->img_type == BTINTEL_IMG_OP) {
btintel_clear_flag(hdev, INTEL_BOOTLOADER); btintel_clear_flag(hdev, INTEL_BOOTLOADER);
btintel_check_bdaddr(hdev); btintel_check_bdaddr(hdev);
} else { } else {
@ -2600,7 +2600,7 @@ static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
return err; return err;
/* check if controller is already having an operational firmware */ /* check if controller is already having an operational firmware */
if (ver->img_type == 0x03) if (ver->img_type == BTINTEL_IMG_OP)
goto finish; goto finish;
err = btintel_boot(hdev, boot_param); err = btintel_boot(hdev, boot_param);

View File

@ -51,6 +51,9 @@ struct intel_tlv {
u8 val[]; u8 val[];
} __packed; } __packed;
#define BTINTEL_IMG_BOOTLOADER 0x01 /* Bootloader image */
#define BTINTEL_IMG_OP 0x03 /* Operational image */
struct intel_version_tlv { struct intel_version_tlv {
u32 cnvi_top; u32 cnvi_top;
u32 cnvr_top; u32 cnvr_top;