1 /* 2 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 #include "os_if_qmi_wifi_driver_service_v01.h" 18 #include <linux/module.h> 19 20 struct qmi_elem_info wfds_gen_resp_msg_v01_ei[] = { 21 { 22 .data_type = QMI_STRUCT, 23 .elem_len = 1, 24 .elem_size = sizeof(struct qmi_response_type_v01), 25 .array_type = NO_ARRAY, 26 .tlv_type = 0x02, 27 .offset = offsetof(struct wfds_gen_resp_msg_v01, 28 resp), 29 .ei_array = qmi_response_type_v01_ei, 30 }, 31 { 32 .data_type = QMI_EOTI, 33 .array_type = NO_ARRAY, 34 .tlv_type = QMI_COMMON_TLV_TYPE, 35 }, 36 }; 37 38 static struct qmi_elem_info wifi_drv_qmi_srng_information_v01_ei[] = { 39 { 40 .data_type = QMI_UNSIGNED_1_BYTE, 41 .elem_len = 1, 42 .elem_size = sizeof(u8), 43 .array_type = NO_ARRAY, 44 .tlv_type = 0, 45 .offset = offsetof(struct wifi_drv_qmi_srng_information_v01, 46 ring_id), 47 }, 48 { 49 .data_type = QMI_SIGNED_4_BYTE_ENUM, 50 .elem_len = 1, 51 .elem_size = sizeof(enum wifi_drv_qmi_srng_direction_v01), 52 .array_type = NO_ARRAY, 53 .tlv_type = 0, 54 .offset = offsetof(struct wifi_drv_qmi_srng_information_v01, 55 dir), 56 }, 57 { 58 .data_type = QMI_UNSIGNED_4_BYTE, 59 .elem_len = 1, 60 .elem_size = sizeof(u32), 61 .array_type = NO_ARRAY, 62 .tlv_type = 0, 63 .offset = offsetof(struct wifi_drv_qmi_srng_information_v01, 64 num_entries), 65 }, 66 { 67 .data_type = QMI_UNSIGNED_4_BYTE, 68 .elem_len = 1, 69 .elem_size = sizeof(u32), 70 .array_type = NO_ARRAY, 71 .tlv_type = 0, 72 .offset = offsetof(struct wifi_drv_qmi_srng_information_v01, 73 entry_size), 74 }, 75 { 76 .data_type = QMI_UNSIGNED_8_BYTE, 77 .elem_len = 1, 78 .elem_size = sizeof(u64), 79 .array_type = NO_ARRAY, 80 .tlv_type = 0, 81 .offset = offsetof(struct wifi_drv_qmi_srng_information_v01, 82 ring_base_paddr), 83 }, 84 { 85 .data_type = QMI_UNSIGNED_8_BYTE, 86 .elem_len = 1, 87 .elem_size = sizeof(u64), 88 .array_type = NO_ARRAY, 89 .tlv_type = 0, 90 .offset = offsetof(struct wifi_drv_qmi_srng_information_v01, 91 hp_paddr), 92 }, 93 { 94 .data_type = QMI_UNSIGNED_8_BYTE, 95 .elem_len = 1, 96 .elem_size = sizeof(u64), 97 .array_type = NO_ARRAY, 98 .tlv_type = 0, 99 .offset = offsetof(struct wifi_drv_qmi_srng_information_v01, 100 tp_paddr), 101 }, 102 { 103 .data_type = QMI_EOTI, 104 .array_type = NO_ARRAY, 105 .tlv_type = QMI_COMMON_TLV_TYPE, 106 }, 107 }; 108 109 static struct qmi_elem_info wifi_drv_qmi_ce_information_v01_ei[] = { 110 { 111 .data_type = QMI_UNSIGNED_1_BYTE, 112 .elem_len = 1, 113 .elem_size = sizeof(u8), 114 .array_type = NO_ARRAY, 115 .tlv_type = 0, 116 .offset = offsetof(struct wifi_drv_qmi_ce_information_v01, 117 ce_id), 118 }, 119 { 120 .data_type = QMI_SIGNED_4_BYTE_ENUM, 121 .elem_len = 1, 122 .elem_size = sizeof(enum wifi_drv_qmi_pipe_dir_v01), 123 .array_type = NO_ARRAY, 124 .tlv_type = 0, 125 .offset = offsetof(struct wifi_drv_qmi_ce_information_v01, 126 ce_dir), 127 }, 128 { 129 .data_type = QMI_STRUCT, 130 .elem_len = 1, 131 .elem_size = sizeof(struct wifi_drv_qmi_srng_information_v01), 132 .array_type = NO_ARRAY, 133 .tlv_type = 0, 134 .offset = offsetof(struct wifi_drv_qmi_ce_information_v01, 135 srng_info), 136 .ei_array = wifi_drv_qmi_srng_information_v01_ei, 137 }, 138 { 139 .data_type = QMI_EOTI, 140 .array_type = NO_ARRAY, 141 .tlv_type = QMI_COMMON_TLV_TYPE, 142 }, 143 }; 144 145 struct qmi_elem_info wfds_config_req_msg_v01_ei[] = { 146 { 147 .data_type = QMI_DATA_LEN, 148 .elem_len = 1, 149 .elem_size = sizeof(u8), 150 .array_type = NO_ARRAY, 151 .tlv_type = 0x01, 152 .offset = offsetof(struct wfds_config_req_msg_v01, 153 ce_info_len), 154 }, 155 { 156 .data_type = QMI_STRUCT, 157 .elem_len = WFDS_CE_MAX_SRNG_V01, 158 .elem_size = sizeof(struct wifi_drv_qmi_ce_information_v01), 159 .array_type = VAR_LEN_ARRAY, 160 .tlv_type = 0x01, 161 .offset = offsetof(struct wfds_config_req_msg_v01, 162 ce_info), 163 .ei_array = wifi_drv_qmi_ce_information_v01_ei, 164 }, 165 { 166 .data_type = QMI_STRUCT, 167 .elem_len = 1, 168 .elem_size = sizeof(struct wifi_drv_qmi_srng_information_v01), 169 .array_type = NO_ARRAY, 170 .tlv_type = 0x02, 171 .offset = offsetof(struct wfds_config_req_msg_v01, 172 rx_refill_ring), 173 .ei_array = wifi_drv_qmi_srng_information_v01_ei, 174 }, 175 { 176 .data_type = QMI_UNSIGNED_8_BYTE, 177 .elem_len = 1, 178 .elem_size = sizeof(u64), 179 .array_type = NO_ARRAY, 180 .tlv_type = 0x03, 181 .offset = offsetof(struct wfds_config_req_msg_v01, 182 shadow_rdptr_mem_paddr), 183 }, 184 { 185 .data_type = QMI_UNSIGNED_8_BYTE, 186 .elem_len = 1, 187 .elem_size = sizeof(u64), 188 .array_type = NO_ARRAY, 189 .tlv_type = 0x04, 190 .offset = offsetof(struct wfds_config_req_msg_v01, 191 shadow_rdptr_mem_size), 192 }, 193 { 194 .data_type = QMI_UNSIGNED_8_BYTE, 195 .elem_len = 1, 196 .elem_size = sizeof(u64), 197 .array_type = NO_ARRAY, 198 .tlv_type = 0x05, 199 .offset = offsetof(struct wfds_config_req_msg_v01, 200 shadow_wrptr_mem_paddr), 201 }, 202 { 203 .data_type = QMI_UNSIGNED_8_BYTE, 204 .elem_len = 1, 205 .elem_size = sizeof(u64), 206 .array_type = NO_ARRAY, 207 .tlv_type = 0x06, 208 .offset = offsetof(struct wfds_config_req_msg_v01, 209 shadow_wrptr_mem_size), 210 }, 211 { 212 .data_type = QMI_UNSIGNED_4_BYTE, 213 .elem_len = 1, 214 .elem_size = sizeof(u32), 215 .array_type = NO_ARRAY, 216 .tlv_type = 0x07, 217 .offset = offsetof(struct wfds_config_req_msg_v01, 218 rx_pkt_tlv_len), 219 }, 220 { 221 .data_type = QMI_UNSIGNED_4_BYTE, 222 .elem_len = 1, 223 .elem_size = sizeof(u32), 224 .array_type = NO_ARRAY, 225 .tlv_type = 0x08, 226 .offset = offsetof(struct wfds_config_req_msg_v01, 227 rx_rbm), 228 }, 229 { 230 .data_type = QMI_UNSIGNED_8_BYTE, 231 .elem_len = 1, 232 .elem_size = sizeof(u64), 233 .array_type = NO_ARRAY, 234 .tlv_type = 0x09, 235 .offset = offsetof(struct wfds_config_req_msg_v01, 236 pcie_bar_pa), 237 }, 238 { 239 .data_type = QMI_UNSIGNED_4_BYTE, 240 .elem_len = 1, 241 .elem_size = sizeof(u32), 242 .array_type = NO_ARRAY, 243 .tlv_type = 0x0A, 244 .offset = offsetof(struct wfds_config_req_msg_v01, 245 pci_slot), 246 }, 247 { 248 .data_type = QMI_UNSIGNED_4_BYTE, 249 .elem_len = 1, 250 .elem_size = sizeof(u32), 251 .array_type = NO_ARRAY, 252 .tlv_type = 0x0B, 253 .offset = offsetof(struct wfds_config_req_msg_v01, 254 lpass_ep_id), 255 }, 256 { 257 .data_type = QMI_EOTI, 258 .array_type = NO_ARRAY, 259 .tlv_type = QMI_COMMON_TLV_TYPE, 260 }, 261 }; 262 263 static struct qmi_elem_info wifi_drv_qmi_mem_arena_information_v01_ei[] = { 264 { 265 .data_type = QMI_UNSIGNED_2_BYTE, 266 .elem_len = 1, 267 .elem_size = sizeof(u16), 268 .array_type = NO_ARRAY, 269 .tlv_type = 0, 270 .offset = offsetof(struct wifi_drv_qmi_mem_arena_information_v01, 271 entry_size), 272 }, 273 { 274 .data_type = QMI_UNSIGNED_2_BYTE, 275 .elem_len = 1, 276 .elem_size = sizeof(u16), 277 .array_type = NO_ARRAY, 278 .tlv_type = 0, 279 .offset = offsetof(struct wifi_drv_qmi_mem_arena_information_v01, 280 num_entries), 281 }, 282 { 283 .data_type = QMI_EOTI, 284 .array_type = NO_ARRAY, 285 .tlv_type = QMI_COMMON_TLV_TYPE, 286 }, 287 }; 288 289 struct qmi_elem_info wfds_mem_ind_msg_v01_ei[] = { 290 { 291 .data_type = QMI_DATA_LEN, 292 .elem_len = 1, 293 .elem_size = sizeof(u8), 294 .array_type = NO_ARRAY, 295 .tlv_type = 0x01, 296 .offset = offsetof(struct wfds_mem_ind_msg_v01, 297 mem_arena_info_len), 298 }, 299 { 300 .data_type = QMI_STRUCT, 301 .elem_len = WFDS_MEM_ARENA_MAX_V01, 302 .elem_size = sizeof(struct wifi_drv_qmi_mem_arena_information_v01), 303 .array_type = VAR_LEN_ARRAY, 304 .tlv_type = 0x01, 305 .offset = offsetof(struct wfds_mem_ind_msg_v01, 306 mem_arena_info), 307 .ei_array = wifi_drv_qmi_mem_arena_information_v01_ei, 308 }, 309 { 310 .data_type = QMI_EOTI, 311 .array_type = NO_ARRAY, 312 .tlv_type = QMI_COMMON_TLV_TYPE, 313 }, 314 }; 315 316 static struct qmi_elem_info wifi_drv_qmi_mem_arena_page_information_v01_ei[] = { 317 { 318 .data_type = QMI_UNSIGNED_2_BYTE, 319 .elem_len = 1, 320 .elem_size = sizeof(u16), 321 .array_type = NO_ARRAY, 322 .tlv_type = 0, 323 .offset = offsetof(struct wifi_drv_qmi_mem_arena_page_information_v01, 324 num_entries_per_page), 325 }, 326 { 327 .data_type = QMI_DATA_LEN, 328 .elem_len = 1, 329 .elem_size = sizeof(u8), 330 .array_type = NO_ARRAY, 331 .tlv_type = 0, 332 .offset = offsetof(struct wifi_drv_qmi_mem_arena_page_information_v01, 333 page_dma_addr_len), 334 }, 335 { 336 .data_type = QMI_UNSIGNED_8_BYTE, 337 .elem_len = WFDS_PAGE_INFO_MAX_ARRAY_SIZE_V01, 338 .elem_size = sizeof(u64), 339 .array_type = VAR_LEN_ARRAY, 340 .tlv_type = 0, 341 .offset = offsetof(struct wifi_drv_qmi_mem_arena_page_information_v01, 342 page_dma_addr), 343 }, 344 { 345 .data_type = QMI_EOTI, 346 .array_type = NO_ARRAY, 347 .tlv_type = QMI_COMMON_TLV_TYPE, 348 }, 349 }; 350 351 struct qmi_elem_info wfds_mem_req_msg_v01_ei[] = { 352 { 353 .data_type = QMI_DATA_LEN, 354 .elem_len = 1, 355 .elem_size = sizeof(u8), 356 .array_type = NO_ARRAY, 357 .tlv_type = 0x01, 358 .offset = offsetof(struct wfds_mem_req_msg_v01, 359 mem_arena_page_info_len), 360 }, 361 { 362 .data_type = QMI_STRUCT, 363 .elem_len = WFDS_MEM_ARENA_MAX_V01, 364 .elem_size = sizeof(struct wifi_drv_qmi_mem_arena_page_information_v01), 365 .array_type = VAR_LEN_ARRAY, 366 .tlv_type = 0x01, 367 .offset = offsetof(struct wfds_mem_req_msg_v01, 368 mem_arena_page_info), 369 .ei_array = wifi_drv_qmi_mem_arena_page_information_v01_ei, 370 }, 371 { 372 .data_type = QMI_EOTI, 373 .array_type = NO_ARRAY, 374 .tlv_type = QMI_COMMON_TLV_TYPE, 375 }, 376 }; 377 378 static struct qmi_elem_info wifi_drv_qmi_ipcc_information_v01_ei[] = { 379 { 380 .data_type = QMI_UNSIGNED_1_BYTE, 381 .elem_len = 1, 382 .elem_size = sizeof(u8), 383 .array_type = NO_ARRAY, 384 .tlv_type = 0, 385 .offset = offsetof(struct wifi_drv_qmi_ipcc_information_v01, 386 ce_id), 387 }, 388 { 389 .data_type = QMI_UNSIGNED_8_BYTE, 390 .elem_len = 1, 391 .elem_size = sizeof(u64), 392 .array_type = NO_ARRAY, 393 .tlv_type = 0, 394 .offset = offsetof(struct wifi_drv_qmi_ipcc_information_v01, 395 ipcc_trig_addr), 396 }, 397 { 398 .data_type = QMI_UNSIGNED_4_BYTE, 399 .elem_len = 1, 400 .elem_size = sizeof(u32), 401 .array_type = NO_ARRAY, 402 .tlv_type = 0, 403 .offset = offsetof(struct wifi_drv_qmi_ipcc_information_v01, 404 ipcc_trig_data), 405 }, 406 { 407 .data_type = QMI_EOTI, 408 .array_type = NO_ARRAY, 409 .tlv_type = QMI_COMMON_TLV_TYPE, 410 }, 411 }; 412 413 struct qmi_elem_info wfds_ipcc_map_n_cfg_ind_msg_v01_ei[] = { 414 { 415 .data_type = QMI_DATA_LEN, 416 .elem_len = 1, 417 .elem_size = sizeof(u8), 418 .array_type = NO_ARRAY, 419 .tlv_type = 0x01, 420 .offset = offsetof(struct wfds_ipcc_map_n_cfg_ind_msg_v01, 421 ipcc_ce_info_len), 422 }, 423 { 424 .data_type = QMI_STRUCT, 425 .elem_len = WFDS_CE_MAX_SRNG_V01, 426 .elem_size = sizeof(struct wifi_drv_qmi_ipcc_information_v01), 427 .array_type = VAR_LEN_ARRAY, 428 .tlv_type = 0x01, 429 .offset = offsetof(struct wfds_ipcc_map_n_cfg_ind_msg_v01, 430 ipcc_ce_info), 431 .ei_array = wifi_drv_qmi_ipcc_information_v01_ei, 432 }, 433 { 434 .data_type = QMI_EOTI, 435 .array_type = NO_ARRAY, 436 .tlv_type = QMI_COMMON_TLV_TYPE, 437 }, 438 }; 439 440 struct qmi_elem_info wfds_ipcc_map_n_cfg_req_msg_v01_ei[] = { 441 { 442 .data_type = QMI_UNSIGNED_1_BYTE, 443 .elem_len = 1, 444 .elem_size = sizeof(u8), 445 .array_type = NO_ARRAY, 446 .tlv_type = 0x01, 447 .offset = offsetof(struct wfds_ipcc_map_n_cfg_req_msg_v01, 448 status), 449 }, 450 { 451 .data_type = QMI_EOTI, 452 .array_type = NO_ARRAY, 453 .tlv_type = QMI_COMMON_TLV_TYPE, 454 }, 455 }; 456 457 struct qmi_elem_info wfds_misc_req_msg_v01_ei[] = { 458 { 459 .data_type = QMI_SIGNED_4_BYTE_ENUM, 460 .elem_len = 1, 461 .elem_size = sizeof(enum wifi_drv_qmi_event_v01), 462 .array_type = NO_ARRAY, 463 .tlv_type = 0x01, 464 .offset = offsetof(struct wfds_misc_req_msg_v01, 465 event), 466 }, 467 { 468 .data_type = QMI_EOTI, 469 .array_type = NO_ARRAY, 470 .tlv_type = QMI_COMMON_TLV_TYPE, 471 }, 472 }; 473 474 struct qmi_elem_info wfds_misc_ind_msg_v01_ei[] = { 475 { 476 .data_type = QMI_SIGNED_4_BYTE_ENUM, 477 .elem_len = 1, 478 .elem_size = sizeof(enum wifi_drv_qmi_event_v01), 479 .array_type = NO_ARRAY, 480 .tlv_type = 0x01, 481 .offset = offsetof(struct wfds_misc_ind_msg_v01, 482 event), 483 }, 484 { 485 .data_type = QMI_EOTI, 486 .array_type = NO_ARRAY, 487 .tlv_type = QMI_COMMON_TLV_TYPE, 488 }, 489 }; 490 491 struct qmi_elem_info wfds_ut_cmd_req_msg_v01_ei[] = { 492 { 493 .data_type = QMI_SIGNED_4_BYTE_ENUM, 494 .elem_len = 1, 495 .elem_size = sizeof(enum wifi_drv_qmi_ut_cmd_v01), 496 .array_type = NO_ARRAY, 497 .tlv_type = 0x01, 498 .offset = offsetof(struct 499 wfds_ut_cmd_req_msg_v01, 500 cmd), 501 }, 502 { 503 .data_type = QMI_UNSIGNED_4_BYTE, 504 .elem_len = 1, 505 .elem_size = sizeof(u32), 506 .array_type = NO_ARRAY, 507 .tlv_type = 0x02, 508 .offset = offsetof(struct 509 wfds_ut_cmd_req_msg_v01, 510 duration), 511 }, 512 { 513 .data_type = QMI_UNSIGNED_4_BYTE, 514 .elem_len = 1, 515 .elem_size = sizeof(u32), 516 .array_type = NO_ARRAY, 517 .tlv_type = 0x03, 518 .offset = offsetof(struct 519 wfds_ut_cmd_req_msg_v01, 520 flush_period), 521 }, 522 { 523 .data_type = QMI_UNSIGNED_4_BYTE, 524 .elem_len = 1, 525 .elem_size = sizeof(u32), 526 .array_type = NO_ARRAY, 527 .tlv_type = 0x04, 528 .offset = offsetof(struct 529 wfds_ut_cmd_req_msg_v01, 530 num_pkts), 531 }, 532 { 533 .data_type = QMI_UNSIGNED_4_BYTE, 534 .elem_len = 1, 535 .elem_size = sizeof(u32), 536 .array_type = NO_ARRAY, 537 .tlv_type = 0x05, 538 .offset = offsetof(struct 539 wfds_ut_cmd_req_msg_v01, 540 buf_size), 541 }, 542 { 543 .data_type = QMI_UNSIGNED_2_BYTE, 544 .elem_len = 1, 545 .elem_size = sizeof(u16), 546 .array_type = NO_ARRAY, 547 .tlv_type = 0x06, 548 .offset = offsetof(struct 549 wfds_ut_cmd_req_msg_v01, 550 ether_type), 551 }, 552 { 553 .data_type = QMI_UNSIGNED_1_BYTE, 554 .elem_len = 6, 555 .elem_size = sizeof(u8), 556 .array_type = STATIC_ARRAY, 557 .tlv_type = 0x07, 558 .offset = offsetof(struct 559 wfds_ut_cmd_req_msg_v01, 560 src_mac), 561 }, 562 { 563 .data_type = QMI_UNSIGNED_1_BYTE, 564 .elem_len = 6, 565 .elem_size = sizeof(u8), 566 .array_type = STATIC_ARRAY, 567 .tlv_type = 0x08, 568 .offset = offsetof(struct 569 wfds_ut_cmd_req_msg_v01, 570 dest_mac), 571 }, 572 { 573 .data_type = QMI_UNSIGNED_1_BYTE, 574 .elem_len = 1, 575 .elem_size = sizeof(u8), 576 .array_type = NO_ARRAY, 577 .tlv_type = 0x09, 578 .offset = offsetof(struct 579 wfds_ut_cmd_req_msg_v01, 580 ip_ver), 581 }, 582 { 583 .data_type = QMI_UNSIGNED_1_BYTE, 584 .elem_len = 16, 585 .elem_size = sizeof(u8), 586 .array_type = STATIC_ARRAY, 587 .tlv_type = 0x0A, 588 .offset = offsetof(struct 589 wfds_ut_cmd_req_msg_v01, 590 src_ip_addr), 591 }, 592 { 593 .data_type = QMI_UNSIGNED_1_BYTE, 594 .elem_len = 16, 595 .elem_size = sizeof(u8), 596 .array_type = STATIC_ARRAY, 597 .tlv_type = 0x0B, 598 .offset = offsetof(struct 599 wfds_ut_cmd_req_msg_v01, 600 dest_ip_addr), 601 }, 602 { 603 .data_type = QMI_UNSIGNED_2_BYTE, 604 .elem_len = 1, 605 .elem_size = sizeof(u16), 606 .array_type = NO_ARRAY, 607 .tlv_type = 0x0C, 608 .offset = offsetof(struct 609 wfds_ut_cmd_req_msg_v01, 610 dest_port), 611 }, 612 { 613 .data_type = QMI_UNSIGNED_1_BYTE, 614 .elem_len = 256, 615 .elem_size = sizeof(u8), 616 .array_type = STATIC_ARRAY, 617 .tlv_type = 0x0D, 618 .offset = offsetof(struct 619 wfds_ut_cmd_req_msg_v01, 620 misc), 621 }, 622 { 623 .data_type = QMI_EOTI, 624 .array_type = NO_ARRAY, 625 .tlv_type = QMI_COMMON_TLV_TYPE, 626 }, 627 }; 628