|
14 | 14 | #include <linux/net.h>
|
15 | 15 | #include <linux/platform_device.h>
|
16 | 16 | #include <linux/qcom_scm.h>
|
| 17 | +#include <linux/soc/qcom/smem.h> |
17 | 18 | #include <linux/string.h>
|
18 | 19 | #include <net/sock.h>
|
19 | 20 |
|
|
22 | 23 |
|
23 | 24 | #define ATH10K_QMI_CLIENT_ID 0x4b4e454c
|
24 | 25 | #define ATH10K_QMI_TIMEOUT 30
|
| 26 | +#define SMEM_IMAGE_VERSION_TABLE 469 |
| 27 | +#define SMEM_IMAGE_TABLE_CNSS_INDEX 13 |
| 28 | +#define SMEM_IMAGE_VERSION_ENTRY_SIZE 128 |
| 29 | +#define SMEM_IMAGE_VERSION_NAME_SIZE 75 |
25 | 30 |
|
26 | 31 | static int ath10k_qmi_map_msa_permission(struct ath10k_qmi *qmi,
|
27 | 32 | struct ath10k_msa_mem_info *mem_info)
|
@@ -536,6 +541,33 @@ int ath10k_qmi_wlan_disable(struct ath10k *ar)
|
536 | 541 | return ath10k_qmi_mode_send_sync_msg(ar, QMI_WLFW_OFF_V01);
|
537 | 542 | }
|
538 | 543 |
|
| 544 | +static void ath10k_qmi_add_wlan_ver_smem(struct ath10k *ar, const char *fw_build_id) |
| 545 | +{ |
| 546 | + u8 *table_ptr; |
| 547 | + size_t smem_item_size; |
| 548 | + const u32 smem_img_idx_wlan = SMEM_IMAGE_TABLE_CNSS_INDEX * |
| 549 | + SMEM_IMAGE_VERSION_ENTRY_SIZE; |
| 550 | + |
| 551 | + table_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY, |
| 552 | + SMEM_IMAGE_VERSION_TABLE, |
| 553 | + &smem_item_size); |
| 554 | + |
| 555 | + if (IS_ERR(table_ptr)) { |
| 556 | + ath10k_err(ar, "smem image version table not found\n"); |
| 557 | + return; |
| 558 | + } |
| 559 | + |
| 560 | + if (smem_img_idx_wlan + SMEM_IMAGE_VERSION_ENTRY_SIZE > |
| 561 | + smem_item_size) { |
| 562 | + ath10k_err(ar, "smem block size too small: %zu\n", |
| 563 | + smem_item_size); |
| 564 | + return; |
| 565 | + } |
| 566 | + |
| 567 | + strscpy(table_ptr + smem_img_idx_wlan, fw_build_id, |
| 568 | + SMEM_IMAGE_VERSION_NAME_SIZE); |
| 569 | +} |
| 570 | + |
539 | 571 | static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
|
540 | 572 | {
|
541 | 573 | struct wlfw_cap_resp_msg_v01 *resp;
|
@@ -606,6 +638,9 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi *qmi)
|
606 | 638 | qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id);
|
607 | 639 | }
|
608 | 640 |
|
| 641 | + if (resp->fw_build_id_valid) |
| 642 | + ath10k_qmi_add_wlan_ver_smem(ar, qmi->fw_build_id); |
| 643 | + |
609 | 644 | kfree(resp);
|
610 | 645 | return 0;
|
611 | 646 |
|
|
0 commit comments