1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
10 #include <linux/firmware.h>
12 static struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei
[] = {
14 .data_type
= QMI_OPT_FLAG
,
16 .elem_size
= sizeof(u8
),
17 .array_type
= NO_ARRAY
,
19 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
23 .data_type
= QMI_UNSIGNED_4_BYTE
,
25 .elem_size
= sizeof(u32
),
26 .array_type
= NO_ARRAY
,
28 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
32 .data_type
= QMI_OPT_FLAG
,
34 .elem_size
= sizeof(u8
),
35 .array_type
= NO_ARRAY
,
37 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
41 .data_type
= QMI_UNSIGNED_4_BYTE
,
43 .elem_size
= sizeof(u32
),
44 .array_type
= NO_ARRAY
,
46 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
50 .data_type
= QMI_OPT_FLAG
,
52 .elem_size
= sizeof(u8
),
53 .array_type
= NO_ARRAY
,
55 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
59 .data_type
= QMI_DATA_LEN
,
61 .elem_size
= sizeof(u8
),
62 .array_type
= NO_ARRAY
,
64 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
68 .data_type
= QMI_UNSIGNED_4_BYTE
,
69 .elem_len
= QMI_WLFW_MAX_NUM_GPIO_V01
,
70 .elem_size
= sizeof(u32
),
71 .array_type
= VAR_LEN_ARRAY
,
73 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
77 .data_type
= QMI_OPT_FLAG
,
79 .elem_size
= sizeof(u8
),
80 .array_type
= NO_ARRAY
,
82 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
86 .data_type
= QMI_UNSIGNED_1_BYTE
,
88 .elem_size
= sizeof(u8
),
89 .array_type
= NO_ARRAY
,
91 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
95 .data_type
= QMI_OPT_FLAG
,
97 .elem_size
= sizeof(u8
),
98 .array_type
= NO_ARRAY
,
100 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
104 .data_type
= QMI_UNSIGNED_1_BYTE
,
106 .elem_size
= sizeof(u8
),
107 .array_type
= NO_ARRAY
,
109 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
113 .data_type
= QMI_OPT_FLAG
,
115 .elem_size
= sizeof(u8
),
116 .array_type
= NO_ARRAY
,
118 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
119 bdf_cache_support_valid
),
122 .data_type
= QMI_UNSIGNED_1_BYTE
,
124 .elem_size
= sizeof(u8
),
125 .array_type
= NO_ARRAY
,
127 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
131 .data_type
= QMI_OPT_FLAG
,
133 .elem_size
= sizeof(u8
),
134 .array_type
= NO_ARRAY
,
136 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
140 .data_type
= QMI_UNSIGNED_1_BYTE
,
142 .elem_size
= sizeof(u8
),
143 .array_type
= NO_ARRAY
,
145 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
149 .data_type
= QMI_OPT_FLAG
,
151 .elem_size
= sizeof(u8
),
152 .array_type
= NO_ARRAY
,
154 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
155 m3_cache_support_valid
),
158 .data_type
= QMI_UNSIGNED_1_BYTE
,
160 .elem_size
= sizeof(u8
),
161 .array_type
= NO_ARRAY
,
163 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
167 .data_type
= QMI_OPT_FLAG
,
169 .elem_size
= sizeof(u8
),
170 .array_type
= NO_ARRAY
,
172 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
173 cal_filesys_support_valid
),
176 .data_type
= QMI_UNSIGNED_1_BYTE
,
178 .elem_size
= sizeof(u8
),
179 .array_type
= NO_ARRAY
,
181 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
182 cal_filesys_support
),
185 .data_type
= QMI_OPT_FLAG
,
187 .elem_size
= sizeof(u8
),
188 .array_type
= NO_ARRAY
,
190 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
191 cal_cache_support_valid
),
194 .data_type
= QMI_UNSIGNED_1_BYTE
,
196 .elem_size
= sizeof(u8
),
197 .array_type
= NO_ARRAY
,
199 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
203 .data_type
= QMI_OPT_FLAG
,
205 .elem_size
= sizeof(u8
),
206 .array_type
= NO_ARRAY
,
208 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
212 .data_type
= QMI_UNSIGNED_1_BYTE
,
214 .elem_size
= sizeof(u8
),
215 .array_type
= NO_ARRAY
,
217 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
221 .data_type
= QMI_OPT_FLAG
,
223 .elem_size
= sizeof(u8
),
224 .array_type
= NO_ARRAY
,
226 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
230 .data_type
= QMI_UNSIGNED_4_BYTE
,
232 .elem_size
= sizeof(u32
),
233 .array_type
= NO_ARRAY
,
235 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
239 .data_type
= QMI_OPT_FLAG
,
241 .elem_size
= sizeof(u8
),
242 .array_type
= NO_ARRAY
,
244 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
248 .data_type
= QMI_UNSIGNED_1_BYTE
,
250 .elem_size
= sizeof(u8
),
251 .array_type
= NO_ARRAY
,
253 .offset
= offsetof(struct qmi_wlanfw_host_cap_req_msg_v01
,
257 .data_type
= QMI_EOTI
,
258 .array_type
= NO_ARRAY
,
259 .tlv_type
= QMI_COMMON_TLV_TYPE
,
263 static struct qmi_elem_info qmi_wlanfw_host_cap_resp_msg_v01_ei
[] = {
265 .data_type
= QMI_STRUCT
,
267 .elem_size
= sizeof(struct qmi_response_type_v01
),
268 .array_type
= NO_ARRAY
,
270 .offset
= offsetof(struct qmi_wlanfw_host_cap_resp_msg_v01
, resp
),
271 .ei_array
= qmi_response_type_v01_ei
,
274 .data_type
= QMI_EOTI
,
275 .array_type
= NO_ARRAY
,
276 .tlv_type
= QMI_COMMON_TLV_TYPE
,
280 static struct qmi_elem_info qmi_wlanfw_ind_register_req_msg_v01_ei
[] = {
282 .data_type
= QMI_OPT_FLAG
,
284 .elem_size
= sizeof(u8
),
285 .array_type
= NO_ARRAY
,
287 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
288 fw_ready_enable_valid
),
291 .data_type
= QMI_UNSIGNED_1_BYTE
,
293 .elem_size
= sizeof(u8
),
294 .array_type
= NO_ARRAY
,
296 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
300 .data_type
= QMI_OPT_FLAG
,
302 .elem_size
= sizeof(u8
),
303 .array_type
= NO_ARRAY
,
305 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
306 initiate_cal_download_enable_valid
),
309 .data_type
= QMI_UNSIGNED_1_BYTE
,
311 .elem_size
= sizeof(u8
),
312 .array_type
= NO_ARRAY
,
314 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
315 initiate_cal_download_enable
),
318 .data_type
= QMI_OPT_FLAG
,
320 .elem_size
= sizeof(u8
),
321 .array_type
= NO_ARRAY
,
323 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
324 initiate_cal_update_enable_valid
),
327 .data_type
= QMI_UNSIGNED_1_BYTE
,
329 .elem_size
= sizeof(u8
),
330 .array_type
= NO_ARRAY
,
332 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
333 initiate_cal_update_enable
),
336 .data_type
= QMI_OPT_FLAG
,
338 .elem_size
= sizeof(u8
),
339 .array_type
= NO_ARRAY
,
341 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
342 msa_ready_enable_valid
),
345 .data_type
= QMI_UNSIGNED_1_BYTE
,
347 .elem_size
= sizeof(u8
),
348 .array_type
= NO_ARRAY
,
350 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
354 .data_type
= QMI_OPT_FLAG
,
356 .elem_size
= sizeof(u8
),
357 .array_type
= NO_ARRAY
,
359 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
360 pin_connect_result_enable_valid
),
363 .data_type
= QMI_UNSIGNED_1_BYTE
,
365 .elem_size
= sizeof(u8
),
366 .array_type
= NO_ARRAY
,
368 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
369 pin_connect_result_enable
),
372 .data_type
= QMI_OPT_FLAG
,
374 .elem_size
= sizeof(u8
),
375 .array_type
= NO_ARRAY
,
377 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
381 .data_type
= QMI_UNSIGNED_4_BYTE
,
383 .elem_size
= sizeof(u32
),
384 .array_type
= NO_ARRAY
,
386 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
390 .data_type
= QMI_OPT_FLAG
,
392 .elem_size
= sizeof(u8
),
393 .array_type
= NO_ARRAY
,
395 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
396 request_mem_enable_valid
),
399 .data_type
= QMI_UNSIGNED_1_BYTE
,
401 .elem_size
= sizeof(u8
),
402 .array_type
= NO_ARRAY
,
404 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
408 .data_type
= QMI_OPT_FLAG
,
410 .elem_size
= sizeof(u8
),
411 .array_type
= NO_ARRAY
,
413 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
414 fw_mem_ready_enable_valid
),
417 .data_type
= QMI_UNSIGNED_1_BYTE
,
419 .elem_size
= sizeof(u8
),
420 .array_type
= NO_ARRAY
,
422 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
423 fw_mem_ready_enable
),
426 .data_type
= QMI_OPT_FLAG
,
428 .elem_size
= sizeof(u8
),
429 .array_type
= NO_ARRAY
,
431 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
432 fw_init_done_enable_valid
),
435 .data_type
= QMI_UNSIGNED_1_BYTE
,
437 .elem_size
= sizeof(u8
),
438 .array_type
= NO_ARRAY
,
440 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
441 fw_init_done_enable
),
445 .data_type
= QMI_OPT_FLAG
,
447 .elem_size
= sizeof(u8
),
448 .array_type
= NO_ARRAY
,
450 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
451 rejuvenate_enable_valid
),
454 .data_type
= QMI_UNSIGNED_1_BYTE
,
456 .elem_size
= sizeof(u8
),
457 .array_type
= NO_ARRAY
,
459 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
463 .data_type
= QMI_OPT_FLAG
,
465 .elem_size
= sizeof(u8
),
466 .array_type
= NO_ARRAY
,
468 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
469 xo_cal_enable_valid
),
472 .data_type
= QMI_UNSIGNED_1_BYTE
,
474 .elem_size
= sizeof(u8
),
475 .array_type
= NO_ARRAY
,
477 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
481 .data_type
= QMI_OPT_FLAG
,
483 .elem_size
= sizeof(u8
),
484 .array_type
= NO_ARRAY
,
486 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
487 cal_done_enable_valid
),
490 .data_type
= QMI_UNSIGNED_1_BYTE
,
492 .elem_size
= sizeof(u8
),
493 .array_type
= NO_ARRAY
,
495 .offset
= offsetof(struct qmi_wlanfw_ind_register_req_msg_v01
,
499 .data_type
= QMI_EOTI
,
500 .array_type
= NO_ARRAY
,
501 .tlv_type
= QMI_COMMON_TLV_TYPE
,
505 static struct qmi_elem_info qmi_wlanfw_ind_register_resp_msg_v01_ei
[] = {
507 .data_type
= QMI_STRUCT
,
509 .elem_size
= sizeof(struct qmi_response_type_v01
),
510 .array_type
= NO_ARRAY
,
512 .offset
= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01
,
514 .ei_array
= qmi_response_type_v01_ei
,
517 .data_type
= QMI_OPT_FLAG
,
519 .elem_size
= sizeof(u8
),
520 .array_type
= NO_ARRAY
,
522 .offset
= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01
,
526 .data_type
= QMI_UNSIGNED_8_BYTE
,
528 .elem_size
= sizeof(u64
),
529 .array_type
= NO_ARRAY
,
531 .offset
= offsetof(struct qmi_wlanfw_ind_register_resp_msg_v01
,
535 .data_type
= QMI_EOTI
,
536 .array_type
= NO_ARRAY
,
537 .tlv_type
= QMI_COMMON_TLV_TYPE
,
541 static struct qmi_elem_info qmi_wlanfw_mem_cfg_s_v01_ei
[] = {
543 .data_type
= QMI_UNSIGNED_8_BYTE
,
545 .elem_size
= sizeof(u64
),
546 .array_type
= NO_ARRAY
,
548 .offset
= offsetof(struct qmi_wlanfw_mem_cfg_s_v01
, offset
),
551 .data_type
= QMI_UNSIGNED_4_BYTE
,
553 .elem_size
= sizeof(u32
),
554 .array_type
= NO_ARRAY
,
556 .offset
= offsetof(struct qmi_wlanfw_mem_cfg_s_v01
, size
),
559 .data_type
= QMI_UNSIGNED_1_BYTE
,
561 .elem_size
= sizeof(u8
),
562 .array_type
= NO_ARRAY
,
564 .offset
= offsetof(struct qmi_wlanfw_mem_cfg_s_v01
, secure_flag
),
567 .data_type
= QMI_EOTI
,
568 .array_type
= NO_ARRAY
,
569 .tlv_type
= QMI_COMMON_TLV_TYPE
,
573 static struct qmi_elem_info qmi_wlanfw_mem_seg_s_v01_ei
[] = {
575 .data_type
= QMI_UNSIGNED_4_BYTE
,
577 .elem_size
= sizeof(u32
),
578 .array_type
= NO_ARRAY
,
580 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
,
584 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
586 .elem_size
= sizeof(enum qmi_wlanfw_mem_type_enum_v01
),
587 .array_type
= NO_ARRAY
,
589 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
, type
),
592 .data_type
= QMI_DATA_LEN
,
594 .elem_size
= sizeof(u8
),
595 .array_type
= NO_ARRAY
,
597 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
, mem_cfg_len
),
600 .data_type
= QMI_STRUCT
,
601 .elem_len
= QMI_WLANFW_MAX_NUM_MEM_CFG_V01
,
602 .elem_size
= sizeof(struct qmi_wlanfw_mem_cfg_s_v01
),
603 .array_type
= VAR_LEN_ARRAY
,
605 .offset
= offsetof(struct qmi_wlanfw_mem_seg_s_v01
, mem_cfg
),
606 .ei_array
= qmi_wlanfw_mem_cfg_s_v01_ei
,
609 .data_type
= QMI_EOTI
,
610 .array_type
= NO_ARRAY
,
611 .tlv_type
= QMI_COMMON_TLV_TYPE
,
615 static struct qmi_elem_info qmi_wlanfw_request_mem_ind_msg_v01_ei
[] = {
617 .data_type
= QMI_DATA_LEN
,
619 .elem_size
= sizeof(u8
),
620 .array_type
= NO_ARRAY
,
622 .offset
= offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01
,
626 .data_type
= QMI_STRUCT
,
627 .elem_len
= ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01
,
628 .elem_size
= sizeof(struct qmi_wlanfw_mem_seg_s_v01
),
629 .array_type
= VAR_LEN_ARRAY
,
631 .offset
= offsetof(struct qmi_wlanfw_request_mem_ind_msg_v01
,
633 .ei_array
= qmi_wlanfw_mem_seg_s_v01_ei
,
636 .data_type
= QMI_EOTI
,
637 .array_type
= NO_ARRAY
,
638 .tlv_type
= QMI_COMMON_TLV_TYPE
,
642 static struct qmi_elem_info qmi_wlanfw_mem_seg_resp_s_v01_ei
[] = {
644 .data_type
= QMI_UNSIGNED_8_BYTE
,
646 .elem_size
= sizeof(u64
),
647 .array_type
= NO_ARRAY
,
649 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, addr
),
652 .data_type
= QMI_UNSIGNED_4_BYTE
,
654 .elem_size
= sizeof(u32
),
655 .array_type
= NO_ARRAY
,
657 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, size
),
660 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
662 .elem_size
= sizeof(enum qmi_wlanfw_mem_type_enum_v01
),
663 .array_type
= NO_ARRAY
,
665 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, type
),
668 .data_type
= QMI_UNSIGNED_1_BYTE
,
670 .elem_size
= sizeof(u8
),
671 .array_type
= NO_ARRAY
,
673 .offset
= offsetof(struct qmi_wlanfw_mem_seg_resp_s_v01
, restore
),
676 .data_type
= QMI_EOTI
,
677 .array_type
= NO_ARRAY
,
678 .tlv_type
= QMI_COMMON_TLV_TYPE
,
682 static struct qmi_elem_info qmi_wlanfw_respond_mem_req_msg_v01_ei
[] = {
684 .data_type
= QMI_DATA_LEN
,
686 .elem_size
= sizeof(u8
),
687 .array_type
= NO_ARRAY
,
689 .offset
= offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01
,
693 .data_type
= QMI_STRUCT
,
694 .elem_len
= ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01
,
695 .elem_size
= sizeof(struct qmi_wlanfw_mem_seg_resp_s_v01
),
696 .array_type
= VAR_LEN_ARRAY
,
698 .offset
= offsetof(struct qmi_wlanfw_respond_mem_req_msg_v01
,
700 .ei_array
= qmi_wlanfw_mem_seg_resp_s_v01_ei
,
703 .data_type
= QMI_EOTI
,
704 .array_type
= NO_ARRAY
,
705 .tlv_type
= QMI_COMMON_TLV_TYPE
,
709 static struct qmi_elem_info qmi_wlanfw_respond_mem_resp_msg_v01_ei
[] = {
711 .data_type
= QMI_STRUCT
,
713 .elem_size
= sizeof(struct qmi_response_type_v01
),
714 .array_type
= NO_ARRAY
,
716 .offset
= offsetof(struct qmi_wlanfw_respond_mem_resp_msg_v01
,
718 .ei_array
= qmi_response_type_v01_ei
,
721 .data_type
= QMI_EOTI
,
722 .array_type
= NO_ARRAY
,
723 .tlv_type
= QMI_COMMON_TLV_TYPE
,
727 static struct qmi_elem_info qmi_wlanfw_cap_req_msg_v01_ei
[] = {
729 .data_type
= QMI_EOTI
,
730 .array_type
= NO_ARRAY
,
731 .tlv_type
= QMI_COMMON_TLV_TYPE
,
735 static struct qmi_elem_info qmi_wlanfw_rf_chip_info_s_v01_ei
[] = {
737 .data_type
= QMI_UNSIGNED_4_BYTE
,
739 .elem_size
= sizeof(u32
),
740 .array_type
= NO_ARRAY
,
742 .offset
= offsetof(struct qmi_wlanfw_rf_chip_info_s_v01
,
746 .data_type
= QMI_UNSIGNED_4_BYTE
,
748 .elem_size
= sizeof(u32
),
749 .array_type
= NO_ARRAY
,
751 .offset
= offsetof(struct qmi_wlanfw_rf_chip_info_s_v01
,
755 .data_type
= QMI_EOTI
,
756 .array_type
= NO_ARRAY
,
757 .tlv_type
= QMI_COMMON_TLV_TYPE
,
761 static struct qmi_elem_info qmi_wlanfw_rf_board_info_s_v01_ei
[] = {
763 .data_type
= QMI_UNSIGNED_4_BYTE
,
765 .elem_size
= sizeof(u32
),
766 .array_type
= NO_ARRAY
,
768 .offset
= offsetof(struct qmi_wlanfw_rf_board_info_s_v01
,
772 .data_type
= QMI_EOTI
,
773 .array_type
= NO_ARRAY
,
774 .tlv_type
= QMI_COMMON_TLV_TYPE
,
778 static struct qmi_elem_info qmi_wlanfw_soc_info_s_v01_ei
[] = {
780 .data_type
= QMI_UNSIGNED_4_BYTE
,
782 .elem_size
= sizeof(u32
),
783 .array_type
= NO_ARRAY
,
785 .offset
= offsetof(struct qmi_wlanfw_soc_info_s_v01
, soc_id
),
788 .data_type
= QMI_EOTI
,
789 .array_type
= NO_ARRAY
,
790 .tlv_type
= QMI_COMMON_TLV_TYPE
,
794 static struct qmi_elem_info qmi_wlanfw_fw_version_info_s_v01_ei
[] = {
796 .data_type
= QMI_UNSIGNED_4_BYTE
,
798 .elem_size
= sizeof(u32
),
799 .array_type
= NO_ARRAY
,
801 .offset
= offsetof(struct qmi_wlanfw_fw_version_info_s_v01
,
805 .data_type
= QMI_STRING
,
806 .elem_len
= ATH11K_QMI_WLANFW_MAX_TIMESTAMP_LEN_V01
+ 1,
807 .elem_size
= sizeof(char),
808 .array_type
= NO_ARRAY
,
810 .offset
= offsetof(struct qmi_wlanfw_fw_version_info_s_v01
,
814 .data_type
= QMI_EOTI
,
815 .array_type
= NO_ARRAY
,
816 .tlv_type
= QMI_COMMON_TLV_TYPE
,
820 static struct qmi_elem_info qmi_wlanfw_cap_resp_msg_v01_ei
[] = {
822 .data_type
= QMI_STRUCT
,
824 .elem_size
= sizeof(struct qmi_response_type_v01
),
825 .array_type
= NO_ARRAY
,
827 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
, resp
),
828 .ei_array
= qmi_response_type_v01_ei
,
831 .data_type
= QMI_OPT_FLAG
,
833 .elem_size
= sizeof(u8
),
834 .array_type
= NO_ARRAY
,
836 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
840 .data_type
= QMI_STRUCT
,
842 .elem_size
= sizeof(struct qmi_wlanfw_rf_chip_info_s_v01
),
843 .array_type
= NO_ARRAY
,
845 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
847 .ei_array
= qmi_wlanfw_rf_chip_info_s_v01_ei
,
850 .data_type
= QMI_OPT_FLAG
,
852 .elem_size
= sizeof(u8
),
853 .array_type
= NO_ARRAY
,
855 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
859 .data_type
= QMI_STRUCT
,
861 .elem_size
= sizeof(struct qmi_wlanfw_rf_board_info_s_v01
),
862 .array_type
= NO_ARRAY
,
864 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
866 .ei_array
= qmi_wlanfw_rf_board_info_s_v01_ei
,
869 .data_type
= QMI_OPT_FLAG
,
871 .elem_size
= sizeof(u8
),
872 .array_type
= NO_ARRAY
,
874 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
878 .data_type
= QMI_STRUCT
,
880 .elem_size
= sizeof(struct qmi_wlanfw_soc_info_s_v01
),
881 .array_type
= NO_ARRAY
,
883 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
885 .ei_array
= qmi_wlanfw_soc_info_s_v01_ei
,
888 .data_type
= QMI_OPT_FLAG
,
890 .elem_size
= sizeof(u8
),
891 .array_type
= NO_ARRAY
,
893 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
894 fw_version_info_valid
),
897 .data_type
= QMI_STRUCT
,
899 .elem_size
= sizeof(struct qmi_wlanfw_fw_version_info_s_v01
),
900 .array_type
= NO_ARRAY
,
902 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
904 .ei_array
= qmi_wlanfw_fw_version_info_s_v01_ei
,
907 .data_type
= QMI_OPT_FLAG
,
909 .elem_size
= sizeof(u8
),
910 .array_type
= NO_ARRAY
,
912 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
916 .data_type
= QMI_STRING
,
917 .elem_len
= ATH11K_QMI_WLANFW_MAX_BUILD_ID_LEN_V01
+ 1,
918 .elem_size
= sizeof(char),
919 .array_type
= NO_ARRAY
,
921 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
925 .data_type
= QMI_OPT_FLAG
,
927 .elem_size
= sizeof(u8
),
928 .array_type
= NO_ARRAY
,
930 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
934 .data_type
= QMI_UNSIGNED_1_BYTE
,
936 .elem_size
= sizeof(u8
),
937 .array_type
= NO_ARRAY
,
939 .offset
= offsetof(struct qmi_wlanfw_cap_resp_msg_v01
,
943 .data_type
= QMI_EOTI
,
944 .array_type
= NO_ARRAY
,
945 .tlv_type
= QMI_COMMON_TLV_TYPE
,
949 static struct qmi_elem_info qmi_wlanfw_bdf_download_req_msg_v01_ei
[] = {
951 .data_type
= QMI_UNSIGNED_1_BYTE
,
953 .elem_size
= sizeof(u8
),
954 .array_type
= NO_ARRAY
,
956 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
960 .data_type
= QMI_OPT_FLAG
,
962 .elem_size
= sizeof(u8
),
963 .array_type
= NO_ARRAY
,
965 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
969 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
971 .elem_size
= sizeof(enum qmi_wlanfw_cal_temp_id_enum_v01
),
972 .array_type
= NO_ARRAY
,
974 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
978 .data_type
= QMI_OPT_FLAG
,
980 .elem_size
= sizeof(u8
),
981 .array_type
= NO_ARRAY
,
983 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
987 .data_type
= QMI_UNSIGNED_4_BYTE
,
989 .elem_size
= sizeof(u32
),
990 .array_type
= NO_ARRAY
,
992 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
996 .data_type
= QMI_OPT_FLAG
,
998 .elem_size
= sizeof(u8
),
999 .array_type
= NO_ARRAY
,
1001 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1005 .data_type
= QMI_UNSIGNED_4_BYTE
,
1007 .elem_size
= sizeof(u32
),
1008 .array_type
= NO_ARRAY
,
1010 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1014 .data_type
= QMI_OPT_FLAG
,
1016 .elem_size
= sizeof(u8
),
1017 .array_type
= NO_ARRAY
,
1019 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1023 .data_type
= QMI_DATA_LEN
,
1025 .elem_size
= sizeof(u16
),
1026 .array_type
= NO_ARRAY
,
1028 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1032 .data_type
= QMI_UNSIGNED_1_BYTE
,
1033 .elem_len
= QMI_WLANFW_MAX_DATA_SIZE_V01
,
1034 .elem_size
= sizeof(u8
),
1035 .array_type
= VAR_LEN_ARRAY
,
1037 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1041 .data_type
= QMI_OPT_FLAG
,
1043 .elem_size
= sizeof(u8
),
1044 .array_type
= NO_ARRAY
,
1046 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1050 .data_type
= QMI_UNSIGNED_1_BYTE
,
1052 .elem_size
= sizeof(u8
),
1053 .array_type
= NO_ARRAY
,
1055 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1059 .data_type
= QMI_OPT_FLAG
,
1061 .elem_size
= sizeof(u8
),
1062 .array_type
= NO_ARRAY
,
1064 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1068 .data_type
= QMI_UNSIGNED_1_BYTE
,
1070 .elem_size
= sizeof(u8
),
1071 .array_type
= NO_ARRAY
,
1073 .offset
= offsetof(struct qmi_wlanfw_bdf_download_req_msg_v01
,
1078 .data_type
= QMI_EOTI
,
1079 .array_type
= NO_ARRAY
,
1080 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1084 static struct qmi_elem_info qmi_wlanfw_bdf_download_resp_msg_v01_ei
[] = {
1086 .data_type
= QMI_STRUCT
,
1088 .elem_size
= sizeof(struct qmi_response_type_v01
),
1089 .array_type
= NO_ARRAY
,
1091 .offset
= offsetof(struct qmi_wlanfw_bdf_download_resp_msg_v01
,
1093 .ei_array
= qmi_response_type_v01_ei
,
1096 .data_type
= QMI_EOTI
,
1097 .array_type
= NO_ARRAY
,
1098 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1102 static struct qmi_elem_info qmi_wlanfw_m3_info_req_msg_v01_ei
[] = {
1104 .data_type
= QMI_UNSIGNED_8_BYTE
,
1106 .elem_size
= sizeof(u64
),
1107 .array_type
= NO_ARRAY
,
1109 .offset
= offsetof(struct qmi_wlanfw_m3_info_req_msg_v01
, addr
),
1112 .data_type
= QMI_UNSIGNED_4_BYTE
,
1114 .elem_size
= sizeof(u32
),
1115 .array_type
= NO_ARRAY
,
1117 .offset
= offsetof(struct qmi_wlanfw_m3_info_req_msg_v01
, size
),
1120 .data_type
= QMI_EOTI
,
1121 .array_type
= NO_ARRAY
,
1122 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1126 static struct qmi_elem_info qmi_wlanfw_m3_info_resp_msg_v01_ei
[] = {
1128 .data_type
= QMI_STRUCT
,
1130 .elem_size
= sizeof(struct qmi_response_type_v01
),
1131 .array_type
= NO_ARRAY
,
1133 .offset
= offsetof(struct qmi_wlanfw_m3_info_resp_msg_v01
, resp
),
1134 .ei_array
= qmi_response_type_v01_ei
,
1137 .data_type
= QMI_EOTI
,
1138 .array_type
= NO_ARRAY
,
1139 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1143 static struct qmi_elem_info qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei
[] = {
1145 .data_type
= QMI_UNSIGNED_4_BYTE
,
1147 .elem_size
= sizeof(u32
),
1148 .array_type
= NO_ARRAY
,
1150 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1154 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
1156 .elem_size
= sizeof(enum qmi_wlanfw_pipedir_enum_v01
),
1157 .array_type
= NO_ARRAY
,
1159 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1163 .data_type
= QMI_UNSIGNED_4_BYTE
,
1165 .elem_size
= sizeof(u32
),
1166 .array_type
= NO_ARRAY
,
1168 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1172 .data_type
= QMI_UNSIGNED_4_BYTE
,
1174 .elem_size
= sizeof(u32
),
1175 .array_type
= NO_ARRAY
,
1177 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1181 .data_type
= QMI_UNSIGNED_4_BYTE
,
1183 .elem_size
= sizeof(u32
),
1184 .array_type
= NO_ARRAY
,
1186 .offset
= offsetof(struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
,
1190 .data_type
= QMI_EOTI
,
1191 .array_type
= NO_ARRAY
,
1192 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1196 static struct qmi_elem_info qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei
[] = {
1198 .data_type
= QMI_UNSIGNED_4_BYTE
,
1200 .elem_size
= sizeof(u32
),
1201 .array_type
= NO_ARRAY
,
1203 .offset
= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
,
1207 .data_type
= QMI_SIGNED_4_BYTE_ENUM
,
1209 .elem_size
= sizeof(enum qmi_wlanfw_pipedir_enum_v01
),
1210 .array_type
= NO_ARRAY
,
1212 .offset
= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
,
1216 .data_type
= QMI_UNSIGNED_4_BYTE
,
1218 .elem_size
= sizeof(u32
),
1219 .array_type
= NO_ARRAY
,
1221 .offset
= offsetof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
,
1225 .data_type
= QMI_EOTI
,
1226 .array_type
= NO_ARRAY
,
1227 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1231 static struct qmi_elem_info qmi_wlanfw_shadow_reg_cfg_s_v01_ei
[] = {
1233 .data_type
= QMI_UNSIGNED_2_BYTE
,
1235 .elem_size
= sizeof(u16
),
1236 .array_type
= NO_ARRAY
,
1238 .offset
= offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01
, id
),
1241 .data_type
= QMI_UNSIGNED_2_BYTE
,
1243 .elem_size
= sizeof(u16
),
1244 .array_type
= NO_ARRAY
,
1246 .offset
= offsetof(struct qmi_wlanfw_shadow_reg_cfg_s_v01
,
1250 .data_type
= QMI_EOTI
,
1251 .array_type
= QMI_COMMON_TLV_TYPE
,
1255 static struct qmi_elem_info qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei
[] = {
1257 .data_type
= QMI_UNSIGNED_4_BYTE
,
1259 .elem_size
= sizeof(u32
),
1260 .array_type
= NO_ARRAY
,
1262 .offset
= offsetof(struct qmi_wlanfw_shadow_reg_v2_cfg_s_v01
,
1266 .data_type
= QMI_EOTI
,
1267 .array_type
= NO_ARRAY
,
1268 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1272 static struct qmi_elem_info qmi_wlanfw_wlan_mode_req_msg_v01_ei
[] = {
1274 .data_type
= QMI_UNSIGNED_4_BYTE
,
1276 .elem_size
= sizeof(u32
),
1277 .array_type
= NO_ARRAY
,
1279 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01
,
1283 .data_type
= QMI_OPT_FLAG
,
1285 .elem_size
= sizeof(u8
),
1286 .array_type
= NO_ARRAY
,
1288 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01
,
1292 .data_type
= QMI_UNSIGNED_1_BYTE
,
1294 .elem_size
= sizeof(u8
),
1295 .array_type
= NO_ARRAY
,
1297 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_req_msg_v01
,
1301 .data_type
= QMI_EOTI
,
1302 .array_type
= NO_ARRAY
,
1303 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1307 static struct qmi_elem_info qmi_wlanfw_wlan_mode_resp_msg_v01_ei
[] = {
1309 .data_type
= QMI_STRUCT
,
1311 .elem_size
= sizeof(struct qmi_response_type_v01
),
1312 .array_type
= NO_ARRAY
,
1314 .offset
= offsetof(struct qmi_wlanfw_wlan_mode_resp_msg_v01
,
1316 .ei_array
= qmi_response_type_v01_ei
,
1319 .data_type
= QMI_EOTI
,
1320 .array_type
= NO_ARRAY
,
1321 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1325 static struct qmi_elem_info qmi_wlanfw_wlan_cfg_req_msg_v01_ei
[] = {
1327 .data_type
= QMI_OPT_FLAG
,
1329 .elem_size
= sizeof(u8
),
1330 .array_type
= NO_ARRAY
,
1332 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1333 host_version_valid
),
1336 .data_type
= QMI_STRING
,
1337 .elem_len
= QMI_WLANFW_MAX_STR_LEN_V01
+ 1,
1338 .elem_size
= sizeof(char),
1339 .array_type
= NO_ARRAY
,
1341 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1345 .data_type
= QMI_OPT_FLAG
,
1347 .elem_size
= sizeof(u8
),
1348 .array_type
= NO_ARRAY
,
1350 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1354 .data_type
= QMI_DATA_LEN
,
1356 .elem_size
= sizeof(u8
),
1357 .array_type
= NO_ARRAY
,
1359 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1363 .data_type
= QMI_STRUCT
,
1364 .elem_len
= QMI_WLANFW_MAX_NUM_CE_V01
,
1365 .elem_size
= sizeof(
1366 struct qmi_wlanfw_ce_tgt_pipe_cfg_s_v01
),
1367 .array_type
= VAR_LEN_ARRAY
,
1369 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1371 .ei_array
= qmi_wlanfw_ce_tgt_pipe_cfg_s_v01_ei
,
1374 .data_type
= QMI_OPT_FLAG
,
1376 .elem_size
= sizeof(u8
),
1377 .array_type
= NO_ARRAY
,
1379 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1383 .data_type
= QMI_DATA_LEN
,
1385 .elem_size
= sizeof(u8
),
1386 .array_type
= NO_ARRAY
,
1388 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1392 .data_type
= QMI_STRUCT
,
1393 .elem_len
= QMI_WLANFW_MAX_NUM_SVC_V01
,
1394 .elem_size
= sizeof(struct qmi_wlanfw_ce_svc_pipe_cfg_s_v01
),
1395 .array_type
= VAR_LEN_ARRAY
,
1397 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1399 .ei_array
= qmi_wlanfw_ce_svc_pipe_cfg_s_v01_ei
,
1402 .data_type
= QMI_OPT_FLAG
,
1404 .elem_size
= sizeof(u8
),
1405 .array_type
= NO_ARRAY
,
1407 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1411 .data_type
= QMI_DATA_LEN
,
1413 .elem_size
= sizeof(u8
),
1414 .array_type
= NO_ARRAY
,
1416 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1420 .data_type
= QMI_STRUCT
,
1421 .elem_len
= QMI_WLANFW_MAX_NUM_SHADOW_REG_V01
,
1422 .elem_size
= sizeof(struct qmi_wlanfw_shadow_reg_cfg_s_v01
),
1423 .array_type
= VAR_LEN_ARRAY
,
1425 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1427 .ei_array
= qmi_wlanfw_shadow_reg_cfg_s_v01_ei
,
1430 .data_type
= QMI_OPT_FLAG
,
1432 .elem_size
= sizeof(u8
),
1433 .array_type
= NO_ARRAY
,
1435 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1436 shadow_reg_v2_valid
),
1439 .data_type
= QMI_DATA_LEN
,
1441 .elem_size
= sizeof(u8
),
1442 .array_type
= NO_ARRAY
,
1444 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1448 .data_type
= QMI_STRUCT
,
1449 .elem_len
= QMI_WLANFW_MAX_NUM_SHADOW_REG_V2_V01
,
1450 .elem_size
= sizeof(struct qmi_wlanfw_shadow_reg_v2_cfg_s_v01
),
1451 .array_type
= VAR_LEN_ARRAY
,
1453 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_req_msg_v01
,
1455 .ei_array
= qmi_wlanfw_shadow_reg_v2_cfg_s_v01_ei
,
1458 .data_type
= QMI_EOTI
,
1459 .array_type
= NO_ARRAY
,
1460 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1464 static struct qmi_elem_info qmi_wlanfw_wlan_cfg_resp_msg_v01_ei
[] = {
1466 .data_type
= QMI_STRUCT
,
1468 .elem_size
= sizeof(struct qmi_response_type_v01
),
1469 .array_type
= NO_ARRAY
,
1471 .offset
= offsetof(struct qmi_wlanfw_wlan_cfg_resp_msg_v01
, resp
),
1472 .ei_array
= qmi_response_type_v01_ei
,
1475 .data_type
= QMI_EOTI
,
1476 .array_type
= NO_ARRAY
,
1477 .tlv_type
= QMI_COMMON_TLV_TYPE
,
1481 static struct qmi_elem_info qmi_wlanfw_mem_ready_ind_msg_v01_ei
[] = {
1483 .data_type
= QMI_EOTI
,
1484 .array_type
= NO_ARRAY
,
1488 static struct qmi_elem_info qmi_wlanfw_fw_ready_ind_msg_v01_ei
[] = {
1490 .data_type
= QMI_EOTI
,
1491 .array_type
= NO_ARRAY
,
1495 static struct qmi_elem_info qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei
[] = {
1497 .data_type
= QMI_EOTI
,
1498 .array_type
= NO_ARRAY
,
1502 static int ath11k_qmi_host_cap_send(struct ath11k_base
*ab
)
1504 struct qmi_wlanfw_host_cap_req_msg_v01 req
;
1505 struct qmi_wlanfw_host_cap_resp_msg_v01 resp
;
1506 struct qmi_txn txn
= {};
1509 memset(&req
, 0, sizeof(req
));
1510 memset(&resp
, 0, sizeof(resp
));
1512 req
.num_clients_valid
= 1;
1513 req
.num_clients
= 1;
1514 req
.mem_cfg_mode
= ab
->qmi
.target_mem_mode
;
1515 req
.mem_cfg_mode_valid
= 1;
1516 req
.bdf_support_valid
= 1;
1517 req
.bdf_support
= 1;
1519 req
.m3_support_valid
= 0;
1522 req
.m3_cache_support_valid
= 0;
1523 req
.m3_cache_support
= 0;
1525 req
.cal_done_valid
= 1;
1526 req
.cal_done
= ab
->qmi
.cal_done
;
1528 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1529 qmi_wlanfw_host_cap_resp_msg_v01_ei
, &resp
);
1533 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1534 QMI_WLANFW_HOST_CAP_REQ_V01
,
1535 QMI_WLANFW_HOST_CAP_REQ_MSG_V01_MAX_LEN
,
1536 qmi_wlanfw_host_cap_req_msg_v01_ei
, &req
);
1538 ath11k_warn(ab
, "Failed to send host capability request,err = %d\n", ret
);
1542 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1546 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1547 ath11k_warn(ab
, "Host capability request failed, result: %d, err: %d\n",
1548 resp
.resp
.result
, resp
.resp
.error
);
1557 static int ath11k_qmi_fw_ind_register_send(struct ath11k_base
*ab
)
1559 struct qmi_wlanfw_ind_register_req_msg_v01
*req
;
1560 struct qmi_wlanfw_ind_register_resp_msg_v01
*resp
;
1561 struct qmi_handle
*handle
= &ab
->qmi
.handle
;
1565 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
1569 resp
= kzalloc(sizeof(*resp
), GFP_KERNEL
);
1573 req
->client_id_valid
= 1;
1574 req
->client_id
= QMI_WLANFW_CLIENT_ID
;
1575 req
->fw_ready_enable_valid
= 1;
1576 req
->fw_ready_enable
= 1;
1577 req
->request_mem_enable_valid
= 1;
1578 req
->request_mem_enable
= 1;
1579 req
->fw_mem_ready_enable_valid
= 1;
1580 req
->fw_mem_ready_enable
= 1;
1581 req
->cal_done_enable_valid
= 1;
1582 req
->cal_done_enable
= 1;
1583 req
->fw_init_done_enable_valid
= 1;
1584 req
->fw_init_done_enable
= 1;
1586 req
->pin_connect_result_enable_valid
= 0;
1587 req
->pin_connect_result_enable
= 0;
1589 ret
= qmi_txn_init(handle
, &txn
,
1590 qmi_wlanfw_ind_register_resp_msg_v01_ei
, resp
);
1594 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1595 QMI_WLANFW_IND_REGISTER_REQ_V01
,
1596 QMI_WLANFW_IND_REGISTER_REQ_MSG_V01_MAX_LEN
,
1597 qmi_wlanfw_ind_register_req_msg_v01_ei
, req
);
1599 ath11k_warn(ab
, "Failed to send indication register request, err = %d\n",
1604 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1606 ath11k_warn(ab
, "failed to register fw indication %d\n", ret
);
1610 if (resp
->resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1611 ath11k_warn(ab
, "FW Ind register request failed, result: %d, err: %d\n",
1612 resp
->resp
.result
, resp
->resp
.error
);
1624 static int ath11k_qmi_respond_fw_mem_request(struct ath11k_base
*ab
)
1626 struct qmi_wlanfw_respond_mem_req_msg_v01
*req
;
1627 struct qmi_wlanfw_respond_mem_resp_msg_v01 resp
;
1628 struct qmi_txn txn
= {};
1631 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
1635 memset(&resp
, 0, sizeof(resp
));
1637 req
->mem_seg_len
= ab
->qmi
.mem_seg_count
;
1639 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1640 qmi_wlanfw_respond_mem_resp_msg_v01_ei
, &resp
);
1644 for (i
= 0; i
< req
->mem_seg_len
; i
++) {
1645 req
->mem_seg
[i
].addr
= ab
->qmi
.target_mem
[i
].paddr
;
1646 req
->mem_seg
[i
].size
= ab
->qmi
.target_mem
[i
].size
;
1647 req
->mem_seg
[i
].type
= ab
->qmi
.target_mem
[i
].type
;
1650 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1651 QMI_WLANFW_RESPOND_MEM_REQ_V01
,
1652 QMI_WLANFW_RESPOND_MEM_REQ_MSG_V01_MAX_LEN
,
1653 qmi_wlanfw_respond_mem_req_msg_v01_ei
, req
);
1655 ath11k_warn(ab
, "qmi failed to respond memory request, err = %d\n",
1660 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1662 ath11k_warn(ab
, "qmi failed memory request, err = %d\n", ret
);
1666 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1667 ath11k_warn(ab
, "Respond mem req failed, result: %d, err: %d\n",
1668 resp
.resp
.result
, resp
.resp
.error
);
1677 static int ath11k_qmi_alloc_target_mem_chunk(struct ath11k_base
*ab
)
1681 for (i
= 0, idx
= 0; i
< ab
->qmi
.mem_seg_count
; i
++) {
1682 switch (ab
->qmi
.target_mem
[i
].type
) {
1683 case BDF_MEM_REGION_TYPE
:
1684 ab
->qmi
.target_mem
[idx
].paddr
= ATH11K_QMI_BDF_ADDRESS
;
1685 ab
->qmi
.target_mem
[idx
].vaddr
= ATH11K_QMI_BDF_ADDRESS
;
1686 ab
->qmi
.target_mem
[idx
].size
= ab
->qmi
.target_mem
[i
].size
;
1687 ab
->qmi
.target_mem
[idx
].type
= ab
->qmi
.target_mem
[i
].type
;
1690 case CALDB_MEM_REGION_TYPE
:
1691 if (ab
->qmi
.target_mem
[i
].size
> ATH11K_QMI_CALDB_SIZE
) {
1692 ath11k_warn(ab
, "qmi mem size is low to load caldata\n");
1695 /* TODO ath11k does not support cold boot calibration */
1696 ab
->qmi
.target_mem
[idx
].paddr
= 0;
1697 ab
->qmi
.target_mem
[idx
].vaddr
= 0;
1698 ab
->qmi
.target_mem
[idx
].size
= ab
->qmi
.target_mem
[i
].size
;
1699 ab
->qmi
.target_mem
[idx
].type
= ab
->qmi
.target_mem
[i
].type
;
1703 ath11k_warn(ab
, "qmi ignore invalid mem req type %d\n",
1704 ab
->qmi
.target_mem
[i
].type
);
1708 ab
->qmi
.mem_seg_count
= idx
;
1713 static int ath11k_qmi_request_target_cap(struct ath11k_base
*ab
)
1715 struct qmi_wlanfw_cap_req_msg_v01 req
;
1716 struct qmi_wlanfw_cap_resp_msg_v01 resp
;
1717 struct qmi_txn txn
= {};
1720 memset(&req
, 0, sizeof(req
));
1721 memset(&resp
, 0, sizeof(resp
));
1723 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1724 qmi_wlanfw_cap_resp_msg_v01_ei
, &resp
);
1728 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1729 QMI_WLANFW_CAP_REQ_V01
,
1730 QMI_WLANFW_CAP_REQ_MSG_V01_MAX_LEN
,
1731 qmi_wlanfw_cap_req_msg_v01_ei
, &req
);
1733 ath11k_warn(ab
, "qmi failed to send target cap request, err = %d\n",
1738 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1740 ath11k_warn(ab
, "qmi failed target cap request %d\n", ret
);
1744 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1745 ath11k_warn(ab
, "qmi targetcap req failed, result: %d, err: %d\n",
1746 resp
.resp
.result
, resp
.resp
.error
);
1751 if (resp
.chip_info_valid
) {
1752 ab
->qmi
.target
.chip_id
= resp
.chip_info
.chip_id
;
1753 ab
->qmi
.target
.chip_family
= resp
.chip_info
.chip_family
;
1756 if (resp
.board_info_valid
)
1757 ab
->qmi
.target
.board_id
= resp
.board_info
.board_id
;
1759 ab
->qmi
.target
.board_id
= 0xFF;
1761 if (resp
.soc_info_valid
)
1762 ab
->qmi
.target
.soc_id
= resp
.soc_info
.soc_id
;
1764 if (resp
.fw_version_info_valid
) {
1765 ab
->qmi
.target
.fw_version
= resp
.fw_version_info
.fw_version
;
1766 strlcpy(ab
->qmi
.target
.fw_build_timestamp
,
1767 resp
.fw_version_info
.fw_build_timestamp
,
1768 sizeof(ab
->qmi
.target
.fw_build_timestamp
));
1771 if (resp
.fw_build_id_valid
)
1772 strlcpy(ab
->qmi
.target
.fw_build_id
, resp
.fw_build_id
,
1773 sizeof(ab
->qmi
.target
.fw_build_id
));
1775 ath11k_info(ab
, "qmi target: chip_id: 0x%x, chip_family: 0x%x, board_id: 0x%x, soc_id: 0x%x\n",
1776 ab
->qmi
.target
.chip_id
, ab
->qmi
.target
.chip_family
,
1777 ab
->qmi
.target
.board_id
, ab
->qmi
.target
.soc_id
);
1779 ath11k_info(ab
, "qmi fw_version: 0x%x fw_build_timestamp: %s fw_build_id: %s",
1780 ab
->qmi
.target
.fw_version
,
1781 ab
->qmi
.target
.fw_build_timestamp
,
1782 ab
->qmi
.target
.fw_build_id
);
1789 ath11k_qmi_prepare_bdf_download(struct ath11k_base
*ab
, int type
,
1790 struct qmi_wlanfw_bdf_download_req_msg_v01
*req
,
1791 void __iomem
*bdf_addr
)
1793 struct device
*dev
= ab
->dev
;
1794 char filename
[ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE
];
1795 const struct firmware
*fw_entry
;
1796 struct ath11k_board_data bd
;
1800 memset(&bd
, 0, sizeof(bd
));
1803 case ATH11K_QMI_FILE_TYPE_BDF_GOLDEN
:
1804 ret
= ath11k_core_fetch_bdf(ab
, &bd
);
1806 ath11k_warn(ab
, "qmi failed to load BDF\n");
1810 fw_size
= min_t(u32
, ab
->hw_params
.fw
.board_size
, bd
.len
);
1811 memcpy_toio(bdf_addr
, bd
.data
, fw_size
);
1812 ath11k_core_free_bdf(ab
, &bd
);
1814 case ATH11K_QMI_FILE_TYPE_CALDATA
:
1815 snprintf(filename
, sizeof(filename
),
1816 "%s/%s", ab
->hw_params
.fw
.dir
, ATH11K_QMI_DEFAULT_CAL_FILE_NAME
);
1817 ret
= request_firmware(&fw_entry
, filename
, dev
);
1819 ath11k_warn(ab
, "qmi failed to load CAL: %s\n", filename
);
1823 fw_size
= min_t(u32
, ab
->hw_params
.fw
.board_size
,
1826 memcpy_toio(bdf_addr
+ ATH11K_QMI_CALDATA_OFFSET
,
1827 fw_entry
->data
, fw_size
);
1828 ath11k_info(ab
, "qmi downloading BDF: %s, size: %zu\n",
1829 filename
, fw_entry
->size
);
1831 release_firmware(fw_entry
);
1838 req
->total_size
= fw_size
;
1844 static int ath11k_qmi_load_bdf(struct ath11k_base
*ab
)
1846 struct qmi_wlanfw_bdf_download_req_msg_v01
*req
;
1847 struct qmi_wlanfw_bdf_download_resp_msg_v01 resp
;
1848 struct qmi_txn txn
= {};
1849 void __iomem
*bdf_addr
= NULL
;
1852 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
1855 memset(&resp
, 0, sizeof(resp
));
1857 bdf_addr
= ioremap(ATH11K_QMI_BDF_ADDRESS
, ATH11K_QMI_BDF_MAX_SIZE
);
1859 ath11k_warn(ab
, "qmi ioremap error for BDF\n");
1864 for (type
= 0; type
< ATH11K_QMI_MAX_FILE_TYPE
; type
++) {
1866 req
->file_id_valid
= 1;
1867 req
->file_id
= ab
->qmi
.target
.board_id
;
1868 req
->total_size_valid
= 1;
1869 req
->seg_id_valid
= 1;
1871 req
->data_valid
= 0;
1872 req
->data_len
= ATH11K_QMI_MAX_BDF_FILE_NAME_SIZE
;
1874 req
->bdf_type_valid
= 0;
1878 ret
= ath11k_qmi_prepare_bdf_download(ab
, type
, req
, bdf_addr
);
1882 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1883 qmi_wlanfw_bdf_download_resp_msg_v01_ei
,
1888 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1889 QMI_WLANFW_BDF_DOWNLOAD_REQ_V01
,
1890 QMI_WLANFW_BDF_DOWNLOAD_REQ_MSG_V01_MAX_LEN
,
1891 qmi_wlanfw_bdf_download_req_msg_v01_ei
, req
);
1893 qmi_txn_cancel(&txn
);
1897 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1901 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1902 ath11k_warn(ab
, "qmi BDF download failed, result: %d, err: %d\n",
1903 resp
.resp
.result
, resp
.resp
.error
);
1908 ath11k_info(ab
, "qmi BDF downloaded\n");
1917 static int ath11k_qmi_wlanfw_m3_info_send(struct ath11k_base
*ab
)
1919 struct qmi_wlanfw_m3_info_req_msg_v01 req
;
1920 struct qmi_wlanfw_m3_info_resp_msg_v01 resp
;
1921 struct qmi_txn txn
= {};
1924 memset(&req
, 0, sizeof(req
));
1925 memset(&resp
, 0, sizeof(resp
));
1929 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1930 qmi_wlanfw_m3_info_resp_msg_v01_ei
, &resp
);
1934 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1935 QMI_WLANFW_M3_INFO_REQ_V01
,
1936 QMI_WLANFW_M3_INFO_REQ_MSG_V01_MAX_MSG_LEN
,
1937 qmi_wlanfw_m3_info_req_msg_v01_ei
, &req
);
1939 ath11k_warn(ab
, "qmi failed to send M3 information request, err = %d\n",
1944 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1946 ath11k_warn(ab
, "qmi failed M3 information request %d\n", ret
);
1950 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
1951 ath11k_warn(ab
, "qmi M3 info request failed, result: %d, err: %d\n",
1952 resp
.resp
.result
, resp
.resp
.error
);
1960 static int ath11k_qmi_wlanfw_mode_send(struct ath11k_base
*ab
,
1963 struct qmi_wlanfw_wlan_mode_req_msg_v01 req
;
1964 struct qmi_wlanfw_wlan_mode_resp_msg_v01 resp
;
1965 struct qmi_txn txn
= {};
1968 memset(&req
, 0, sizeof(req
));
1969 memset(&resp
, 0, sizeof(resp
));
1972 req
.hw_debug_valid
= 1;
1975 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
1976 qmi_wlanfw_wlan_mode_resp_msg_v01_ei
, &resp
);
1980 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
1981 QMI_WLANFW_WLAN_MODE_REQ_V01
,
1982 QMI_WLANFW_WLAN_MODE_REQ_MSG_V01_MAX_LEN
,
1983 qmi_wlanfw_wlan_mode_req_msg_v01_ei
, &req
);
1985 ath11k_warn(ab
, "qmi failed to send mode request, mode: %d, err = %d\n",
1990 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
1992 if (mode
== ATH11K_FIRMWARE_MODE_OFF
&& ret
== -ENETRESET
) {
1993 ath11k_warn(ab
, "WLFW service is dis-connected\n");
1996 ath11k_warn(ab
, "qmi failed set mode request, mode: %d, err = %d\n",
2001 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2002 ath11k_warn(ab
, "Mode request failed, mode: %d, result: %d err: %d\n",
2003 mode
, resp
.resp
.result
, resp
.resp
.error
);
2012 static int ath11k_qmi_wlanfw_wlan_cfg_send(struct ath11k_base
*ab
)
2014 struct qmi_wlanfw_wlan_cfg_req_msg_v01
*req
;
2015 struct qmi_wlanfw_wlan_cfg_resp_msg_v01 resp
;
2016 struct ce_pipe_config
*ce_cfg
;
2017 struct service_to_pipe
*svc_cfg
;
2018 struct qmi_txn txn
= {};
2019 int ret
= 0, pipe_num
;
2021 ce_cfg
= (struct ce_pipe_config
*)ab
->qmi
.ce_cfg
.tgt_ce
;
2022 svc_cfg
= (struct service_to_pipe
*)ab
->qmi
.ce_cfg
.svc_to_ce_map
;
2024 req
= kzalloc(sizeof(*req
), GFP_KERNEL
);
2028 memset(&resp
, 0, sizeof(resp
));
2030 req
->host_version_valid
= 1;
2031 strlcpy(req
->host_version
, ATH11K_HOST_VERSION_STRING
,
2032 sizeof(req
->host_version
));
2034 req
->tgt_cfg_valid
= 1;
2035 /* This is number of CE configs */
2036 req
->tgt_cfg_len
= ab
->qmi
.ce_cfg
.tgt_ce_len
;
2037 for (pipe_num
= 0; pipe_num
<= req
->tgt_cfg_len
; pipe_num
++) {
2038 req
->tgt_cfg
[pipe_num
].pipe_num
= ce_cfg
[pipe_num
].pipenum
;
2039 req
->tgt_cfg
[pipe_num
].pipe_dir
= ce_cfg
[pipe_num
].pipedir
;
2040 req
->tgt_cfg
[pipe_num
].nentries
= ce_cfg
[pipe_num
].nentries
;
2041 req
->tgt_cfg
[pipe_num
].nbytes_max
= ce_cfg
[pipe_num
].nbytes_max
;
2042 req
->tgt_cfg
[pipe_num
].flags
= ce_cfg
[pipe_num
].flags
;
2045 req
->svc_cfg_valid
= 1;
2046 /* This is number of Service/CE configs */
2047 req
->svc_cfg_len
= ab
->qmi
.ce_cfg
.svc_to_ce_map_len
;
2048 for (pipe_num
= 0; pipe_num
< req
->svc_cfg_len
; pipe_num
++) {
2049 req
->svc_cfg
[pipe_num
].service_id
= svc_cfg
[pipe_num
].service_id
;
2050 req
->svc_cfg
[pipe_num
].pipe_dir
= svc_cfg
[pipe_num
].pipedir
;
2051 req
->svc_cfg
[pipe_num
].pipe_num
= svc_cfg
[pipe_num
].pipenum
;
2053 req
->shadow_reg_valid
= 0;
2054 req
->shadow_reg_v2_valid
= 0;
2056 ret
= qmi_txn_init(&ab
->qmi
.handle
, &txn
,
2057 qmi_wlanfw_wlan_cfg_resp_msg_v01_ei
, &resp
);
2061 ret
= qmi_send_request(&ab
->qmi
.handle
, NULL
, &txn
,
2062 QMI_WLANFW_WLAN_CFG_REQ_V01
,
2063 QMI_WLANFW_WLAN_CFG_REQ_MSG_V01_MAX_LEN
,
2064 qmi_wlanfw_wlan_cfg_req_msg_v01_ei
, req
);
2066 ath11k_warn(ab
, "qmi failed to send wlan config request, err = %d\n",
2071 ret
= qmi_txn_wait(&txn
, msecs_to_jiffies(ATH11K_QMI_WLANFW_TIMEOUT_MS
));
2073 ath11k_warn(ab
, "qmi failed wlan config request, err = %d\n", ret
);
2077 if (resp
.resp
.result
!= QMI_RESULT_SUCCESS_V01
) {
2078 ath11k_warn(ab
, "qmi wlan config request failed, result: %d, err: %d\n",
2079 resp
.resp
.result
, resp
.resp
.error
);
2089 void ath11k_qmi_firmware_stop(struct ath11k_base
*ab
)
2093 ret
= ath11k_qmi_wlanfw_mode_send(ab
, ATH11K_FIRMWARE_MODE_OFF
);
2095 ath11k_warn(ab
, "qmi failed to send wlan mode off\n");
2100 int ath11k_qmi_firmware_start(struct ath11k_base
*ab
,
2105 ret
= ath11k_qmi_wlanfw_wlan_cfg_send(ab
);
2107 ath11k_warn(ab
, "qmi failed to send wlan cfg:%d\n", ret
);
2111 ret
= ath11k_qmi_wlanfw_mode_send(ab
, mode
);
2113 ath11k_warn(ab
, "qmi failed to send wlan fw mode:%d\n", ret
);
2121 ath11k_qmi_driver_event_post(struct ath11k_qmi
*qmi
,
2122 enum ath11k_qmi_event_type type
,
2125 struct ath11k_qmi_driver_event
*event
;
2127 event
= kzalloc(sizeof(*event
), GFP_ATOMIC
);
2134 spin_lock(&qmi
->event_lock
);
2135 list_add_tail(&event
->list
, &qmi
->event_list
);
2136 spin_unlock(&qmi
->event_lock
);
2138 queue_work(qmi
->event_wq
, &qmi
->event_work
);
2143 static void ath11k_qmi_event_server_arrive(struct ath11k_qmi
*qmi
)
2145 struct ath11k_base
*ab
= qmi
->ab
;
2148 ret
= ath11k_qmi_fw_ind_register_send(ab
);
2150 ath11k_warn(ab
, "qmi failed to send FW indication QMI:%d\n", ret
);
2154 ret
= ath11k_qmi_host_cap_send(ab
);
2156 ath11k_warn(ab
, "qmi failed to send host cap QMI:%d\n", ret
);
2161 static void ath11k_qmi_event_mem_request(struct ath11k_qmi
*qmi
)
2163 struct ath11k_base
*ab
= qmi
->ab
;
2166 ret
= ath11k_qmi_respond_fw_mem_request(ab
);
2168 ath11k_warn(ab
, "qmi failed to respond fw mem req:%d\n", ret
);
2173 static void ath11k_qmi_event_load_bdf(struct ath11k_qmi
*qmi
)
2175 struct ath11k_base
*ab
= qmi
->ab
;
2178 ret
= ath11k_qmi_request_target_cap(ab
);
2180 ath11k_warn(ab
, "qmi failed to req target capabilities:%d\n", ret
);
2184 ret
= ath11k_qmi_load_bdf(ab
);
2186 ath11k_warn(ab
, "qmi failed to load board data file:%d\n", ret
);
2190 ret
= ath11k_qmi_wlanfw_m3_info_send(ab
);
2192 ath11k_warn(ab
, "qmi failed to send m3 info req:%d\n", ret
);
2197 static void ath11k_qmi_msg_mem_request_cb(struct qmi_handle
*qmi_hdl
,
2198 struct sockaddr_qrtr
*sq
,
2199 struct qmi_txn
*txn
,
2202 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
2203 struct ath11k_base
*ab
= qmi
->ab
;
2204 const struct qmi_wlanfw_request_mem_ind_msg_v01
*msg
= data
;
2207 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "qmi firmware request memory request\n");
2209 if (msg
->mem_seg_len
== 0 ||
2210 msg
->mem_seg_len
> ATH11K_QMI_WLANFW_MAX_NUM_MEM_SEG_V01
)
2211 ath11k_warn(ab
, "Invalid memory segment length: %u\n",
2214 ab
->qmi
.mem_seg_count
= msg
->mem_seg_len
;
2216 for (i
= 0; i
< qmi
->mem_seg_count
; i
++) {
2217 ab
->qmi
.target_mem
[i
].type
= msg
->mem_seg
[i
].type
;
2218 ab
->qmi
.target_mem
[i
].size
= msg
->mem_seg
[i
].size
;
2219 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "qmi mem seg type %d size %d\n",
2220 msg
->mem_seg
[i
].type
, msg
->mem_seg
[i
].size
);
2223 ret
= ath11k_qmi_alloc_target_mem_chunk(ab
);
2225 ath11k_warn(ab
, "qmi failed to alloc target memory:%d\n", ret
);
2229 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_REQUEST_MEM
, NULL
);
2232 static void ath11k_qmi_msg_mem_ready_cb(struct qmi_handle
*qmi_hdl
,
2233 struct sockaddr_qrtr
*sq
,
2234 struct qmi_txn
*txn
,
2235 const void *decoded
)
2237 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
2238 struct ath11k_base
*ab
= qmi
->ab
;
2240 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "qmi firmware memory ready indication\n");
2241 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_FW_MEM_READY
, NULL
);
2244 static void ath11k_qmi_msg_fw_ready_cb(struct qmi_handle
*qmi_hdl
,
2245 struct sockaddr_qrtr
*sq
,
2246 struct qmi_txn
*txn
,
2247 const void *decoded
)
2249 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
2250 struct ath11k_base
*ab
= qmi
->ab
;
2252 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "qmi firmware ready\n");
2253 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_FW_READY
, NULL
);
2256 static void ath11k_qmi_msg_cold_boot_cal_done_cb(struct qmi_handle
*qmi
,
2257 struct sockaddr_qrtr
*sq
,
2258 struct qmi_txn
*txn
,
2259 const void *decoded
)
2263 static const struct qmi_msg_handler ath11k_qmi_msg_handlers
[] = {
2265 .type
= QMI_INDICATION
,
2266 .msg_id
= QMI_WLFW_REQUEST_MEM_IND_V01
,
2267 .ei
= qmi_wlanfw_request_mem_ind_msg_v01_ei
,
2268 .decoded_size
= sizeof(qmi_wlanfw_request_mem_ind_msg_v01_ei
),
2269 .fn
= ath11k_qmi_msg_mem_request_cb
,
2272 .type
= QMI_INDICATION
,
2273 .msg_id
= QMI_WLFW_FW_MEM_READY_IND_V01
,
2274 .ei
= qmi_wlanfw_mem_ready_ind_msg_v01_ei
,
2275 .decoded_size
= sizeof(qmi_wlanfw_mem_ready_ind_msg_v01_ei
),
2276 .fn
= ath11k_qmi_msg_mem_ready_cb
,
2279 .type
= QMI_INDICATION
,
2280 .msg_id
= QMI_WLFW_FW_READY_IND_V01
,
2281 .ei
= qmi_wlanfw_fw_ready_ind_msg_v01_ei
,
2282 .decoded_size
= sizeof(qmi_wlanfw_fw_ready_ind_msg_v01_ei
),
2283 .fn
= ath11k_qmi_msg_fw_ready_cb
,
2286 .type
= QMI_INDICATION
,
2287 .msg_id
= QMI_WLFW_COLD_BOOT_CAL_DONE_IND_V01
,
2288 .ei
= qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei
,
2290 sizeof(qmi_wlanfw_cold_boot_cal_done_ind_msg_v01_ei
),
2291 .fn
= ath11k_qmi_msg_cold_boot_cal_done_cb
,
2295 static int ath11k_qmi_ops_new_server(struct qmi_handle
*qmi_hdl
,
2296 struct qmi_service
*service
)
2298 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
2299 struct ath11k_base
*ab
= qmi
->ab
;
2300 struct sockaddr_qrtr
*sq
= &qmi
->sq
;
2303 sq
->sq_family
= AF_QIPCRTR
;
2304 sq
->sq_node
= service
->node
;
2305 sq
->sq_port
= service
->port
;
2307 ret
= kernel_connect(qmi_hdl
->sock
, (struct sockaddr
*)sq
,
2310 ath11k_warn(ab
, "qmi failed to connect to remote service %d\n", ret
);
2314 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "qmi wifi fw qmi service connected\n");
2315 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_SERVER_ARRIVE
, NULL
);
2320 static void ath11k_qmi_ops_del_server(struct qmi_handle
*qmi_hdl
,
2321 struct qmi_service
*service
)
2323 struct ath11k_qmi
*qmi
= container_of(qmi_hdl
, struct ath11k_qmi
, handle
);
2324 struct ath11k_base
*ab
= qmi
->ab
;
2326 ath11k_dbg(ab
, ATH11K_DBG_QMI
, "qmi wifi fw del server\n");
2327 ath11k_qmi_driver_event_post(qmi
, ATH11K_QMI_EVENT_SERVER_EXIT
, NULL
);
2330 static const struct qmi_ops ath11k_qmi_ops
= {
2331 .new_server
= ath11k_qmi_ops_new_server
,
2332 .del_server
= ath11k_qmi_ops_del_server
,
2335 static void ath11k_qmi_driver_event_work(struct work_struct
*work
)
2337 struct ath11k_qmi
*qmi
= container_of(work
, struct ath11k_qmi
,
2339 struct ath11k_qmi_driver_event
*event
;
2340 struct ath11k_base
*ab
= qmi
->ab
;
2342 spin_lock(&qmi
->event_lock
);
2343 while (!list_empty(&qmi
->event_list
)) {
2344 event
= list_first_entry(&qmi
->event_list
,
2345 struct ath11k_qmi_driver_event
, list
);
2346 list_del(&event
->list
);
2347 spin_unlock(&qmi
->event_lock
);
2349 if (test_bit(ATH11K_FLAG_UNREGISTERING
, &ab
->dev_flags
))
2352 switch (event
->type
) {
2353 case ATH11K_QMI_EVENT_SERVER_ARRIVE
:
2354 ath11k_qmi_event_server_arrive(qmi
);
2356 case ATH11K_QMI_EVENT_SERVER_EXIT
:
2357 set_bit(ATH11K_FLAG_CRASH_FLUSH
, &ab
->dev_flags
);
2358 set_bit(ATH11K_FLAG_RECOVERY
, &ab
->dev_flags
);
2360 case ATH11K_QMI_EVENT_REQUEST_MEM
:
2361 ath11k_qmi_event_mem_request(qmi
);
2363 case ATH11K_QMI_EVENT_FW_MEM_READY
:
2364 ath11k_qmi_event_load_bdf(qmi
);
2366 case ATH11K_QMI_EVENT_FW_READY
:
2367 if (test_bit(ATH11K_FLAG_REGISTERED
, &ab
->dev_flags
)) {
2368 queue_work(ab
->workqueue
, &ab
->restart_work
);
2372 ath11k_core_qmi_firmware_ready(ab
);
2373 ab
->qmi
.cal_done
= 1;
2374 set_bit(ATH11K_FLAG_REGISTERED
, &ab
->dev_flags
);
2377 case ATH11K_QMI_EVENT_COLD_BOOT_CAL_DONE
:
2380 ath11k_warn(ab
, "invalid event type: %d", event
->type
);
2384 spin_lock(&qmi
->event_lock
);
2386 spin_unlock(&qmi
->event_lock
);
2389 int ath11k_qmi_init_service(struct ath11k_base
*ab
)
2393 memset(&ab
->qmi
.target
, 0, sizeof(struct target_info
));
2394 memset(&ab
->qmi
.target_mem
, 0, sizeof(struct target_mem_chunk
));
2397 ab
->qmi
.target_mem_mode
= ATH11K_QMI_TARGET_MEM_MODE_DEFAULT
;
2398 ret
= qmi_handle_init(&ab
->qmi
.handle
, ATH11K_QMI_RESP_LEN_MAX
,
2399 &ath11k_qmi_ops
, ath11k_qmi_msg_handlers
);
2401 ath11k_warn(ab
, "failed to initialize qmi handle\n");
2405 ab
->qmi
.event_wq
= alloc_workqueue("ath11k_qmi_driver_event",
2407 if (!ab
->qmi
.event_wq
) {
2408 ath11k_err(ab
, "failed to allocate workqueue\n");
2412 INIT_LIST_HEAD(&ab
->qmi
.event_list
);
2413 spin_lock_init(&ab
->qmi
.event_lock
);
2414 INIT_WORK(&ab
->qmi
.event_work
, ath11k_qmi_driver_event_work
);
2416 ret
= qmi_add_lookup(&ab
->qmi
.handle
, ATH11K_QMI_WLFW_SERVICE_ID_V01
,
2417 ATH11K_QMI_WLFW_SERVICE_VERS_V01
,
2418 ATH11K_QMI_WLFW_SERVICE_INS_ID_V01
);
2420 ath11k_warn(ab
, "failed to add qmi lookup\n");
2427 void ath11k_qmi_deinit_service(struct ath11k_base
*ab
)
2429 qmi_handle_release(&ab
->qmi
.handle
);
2430 cancel_work_sync(&ab
->qmi
.event_work
);
2431 destroy_workqueue(ab
->qmi
.event_wq
);