Lines Matching refs:pieces
322 static struct fw_sec *get_sec(struct iwl_firmware_pieces *pieces, in get_sec() argument
326 return &pieces->img[type].sec[sec]; in get_sec()
329 static void alloc_sec_data(struct iwl_firmware_pieces *pieces, in alloc_sec_data() argument
333 struct fw_img_parsing *img = &pieces->img[type]; in alloc_sec_data()
349 static void set_sec_data(struct iwl_firmware_pieces *pieces, in set_sec_data() argument
354 alloc_sec_data(pieces, type, sec); in set_sec_data()
356 pieces->img[type].sec[sec].data = data; in set_sec_data()
359 static void set_sec_size(struct iwl_firmware_pieces *pieces, in set_sec_size() argument
364 alloc_sec_data(pieces, type, sec); in set_sec_size()
366 pieces->img[type].sec[sec].size = size; in set_sec_size()
369 static size_t get_sec_size(struct iwl_firmware_pieces *pieces, in get_sec_size() argument
373 return pieces->img[type].sec[sec].size; in get_sec_size()
376 static void set_sec_offset(struct iwl_firmware_pieces *pieces, in set_sec_offset() argument
381 alloc_sec_data(pieces, type, sec); in set_sec_offset()
383 pieces->img[type].sec[sec].offset = offset; in set_sec_offset()
389 static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces, in iwl_store_ucode_sec() argument
398 if (WARN_ON(!pieces || !data || type >= IWL_UCODE_TYPE_MAX)) in iwl_store_ucode_sec()
403 img = &pieces->img[type]; in iwl_store_ucode_sec()
494 struct iwl_firmware_pieces *pieces) in iwl_parse_v1_v2_firmware() argument
512 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
514 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
516 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
518 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
531 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
533 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
535 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
537 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
560 get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) + in iwl_parse_v1_v2_firmware()
561 get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) + in iwl_parse_v1_v2_firmware()
562 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) + in iwl_parse_v1_v2_firmware()
563 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)) { in iwl_parse_v1_v2_firmware()
572 set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, src); in iwl_parse_v1_v2_firmware()
573 src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST); in iwl_parse_v1_v2_firmware()
574 set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
576 set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, src); in iwl_parse_v1_v2_firmware()
577 src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA); in iwl_parse_v1_v2_firmware()
578 set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
580 set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, src); in iwl_parse_v1_v2_firmware()
581 src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST); in iwl_parse_v1_v2_firmware()
582 set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
584 set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, src); in iwl_parse_v1_v2_firmware()
585 src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA); in iwl_parse_v1_v2_firmware()
586 set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
690 struct iwl_firmware_pieces *pieces, in iwl_parse_tlv_firmware() argument
759 set_sec_data(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
761 set_sec_size(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
763 set_sec_offset(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
768 set_sec_data(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
770 set_sec_size(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
772 set_sec_offset(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
777 set_sec_data(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
779 set_sec_size(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
781 set_sec_offset(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
786 set_sec_data(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
788 set_sec_size(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
790 set_sec_offset(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
837 pieces->init_evtlog_ptr = in iwl_parse_tlv_firmware()
843 pieces->init_evtlog_size = in iwl_parse_tlv_firmware()
849 pieces->init_errlog_ptr = in iwl_parse_tlv_firmware()
855 pieces->inst_evtlog_ptr = in iwl_parse_tlv_firmware()
861 pieces->inst_evtlog_size = in iwl_parse_tlv_firmware()
867 pieces->inst_errlog_ptr = in iwl_parse_tlv_firmware()
876 set_sec_data(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
878 set_sec_size(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
880 set_sec_offset(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
885 set_sec_data(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
887 set_sec_size(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
889 set_sec_offset(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
900 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
905 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
910 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
932 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
937 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
942 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
999 pieces->dbg_dest_ver = (const u8 *)tlv_data; in iwl_parse_tlv_firmware()
1000 if (*pieces->dbg_dest_ver == 1) { in iwl_parse_tlv_firmware()
1002 } else if (*pieces->dbg_dest_ver == 0) { in iwl_parse_tlv_firmware()
1007 *pieces->dbg_dest_ver); in iwl_parse_tlv_firmware()
1011 if (pieces->dbg_dest_tlv_init) { in iwl_parse_tlv_firmware()
1017 pieces->dbg_dest_tlv_init = true; in iwl_parse_tlv_firmware()
1020 pieces->dbg_dest_tlv_v1 = dest_v1; in iwl_parse_tlv_firmware()
1023 pieces->dbg_dest_tlv = dest; in iwl_parse_tlv_firmware()
1047 if (!pieces->dbg_dest_tlv_init) { in iwl_parse_tlv_firmware()
1061 if (pieces->dbg_conf_tlv[conf->id]) { in iwl_parse_tlv_firmware()
1074 pieces->dbg_conf_tlv[conf->id] = conf; in iwl_parse_tlv_firmware()
1075 pieces->dbg_conf_tlv_len[conf->id] = tlv_len; in iwl_parse_tlv_firmware()
1090 if (pieces->dbg_trigger_tlv[trigger_id]) { in iwl_parse_tlv_firmware()
1099 pieces->dbg_trigger_tlv[trigger_id] = trigger; in iwl_parse_tlv_firmware()
1100 pieces->dbg_trigger_tlv_len[trigger_id] = tlv_len; in iwl_parse_tlv_firmware()
1116 iwl_store_ucode_sec(pieces, tlv_data, in iwl_parse_tlv_firmware()
1164 size = sizeof(*pieces->dbg_mem_tlv) * in iwl_parse_tlv_firmware()
1165 (pieces->n_mem_tlv + 1); in iwl_parse_tlv_firmware()
1166 n = krealloc(pieces->dbg_mem_tlv, size, GFP_KERNEL); in iwl_parse_tlv_firmware()
1169 pieces->dbg_mem_tlv = n; in iwl_parse_tlv_firmware()
1170 pieces->dbg_mem_tlv[pieces->n_mem_tlv] = *dbg_mem; in iwl_parse_tlv_firmware()
1171 pieces->n_mem_tlv++; in iwl_parse_tlv_firmware()
1344 struct iwl_firmware_pieces *pieces, in iwl_alloc_ucode() argument
1350 sec = kcalloc(pieces->img[type].sec_counter, sizeof(*sec), GFP_KERNEL); in iwl_alloc_ucode()
1354 drv->fw.img[type].num_sec = pieces->img[type].sec_counter; in iwl_alloc_ucode()
1356 for (i = 0; i < pieces->img[type].sec_counter; i++) in iwl_alloc_ucode()
1357 if (iwl_alloc_fw_desc(drv, &sec[i], get_sec(pieces, type, i))) in iwl_alloc_ucode()
1364 struct iwl_firmware_pieces *pieces, in validate_sec_sizes() argument
1368 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1371 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1374 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST)); in validate_sec_sizes()
1376 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)); in validate_sec_sizes()
1379 if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) > in validate_sec_sizes()
1382 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1387 if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) > in validate_sec_sizes()
1390 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1395 if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) > in validate_sec_sizes()
1398 get_sec_size(pieces, IWL_UCODE_INIT, in validate_sec_sizes()
1403 if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA) > in validate_sec_sizes()
1406 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1473 struct iwl_firmware_pieces *pieces; in iwl_req_fw_callback() local
1492 pieces = kzalloc(sizeof(*pieces), GFP_KERNEL); in iwl_req_fw_callback()
1493 if (!pieces) in iwl_req_fw_callback()
1512 err = iwl_parse_v1_v2_firmware(drv, ucode_raw, pieces); in iwl_req_fw_callback()
1514 err = iwl_parse_tlv_firmware(drv, ucode_raw, pieces, in iwl_req_fw_callback()
1542 if (fw->type == IWL_FW_DVM && validate_sec_sizes(drv, pieces, in iwl_req_fw_callback()
1553 if (iwl_alloc_ucode(drv, pieces, i)) in iwl_req_fw_callback()
1556 if (pieces->dbg_dest_tlv_init) { in iwl_req_fw_callback()
1566 if (*pieces->dbg_dest_ver == 0) { in iwl_req_fw_callback()
1567 memcpy(drv->fw.dbg.dest_tlv, pieces->dbg_dest_tlv_v1, in iwl_req_fw_callback()
1573 dest_tlv->version = pieces->dbg_dest_tlv->version; in iwl_req_fw_callback()
1575 pieces->dbg_dest_tlv->monitor_mode; in iwl_req_fw_callback()
1577 pieces->dbg_dest_tlv->size_power; in iwl_req_fw_callback()
1579 pieces->dbg_dest_tlv->wrap_count; in iwl_req_fw_callback()
1581 pieces->dbg_dest_tlv->write_ptr_reg; in iwl_req_fw_callback()
1583 pieces->dbg_dest_tlv->base_shift; in iwl_req_fw_callback()
1585 pieces->dbg_dest_tlv->reg_ops, in iwl_req_fw_callback()
1597 dest_tlv->base_reg = pieces->dbg_dest_tlv->cfg_reg; in iwl_req_fw_callback()
1599 pieces->dbg_dest_tlv->size_shift; in iwl_req_fw_callback()
1604 if (pieces->dbg_conf_tlv[i]) { in iwl_req_fw_callback()
1606 kmemdup(pieces->dbg_conf_tlv[i], in iwl_req_fw_callback()
1607 pieces->dbg_conf_tlv_len[i], in iwl_req_fw_callback()
1637 if (pieces->dbg_trigger_tlv[i]) { in iwl_req_fw_callback()
1645 if (WARN_ON(pieces->dbg_trigger_tlv_len[i] < in iwl_req_fw_callback()
1650 pieces->dbg_trigger_tlv_len[i]; in iwl_req_fw_callback()
1652 kmemdup(pieces->dbg_trigger_tlv[i], in iwl_req_fw_callback()
1662 drv->fw.dbg.mem_tlv = pieces->dbg_mem_tlv; in iwl_req_fw_callback()
1663 pieces->dbg_mem_tlv = NULL; in iwl_req_fw_callback()
1664 drv->fw.dbg.n_mem_tlv = pieces->n_mem_tlv; in iwl_req_fw_callback()
1671 fw->init_evtlog_ptr = pieces->init_evtlog_ptr; in iwl_req_fw_callback()
1672 if (pieces->init_evtlog_size) in iwl_req_fw_callback()
1673 fw->init_evtlog_size = (pieces->init_evtlog_size - 16)/12; in iwl_req_fw_callback()
1677 fw->init_errlog_ptr = pieces->init_errlog_ptr; in iwl_req_fw_callback()
1678 fw->inst_evtlog_ptr = pieces->inst_evtlog_ptr; in iwl_req_fw_callback()
1679 if (pieces->inst_evtlog_size) in iwl_req_fw_callback()
1680 fw->inst_evtlog_size = (pieces->inst_evtlog_size - 16)/12; in iwl_req_fw_callback()
1684 fw->inst_errlog_ptr = pieces->inst_errlog_ptr; in iwl_req_fw_callback()
1766 if (pieces) { in iwl_req_fw_callback()
1767 for (i = 0; i < ARRAY_SIZE(pieces->img); i++) in iwl_req_fw_callback()
1768 kfree(pieces->img[i].sec); in iwl_req_fw_callback()
1769 kfree(pieces->dbg_mem_tlv); in iwl_req_fw_callback()
1770 kfree(pieces); in iwl_req_fw_callback()