• Home
  • Raw
  • Download

Lines Matching refs:wil

11 #define wil_err_fw(wil, fmt, arg...) wil_err(wil, "ERR[ FW ]" fmt, ##arg)  argument
12 #define wil_dbg_fw(wil, fmt, arg...) wil_dbg(wil, "DBG[ FW ]" fmt, ##arg) argument
19 static bool wil_fw_addr_check(struct wil6210_priv *wil, in wil_fw_addr_check() argument
23 *ioaddr = wmi_buffer_block(wil, val, size); in wil_fw_addr_check()
25 wil_err_fw(wil, "bad %s: 0x%08x\n", msg, le32_to_cpu(val)); in wil_fw_addr_check()
39 static int wil_fw_verify(struct wil6210_priv *wil, const u8 *data, size_t size) in wil_fw_verify() argument
48 wil_err_fw(wil, "image size not aligned: %zu\n", size); in wil_fw_verify()
53 wil_err_fw(wil, "file too short: %zu bytes\n", size); in wil_fw_verify()
59 wil_err_fw(wil, "no file header\n"); in wil_fw_verify()
67 wil_err_fw(wil, "data length not aligned: %lu\n", (ulong)dlen); in wil_fw_verify()
71 wil_err_fw(wil, "file truncated at %zu/%lu\n", in wil_fw_verify()
76 wil_err_fw(wil, "data length too short: %lu\n", (ulong)dlen); in wil_fw_verify()
82 wil_err_fw(wil, "bad header signature: 0x%08x\n", in wil_fw_verify()
89 wil_err_fw(wil, "unsupported header version: %d\n", in wil_fw_verify()
105 wil_err_fw(wil, "checksum mismatch:" in wil_fw_verify()
114 static int fw_ignore_section(struct wil6210_priv *wil, const void *data, in fw_ignore_section() argument
121 fw_handle_capabilities(struct wil6210_priv *wil, const void *data, in fw_handle_capabilities() argument
128 wil_err_fw(wil, "capabilities record too short: %zu\n", size); in fw_handle_capabilities()
135 bitmap_zero(wil->fw_capabilities, WMI_FW_CAPABILITY_MAX); in fw_handle_capabilities()
136 memcpy(wil->fw_capabilities, rec->capabilities, in fw_handle_capabilities()
137 min_t(size_t, sizeof(wil->fw_capabilities), capa_size)); in fw_handle_capabilities()
144 fw_handle_brd_file(struct wil6210_priv *wil, const void *data, in fw_handle_brd_file() argument
151 wil_err(wil, "board record too short, size %zu\n", size); in fw_handle_brd_file()
159 wil_err(wil, "brd info entries are missing\n"); in fw_handle_brd_file()
163 wil->brd_info = kcalloc(max_num_ent, sizeof(struct wil_brd_info), in fw_handle_brd_file()
165 if (!wil->brd_info) in fw_handle_brd_file()
169 wil->brd_info[i].file_addr = in fw_handle_brd_file()
171 wil->brd_info[i].file_max_size = in fw_handle_brd_file()
174 if (!wil->brd_info[i].file_addr) in fw_handle_brd_file()
177 wil_dbg_fw(wil, in fw_handle_brd_file()
179 i, wil->brd_info[i].file_addr, in fw_handle_brd_file()
180 wil->brd_info[i].file_max_size); in fw_handle_brd_file()
183 wil->num_of_brd_entries = i; in fw_handle_brd_file()
184 if (wil->num_of_brd_entries == 0) { in fw_handle_brd_file()
185 kfree(wil->brd_info); in fw_handle_brd_file()
186 wil->brd_info = NULL; in fw_handle_brd_file()
187 wil_dbg_fw(wil, in fw_handle_brd_file()
191 wil_dbg_fw(wil, "num of brd info entries %d\n", in fw_handle_brd_file()
192 wil->num_of_brd_entries); in fw_handle_brd_file()
199 fw_handle_concurrency(struct wil6210_priv *wil, const void *data, in fw_handle_concurrency() argument
209 wil_err_fw(wil, "concurrency record too short: %zu\n", size); in fw_handle_concurrency()
230 return wil_cfg80211_iface_combinations_from_fw(wil, rec); in fw_handle_concurrency()
232 wil_err_fw(wil, "concurrency record truncated\n"); in fw_handle_concurrency()
237 fw_handle_comment(struct wil6210_priv *wil, const void *data, in fw_handle_comment() argument
251 wil_dbg_fw(wil, "magic is WIL_FW_CAPABILITIES_MAGIC\n"); in fw_handle_comment()
252 rc = fw_handle_capabilities(wil, data, size); in fw_handle_comment()
255 wil_dbg_fw(wil, "magic is WIL_BRD_FILE_MAGIC\n"); in fw_handle_comment()
256 rc = fw_handle_brd_file(wil, data, size); in fw_handle_comment()
259 wil_dbg_fw(wil, "magic is WIL_FW_CONCURRENCY_MAGIC\n"); in fw_handle_comment()
260 rc = fw_handle_concurrency(wil, data, size); in fw_handle_comment()
270 static int __fw_handle_data(struct wil6210_priv *wil, const void *data, in __fw_handle_data() argument
278 wil_err_fw(wil, "data record too short: %zu\n", size); in __fw_handle_data()
282 if (!wil_fw_addr_check(wil, &dst, addr, s, "address")) in __fw_handle_data()
284 wil_dbg_fw(wil, "write [0x%08x] <== %zu bytes\n", le32_to_cpu(addr), s); in __fw_handle_data()
291 static int fw_handle_data(struct wil6210_priv *wil, const void *data, in fw_handle_data() argument
296 return __fw_handle_data(wil, data, size, d->addr); in fw_handle_data()
299 static int fw_handle_fill(struct wil6210_priv *wil, const void *data, in fw_handle_fill() argument
308 wil_err_fw(wil, "bad size for fill record: %zu\n", size); in fw_handle_fill()
313 wil_err_fw(wil, "fill size too short: %zu\n", s); in fw_handle_fill()
318 wil_err_fw(wil, "fill size not aligned: %zu\n", s); in fw_handle_fill()
322 if (!wil_fw_addr_check(wil, &dst, d->addr, s, "address")) in fw_handle_fill()
326 wil_dbg_fw(wil, "fill [0x%08x] <== 0x%08x, %zu bytes\n", in fw_handle_fill()
334 static int fw_handle_file_header(struct wil6210_priv *wil, const void *data, in fw_handle_file_header() argument
340 wil_err_fw(wil, "file header length incorrect: %zu\n", size); in fw_handle_file_header()
344 wil_dbg_fw(wil, "new file, ver. %d, %i bytes\n", in fw_handle_file_header()
351 memcpy(wil->fw_version, in fw_handle_file_header()
354 sizeof(wil->fw_version) - 1)); in fw_handle_file_header()
359 static int fw_handle_direct_write(struct wil6210_priv *wil, const void *data, in fw_handle_direct_write() argument
367 wil_err_fw(wil, "record size not aligned on %zu: %zu\n", in fw_handle_direct_write()
379 if (!wil_fw_addr_check(wil, &dst, block[i].addr, 0, "address")) in fw_handle_direct_write()
384 wil_dbg_fw(wil, "write [0x%08x] <== 0x%08x " in fw_handle_direct_write()
394 static int gw_write(struct wil6210_priv *wil, void __iomem *gwa_addr, in gw_write() argument
408 wil_err_fw(wil, "gw timeout\n"); in gw_write()
416 static int fw_handle_gateway_data(struct wil6210_priv *wil, const void *data, in fw_handle_gateway_data() argument
429 wil_err_fw(wil, "gateway record too short: %zu\n", size); in fw_handle_gateway_data()
434 wil_err_fw(wil, "gateway record data size" in fw_handle_gateway_data()
443 wil_dbg_fw(wil, "gw write record [%3d] blocks, cmd 0x%08x\n", in fw_handle_gateway_data()
446 if (!wil_fw_addr_check(wil, &gwa_addr, d->gateway_addr_addr, 0, in fw_handle_gateway_data()
448 !wil_fw_addr_check(wil, &gwa_val, d->gateway_value_addr, 0, in fw_handle_gateway_data()
450 !wil_fw_addr_check(wil, &gwa_cmd, d->gateway_cmd_addr, 0, in fw_handle_gateway_data()
452 !wil_fw_addr_check(wil, &gwa_ctl, d->gateway_ctrl_address, 0, in fw_handle_gateway_data()
456 wil_dbg_fw(wil, "gw addresses: addr 0x%08x val 0x%08x" in fw_handle_gateway_data()
468 wil_dbg_fw(wil, " gw write[%3d] [0x%08x] <== 0x%08x\n", in fw_handle_gateway_data()
472 rc = gw_write(wil, gwa_addr, gwa_cmd, gwa_ctl, gw_cmd, a); in fw_handle_gateway_data()
480 static int fw_handle_gateway_data4(struct wil6210_priv *wil, const void *data, in fw_handle_gateway_data4() argument
493 wil_err_fw(wil, "gateway4 record too short: %zu\n", size); in fw_handle_gateway_data4()
498 wil_err_fw(wil, "gateway4 record data size" in fw_handle_gateway_data4()
507 wil_dbg_fw(wil, "gw4 write record [%3d] blocks, cmd 0x%08x\n", in fw_handle_gateway_data4()
510 if (!wil_fw_addr_check(wil, &gwa_addr, d->gateway_addr_addr, 0, in fw_handle_gateway_data4()
514 if (!wil_fw_addr_check(wil, &gwa_val[k], in fw_handle_gateway_data4()
518 if (!wil_fw_addr_check(wil, &gwa_cmd, d->gateway_cmd_addr, 0, in fw_handle_gateway_data4()
520 !wil_fw_addr_check(wil, &gwa_ctl, d->gateway_ctrl_address, 0, in fw_handle_gateway_data4()
524 wil_dbg_fw(wil, "gw4 addresses: addr 0x%08x cmd 0x%08x ctl 0x%08x\n", in fw_handle_gateway_data4()
540 wil_dbg_fw(wil, " gw4 write[%3d] [0x%08x] <==\n", i, a); in fw_handle_gateway_data4()
546 rc = gw_write(wil, gwa_addr, gwa_cmd, gwa_ctl, gw_cmd, a); in fw_handle_gateway_data4()
556 int (*load_handler)(struct wil6210_priv *wil, const void *data,
558 int (*parse_handler)(struct wil6210_priv *wil, const void *data,
574 static int wil_fw_handle_record(struct wil6210_priv *wil, int type, in wil_fw_handle_record() argument
583 wil, data, size) : in wil_fw_handle_record()
585 wil, data, size); in wil_fw_handle_record()
587 wil_err_fw(wil, "unknown record type: %d\n", type); in wil_fw_handle_record()
599 static int wil_fw_process(struct wil6210_priv *wil, const void *data, in wil_fw_process() argument
614 wil_err_fw(wil, "unaligned record size: %zu\n", in wil_fw_process()
618 rc = wil_fw_handle_record(wil, le16_to_cpu(hdr->type), in wil_fw_process()
624 wil_err_fw(wil, "unprocessed bytes: %zu\n", size); in wil_fw_process()
626 wil_err_fw(wil, "Stop at offset %ld" in wil_fw_process()
646 int wil_request_firmware(struct wil6210_priv *wil, const char *name, in wil_request_firmware() argument
654 rc = request_firmware(&fw, name, wil_to_dev(wil)); in wil_request_firmware()
656 wil_err_fw(wil, "Failed to load firmware %s rc %d\n", name, rc); in wil_request_firmware()
659 wil_dbg_fw(wil, "Loading <%s>, %zu bytes\n", name, fw->size); in wil_request_firmware()
662 wil->num_of_brd_entries = 0; in wil_request_firmware()
663 kfree(wil->brd_info); in wil_request_firmware()
664 wil->brd_info = NULL; in wil_request_firmware()
667 rc1 = wil_fw_verify(wil, d, sz); in wil_request_firmware()
672 rc = wil_fw_process(wil, d, rc1, load); in wil_request_firmware()
680 wil_err_fw(wil, "Loading <%s> failed, rc %d\n", name, rc); in wil_request_firmware()
689 static int wil_brd_process(struct wil6210_priv *wil, const void *data, in wil_brd_process() argument
715 if (i >= wil->num_of_brd_entries) { in wil_brd_process()
716 wil_err_fw(wil, in wil_brd_process()
718 i, wil->num_of_brd_entries); in wil_brd_process()
724 if (wil->brd_info[i].file_max_size && in wil_brd_process()
725 hdr_sz > wil->brd_info[i].file_max_size) in wil_brd_process()
730 wil_err_fw(wil, "unaligned record size: %zu\n", in wil_brd_process()
736 wil_err_fw(wil, in wil_brd_process()
742 wil_err_fw(wil, "data record too short: %zu\n", hdr_sz); in wil_brd_process()
746 wil_dbg_fw(wil, in wil_brd_process()
748 i, wil->brd_info[i].file_addr, in wil_brd_process()
749 wil->brd_info[i].file_max_size); in wil_brd_process()
751 rc = __fw_handle_data(wil, &hdr[1], hdr_sz, in wil_brd_process()
752 cpu_to_le32(wil->brd_info[i].file_addr)); in wil_brd_process()
758 wil_err_fw(wil, "unprocessed bytes: %zu\n", size); in wil_brd_process()
760 wil_err_fw(wil, in wil_brd_process()
781 int wil_request_board(struct wil6210_priv *wil, const char *name) in wil_request_board() argument
786 rc = request_firmware(&brd, name, wil_to_dev(wil)); in wil_request_board()
788 wil_err_fw(wil, "Failed to load brd %s\n", name); in wil_request_board()
791 wil_dbg_fw(wil, "Loading <%s>, %zu bytes\n", name, brd->size); in wil_request_board()
794 dlen = wil_fw_verify(wil, brd->data, brd->size); in wil_request_board()
801 rc = wil_brd_process(wil, brd->data, dlen); in wil_request_board()
806 wil_err_fw(wil, "Loading <%s> failed, rc %d\n", name, rc); in wil_request_board()
818 bool wil_fw_verify_file_exists(struct wil6210_priv *wil, const char *name) in wil_fw_verify_file_exists() argument
823 rc = request_firmware(&fw, name, wil_to_dev(wil)); in wil_fw_verify_file_exists()
827 wil_dbg_fw(wil, "<%s> not available: %d\n", name, rc); in wil_fw_verify_file_exists()