Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Bluetooth: btintel: Add firmware ID to firmware name

From BlazarI onwards, driver shall append the firmware ID (usually
represents transport type) while constructing the firmware name.
Firmware ID is returned on Intel Read Version command.

The new firmware file name for operational image and ddc file shall be,
ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step-fw_id>.[sfi|ddc]

dmesg snippet from BlazarI pcie product:

......

[17.098858] Bluetooth: hci0: Found device firmware: intel/ibt-0190-0291-pci.sfi
[17.098871] Bluetooth: hci0: Boot Address: 0x10000800
[17.098872] Bluetooth: hci0: Firmware Version: 214-25.24
[17.158229] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[17.158236] Bluetooth: BNEP filters: protocol multicast
[17.158241] Bluetooth: BNEP socket layer initialized
[17.468789] Bluetooth: hci0: Waiting for firmware download to complete
[17.468793] Bluetooth: hci0: Firmware loaded in 361262 usecs
[17.468872] Bluetooth: hci0: Waiting for device to boot
[17.504148] Bluetooth: hci0: Device booted in 34512 usecs
[17.504148] Bluetooth: hci0: Malformed MSFT vendor event: 0x02
[17.504682] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-0190-0291-pci.ddc
[17.505380] Bluetooth: hci0: Applying Intel DDC parameters completed
[17.505622] Bluetooth: hci0: Firmware timestamp 2024.25 buildtype 3 build 64726
[17.505624] Bluetooth: hci0: Firmware SHA1: 0x9f4adddc
[17.505838] Bluetooth: hci0: Fseq status: Success (0x00)
[17.505839] Bluetooth: hci0: Fseq executed: 00.00.04.183
[17.505840] Bluetooth: hci0: Fseq BT Top: 00.00.04.183

dmesg snippet from BlazarI usb product:

.......

[14.212072] Bluetooth: hci0: Found device firmware: intel/ibt-0190-0291-usb.sfi
[14.212091] Bluetooth: hci0: Boot Address: 0x10000800
[14.212093] Bluetooth: hci0: Firmware Version: 79-21.24
[14.262125] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[14.262129] Bluetooth: BNEP filters: protocol multicast
[14.262133] Bluetooth: BNEP socket layer initialized
[15.865421] Bluetooth: hci0: Waiting for firmware download to complete
[15.865991] Bluetooth: hci0: Firmware loaded in 1615150 usecs
[15.866017] Bluetooth: hci0: Waiting for device to boot
[15.899934] Bluetooth: hci0: Malformed MSFT vendor event: 0x02
[15.899942] Bluetooth: hci0: Device booted in 33139 usecs
[15.900172] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-0190-0291-usb.ddc
[15.901928] Bluetooth: hci0: Applying Intel DDC parameters completed
[15.904993] Bluetooth: hci0: Firmware timestamp 2024.21 buildtype 3 build 63311
[15.904996] Bluetooth: hci0: Firmware SHA1: 0x8b217cf7
[15.908929] Bluetooth: hci0: Fseq status: Success (0x00)
[15.908934] Bluetooth: hci0: Fseq executed: 00.00.04.180
[15.908935] Bluetooth: hci0: Fseq BT Top: 00.00.04.180

Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

authored by

Kiran K and committed by
Luiz Augusto von Dentz
164c62f9 da63f331

+75 -23
+70 -22
drivers/bluetooth/btintel.c
··· 631 631 case INTEL_TLV_GIT_SHA1: 632 632 version->git_sha1 = get_unaligned_le32(tlv->val); 633 633 break; 634 + case INTEL_TLV_FW_ID: 635 + snprintf(version->fw_id, sizeof(version->fw_id), 636 + "%s", tlv->val); 637 + break; 634 638 default: 635 639 /* Ignore rest of information */ 636 640 break; ··· 2137 2133 const char *suffix) 2138 2134 { 2139 2135 const char *format; 2140 - /* The firmware file name for new generation controllers will be 2141 - * ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step> 2142 - */ 2143 - switch (ver->cnvi_top & 0xfff) { 2136 + u32 cnvi, cnvr; 2137 + 2138 + cnvi = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), 2139 + INTEL_CNVX_TOP_STEP(ver->cnvi_top)); 2140 + 2141 + cnvr = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), 2142 + INTEL_CNVX_TOP_STEP(ver->cnvr_top)); 2143 + 2144 2144 /* Only Blazar product supports downloading of intermediate loader 2145 2145 * image 2146 2146 */ 2147 - case BTINTEL_CNVI_BLAZARI: 2148 - if (ver->img_type == BTINTEL_IMG_BOOTLOADER) 2149 - format = "intel/ibt-%04x-%04x-iml.%s"; 2150 - else 2151 - format = "intel/ibt-%04x-%04x.%s"; 2152 - break; 2153 - default: 2154 - format = "intel/ibt-%04x-%04x.%s"; 2155 - break; 2156 - } 2147 + if ((ver->cnvi_top & 0xfff) >= BTINTEL_CNVI_BLAZARI) { 2148 + u8 zero[BTINTEL_FWID_MAXLEN]; 2157 2149 2158 - snprintf(fw_name, len, format, 2159 - INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), 2160 - INTEL_CNVX_TOP_STEP(ver->cnvi_top)), 2161 - INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), 2162 - INTEL_CNVX_TOP_STEP(ver->cnvr_top)), 2163 - suffix); 2150 + if (ver->img_type == BTINTEL_IMG_BOOTLOADER) { 2151 + format = "intel/ibt-%04x-%04x-iml.%s"; 2152 + snprintf(fw_name, len, format, cnvi, cnvr, suffix); 2153 + return; 2154 + } 2155 + 2156 + memset(zero, 0, sizeof(zero)); 2157 + 2158 + /* ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step-fw_id> */ 2159 + if (memcmp(ver->fw_id, zero, sizeof(zero))) { 2160 + format = "intel/ibt-%04x-%04x-%s.%s"; 2161 + snprintf(fw_name, len, format, cnvi, cnvr, 2162 + ver->fw_id, suffix); 2163 + return; 2164 + } 2165 + /* If firmware id is not present, fallback to legacy naming 2166 + * convention 2167 + */ 2168 + } 2169 + /* Fallback to legacy naming convention for other controllers 2170 + * ibt-<cnvi_top type+cnvi_top step>-<cnvr_top type+cnvr_top step> 2171 + */ 2172 + format = "intel/ibt-%04x-%04x.%s"; 2173 + snprintf(fw_name, len, format, cnvi, cnvr, suffix); 2174 + } 2175 + 2176 + static void btintel_get_iml_tlv(const struct intel_version_tlv *ver, 2177 + char *fw_name, size_t len, 2178 + const char *suffix) 2179 + { 2180 + const char *format; 2181 + u32 cnvi, cnvr; 2182 + 2183 + cnvi = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvi_top), 2184 + INTEL_CNVX_TOP_STEP(ver->cnvi_top)); 2185 + 2186 + cnvr = INTEL_CNVX_TOP_PACK_SWAB(INTEL_CNVX_TOP_TYPE(ver->cnvr_top), 2187 + INTEL_CNVX_TOP_STEP(ver->cnvr_top)); 2188 + 2189 + format = "intel/ibt-%04x-%04x-iml.%s"; 2190 + snprintf(fw_name, len, format, cnvi, cnvr, suffix); 2164 2191 } 2165 2192 2166 2193 static int btintel_prepare_fw_download_tlv(struct hci_dev *hdev, ··· 2199 2164 u32 *boot_param) 2200 2165 { 2201 2166 const struct firmware *fw; 2202 - char fwname[64]; 2167 + char fwname[128]; 2203 2168 int err; 2204 2169 ktime_t calltime; 2205 2170 ··· 2234 2199 } 2235 2200 } 2236 2201 2237 - btintel_get_fw_name_tlv(ver, fwname, sizeof(fwname), "sfi"); 2202 + if (ver->img_type == BTINTEL_IMG_OP) { 2203 + /* Controller running OP image. In case of FW downgrade, 2204 + * FWID TLV may not be present and driver may attempt to load 2205 + * firmware image which doesn't exist. Lets compare the version 2206 + * of IML image 2207 + */ 2208 + if ((ver->cnvi_top & 0xfff) >= BTINTEL_CNVI_BLAZARI) 2209 + btintel_get_iml_tlv(ver, fwname, sizeof(fwname), "sfi"); 2210 + else 2211 + btintel_get_fw_name_tlv(ver, fwname, sizeof(fwname), "sfi"); 2212 + } else { 2213 + btintel_get_fw_name_tlv(ver, fwname, sizeof(fwname), "sfi"); 2214 + } 2215 + 2238 2216 err = firmware_request_nowarn(&fw, fwname, &hdev->dev); 2239 2217 if (err < 0) { 2240 2218 if (!btintel_test_flag(hdev, INTEL_BOOTLOADER)) {
+5 -1
drivers/bluetooth/btintel.h
··· 42 42 INTEL_TLV_SBE_TYPE, 43 43 INTEL_TLV_OTP_BDADDR, 44 44 INTEL_TLV_UNLOCKED_STATE, 45 - INTEL_TLV_GIT_SHA1 45 + INTEL_TLV_GIT_SHA1, 46 + INTEL_TLV_FW_ID = 0x50 46 47 }; 47 48 48 49 struct intel_tlv { ··· 57 56 #define BTINTEL_IMG_BOOTLOADER 0x01 /* Bootloader image */ 58 57 #define BTINTEL_IMG_IML 0x02 /* Intermediate image */ 59 58 #define BTINTEL_IMG_OP 0x03 /* Operational image */ 59 + 60 + #define BTINTEL_FWID_MAXLEN 64 60 61 61 62 struct intel_version_tlv { 62 63 u32 cnvi_top; ··· 80 77 u8 limited_cce; 81 78 u8 sbe_type; 82 79 u32 git_sha1; 80 + u8 fw_id[BTINTEL_FWID_MAXLEN]; 83 81 bdaddr_t otp_bd_addr; 84 82 }; 85 83