Lines Matching full:pieces
322 * These functions are just to extract uCode section data from the pieces
325 static struct fw_sec *get_sec(struct iwl_firmware_pieces *pieces, in get_sec() argument
329 return &pieces->img[type].sec[sec]; in get_sec()
332 static void alloc_sec_data(struct iwl_firmware_pieces *pieces, in alloc_sec_data() argument
336 struct fw_img_parsing *img = &pieces->img[type]; in alloc_sec_data()
352 static void set_sec_data(struct iwl_firmware_pieces *pieces, in set_sec_data() argument
357 alloc_sec_data(pieces, type, sec); in set_sec_data()
359 pieces->img[type].sec[sec].data = data; in set_sec_data()
362 static void set_sec_size(struct iwl_firmware_pieces *pieces, in set_sec_size() argument
367 alloc_sec_data(pieces, type, sec); in set_sec_size()
369 pieces->img[type].sec[sec].size = size; in set_sec_size()
372 static size_t get_sec_size(struct iwl_firmware_pieces *pieces, in get_sec_size() argument
376 return pieces->img[type].sec[sec].size; in get_sec_size()
379 static void set_sec_offset(struct iwl_firmware_pieces *pieces, in set_sec_offset() argument
384 alloc_sec_data(pieces, type, sec); in set_sec_offset()
386 pieces->img[type].sec[sec].offset = offset; in set_sec_offset()
392 static int iwl_store_ucode_sec(struct iwl_firmware_pieces *pieces, in iwl_store_ucode_sec() argument
401 if (WARN_ON(!pieces || !data || type >= IWL_UCODE_TYPE_MAX)) in iwl_store_ucode_sec()
406 img = &pieces->img[type]; in iwl_store_ucode_sec()
497 struct iwl_firmware_pieces *pieces) in iwl_parse_v1_v2_firmware() argument
515 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
517 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
519 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
521 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
534 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
536 set_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
538 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
540 set_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
563 get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) + in iwl_parse_v1_v2_firmware()
564 get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) + in iwl_parse_v1_v2_firmware()
565 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) + in iwl_parse_v1_v2_firmware()
566 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)) { in iwl_parse_v1_v2_firmware()
575 set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, src); in iwl_parse_v1_v2_firmware()
576 src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST); in iwl_parse_v1_v2_firmware()
577 set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
579 set_sec_data(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, src); in iwl_parse_v1_v2_firmware()
580 src += get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA); in iwl_parse_v1_v2_firmware()
581 set_sec_offset(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
583 set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, src); in iwl_parse_v1_v2_firmware()
584 src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST); in iwl_parse_v1_v2_firmware()
585 set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST, in iwl_parse_v1_v2_firmware()
587 set_sec_data(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, src); in iwl_parse_v1_v2_firmware()
588 src += get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA); in iwl_parse_v1_v2_firmware()
589 set_sec_offset(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA, in iwl_parse_v1_v2_firmware()
693 struct iwl_firmware_pieces *pieces, in iwl_parse_tlv_firmware() argument
762 set_sec_data(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
764 set_sec_size(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
766 set_sec_offset(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
771 set_sec_data(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
773 set_sec_size(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
775 set_sec_offset(pieces, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
780 set_sec_data(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
782 set_sec_size(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
784 set_sec_offset(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
789 set_sec_data(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
791 set_sec_size(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
793 set_sec_offset(pieces, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
840 pieces->init_evtlog_ptr = in iwl_parse_tlv_firmware()
846 pieces->init_evtlog_size = in iwl_parse_tlv_firmware()
852 pieces->init_errlog_ptr = in iwl_parse_tlv_firmware()
858 pieces->inst_evtlog_ptr = in iwl_parse_tlv_firmware()
864 pieces->inst_evtlog_size = in iwl_parse_tlv_firmware()
870 pieces->inst_errlog_ptr = in iwl_parse_tlv_firmware()
879 set_sec_data(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
881 set_sec_size(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
883 set_sec_offset(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
888 set_sec_data(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
890 set_sec_size(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
892 set_sec_offset(pieces, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
903 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
908 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
913 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
935 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_REGULAR, in iwl_parse_tlv_firmware()
940 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_INIT, in iwl_parse_tlv_firmware()
945 iwl_store_ucode_sec(pieces, tlv_data, IWL_UCODE_WOWLAN, in iwl_parse_tlv_firmware()
996 pieces->dbg_dest_ver = (const u8 *)tlv_data; in iwl_parse_tlv_firmware()
997 if (*pieces->dbg_dest_ver == 1) { in iwl_parse_tlv_firmware()
999 } else if (*pieces->dbg_dest_ver == 0) { in iwl_parse_tlv_firmware()
1004 *pieces->dbg_dest_ver); in iwl_parse_tlv_firmware()
1008 if (pieces->dbg_dest_tlv_init) { in iwl_parse_tlv_firmware()
1014 pieces->dbg_dest_tlv_init = true; in iwl_parse_tlv_firmware()
1017 pieces->dbg_dest_tlv_v1 = dest_v1; in iwl_parse_tlv_firmware()
1020 pieces->dbg_dest_tlv = dest; in iwl_parse_tlv_firmware()
1044 if (!pieces->dbg_dest_tlv_init) { in iwl_parse_tlv_firmware()
1058 if (pieces->dbg_conf_tlv[conf->id]) { in iwl_parse_tlv_firmware()
1071 pieces->dbg_conf_tlv[conf->id] = conf; in iwl_parse_tlv_firmware()
1072 pieces->dbg_conf_tlv_len[conf->id] = tlv_len; in iwl_parse_tlv_firmware()
1087 if (pieces->dbg_trigger_tlv[trigger_id]) { in iwl_parse_tlv_firmware()
1096 pieces->dbg_trigger_tlv[trigger_id] = trigger; in iwl_parse_tlv_firmware()
1097 pieces->dbg_trigger_tlv_len[trigger_id] = tlv_len; in iwl_parse_tlv_firmware()
1113 iwl_store_ucode_sec(pieces, tlv_data, in iwl_parse_tlv_firmware()
1161 size = sizeof(*pieces->dbg_mem_tlv) * in iwl_parse_tlv_firmware()
1162 (pieces->n_mem_tlv + 1); in iwl_parse_tlv_firmware()
1163 n = krealloc(pieces->dbg_mem_tlv, size, GFP_KERNEL); in iwl_parse_tlv_firmware()
1166 pieces->dbg_mem_tlv = n; in iwl_parse_tlv_firmware()
1167 pieces->dbg_mem_tlv[pieces->n_mem_tlv] = *dbg_mem; in iwl_parse_tlv_firmware()
1168 pieces->n_mem_tlv++; in iwl_parse_tlv_firmware()
1341 struct iwl_firmware_pieces *pieces, in iwl_alloc_ucode() argument
1347 sec = kcalloc(pieces->img[type].sec_counter, sizeof(*sec), GFP_KERNEL); in iwl_alloc_ucode()
1351 drv->fw.img[type].num_sec = pieces->img[type].sec_counter; in iwl_alloc_ucode()
1353 for (i = 0; i < pieces->img[type].sec_counter; i++) in iwl_alloc_ucode()
1354 if (iwl_alloc_fw_desc(drv, &sec[i], get_sec(pieces, type, i))) in iwl_alloc_ucode()
1361 struct iwl_firmware_pieces *pieces, in validate_sec_sizes() argument
1365 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1368 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1371 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST)); in validate_sec_sizes()
1373 get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA)); in validate_sec_sizes()
1376 if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_INST) > in validate_sec_sizes()
1379 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1384 if (get_sec_size(pieces, IWL_UCODE_REGULAR, IWL_UCODE_SECTION_DATA) > in validate_sec_sizes()
1387 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1392 if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_INST) > in validate_sec_sizes()
1395 get_sec_size(pieces, IWL_UCODE_INIT, in validate_sec_sizes()
1400 if (get_sec_size(pieces, IWL_UCODE_INIT, IWL_UCODE_SECTION_DATA) > in validate_sec_sizes()
1403 get_sec_size(pieces, IWL_UCODE_REGULAR, in validate_sec_sizes()
1479 struct iwl_firmware_pieces *pieces; in iwl_req_fw_callback() local
1497 pieces = kzalloc(sizeof(*pieces), GFP_KERNEL); in iwl_req_fw_callback()
1498 if (!pieces) in iwl_req_fw_callback()
1517 err = iwl_parse_v1_v2_firmware(drv, ucode_raw, pieces); in iwl_req_fw_callback()
1519 err = iwl_parse_tlv_firmware(drv, ucode_raw, pieces, in iwl_req_fw_callback()
1547 if (fw->type == IWL_FW_DVM && validate_sec_sizes(drv, pieces, in iwl_req_fw_callback()
1558 if (iwl_alloc_ucode(drv, pieces, i)) in iwl_req_fw_callback()
1561 if (pieces->dbg_dest_tlv_init) { in iwl_req_fw_callback()
1571 if (*pieces->dbg_dest_ver == 0) { in iwl_req_fw_callback()
1572 memcpy(drv->fw.dbg.dest_tlv, pieces->dbg_dest_tlv_v1, in iwl_req_fw_callback()
1578 dest_tlv->version = pieces->dbg_dest_tlv->version; in iwl_req_fw_callback()
1580 pieces->dbg_dest_tlv->monitor_mode; in iwl_req_fw_callback()
1582 pieces->dbg_dest_tlv->size_power; in iwl_req_fw_callback()
1584 pieces->dbg_dest_tlv->wrap_count; in iwl_req_fw_callback()
1586 pieces->dbg_dest_tlv->write_ptr_reg; in iwl_req_fw_callback()
1588 pieces->dbg_dest_tlv->base_shift; in iwl_req_fw_callback()
1590 pieces->dbg_dest_tlv->reg_ops, in iwl_req_fw_callback()
1602 dest_tlv->base_reg = pieces->dbg_dest_tlv->cfg_reg; in iwl_req_fw_callback()
1604 pieces->dbg_dest_tlv->size_shift; in iwl_req_fw_callback()
1609 if (pieces->dbg_conf_tlv[i]) { in iwl_req_fw_callback()
1611 kmemdup(pieces->dbg_conf_tlv[i], in iwl_req_fw_callback()
1612 pieces->dbg_conf_tlv_len[i], in iwl_req_fw_callback()
1642 if (pieces->dbg_trigger_tlv[i]) { in iwl_req_fw_callback()
1650 if (WARN_ON(pieces->dbg_trigger_tlv_len[i] < in iwl_req_fw_callback()
1655 pieces->dbg_trigger_tlv_len[i]; in iwl_req_fw_callback()
1657 kmemdup(pieces->dbg_trigger_tlv[i], in iwl_req_fw_callback()
1667 drv->fw.dbg.mem_tlv = pieces->dbg_mem_tlv; in iwl_req_fw_callback()
1668 pieces->dbg_mem_tlv = NULL; in iwl_req_fw_callback()
1669 drv->fw.dbg.n_mem_tlv = pieces->n_mem_tlv; in iwl_req_fw_callback()
1676 fw->init_evtlog_ptr = pieces->init_evtlog_ptr; in iwl_req_fw_callback()
1677 if (pieces->init_evtlog_size) in iwl_req_fw_callback()
1678 fw->init_evtlog_size = (pieces->init_evtlog_size - 16)/12; in iwl_req_fw_callback()
1682 fw->init_errlog_ptr = pieces->init_errlog_ptr; in iwl_req_fw_callback()
1683 fw->inst_evtlog_ptr = pieces->inst_evtlog_ptr; in iwl_req_fw_callback()
1684 if (pieces->inst_evtlog_size) in iwl_req_fw_callback()
1685 fw->inst_evtlog_size = (pieces->inst_evtlog_size - 16)/12; in iwl_req_fw_callback()
1689 fw->inst_errlog_ptr = pieces->inst_errlog_ptr; in iwl_req_fw_callback()
1759 if (pieces) { in iwl_req_fw_callback()
1760 for (i = 0; i < ARRAY_SIZE(pieces->img); i++) in iwl_req_fw_callback()
1761 kfree(pieces->img[i].sec); in iwl_req_fw_callback()
1762 kfree(pieces->dbg_mem_tlv); in iwl_req_fw_callback()
1763 kfree(pieces); in iwl_req_fw_callback()