Lines Matching full:fw
36 /* Check if FW API is compatible with the driver */
73 ret = request_firmware(&vdev->fw->file, ivpu_firmware, vdev->drm.dev); in ivpu_fw_request()
75 vdev->fw->name = ivpu_firmware; in ivpu_fw_request()
83 ret = firmware_request_nowarn(&vdev->fw->file, fw_names[i].name, vdev->drm.dev); in ivpu_fw_request()
85 vdev->fw->name = fw_names[i].name; in ivpu_fw_request()
103 ivpu_err(vdev, "Incompatible FW %s API version: %d.%d, required %d.0 or later\n", in ivpu_fw_check_api()
108 ivpu_warn(vdev, "Major FW %s API version different: %d.%d (expected %d.%d)\n", in ivpu_fw_check_api()
111 ivpu_dbg(vdev, FW_BOOT, "FW %s API version: %d.%d (expected %d.%d)\n", in ivpu_fw_check_api()
140 struct ivpu_fw_info *fw = vdev->fw; in ivpu_fw_parse() local
141 const struct vpu_firmware_header *fw_hdr = (const void *)fw->file->data; in ivpu_fw_parse()
144 if (fw->file->size <= FW_FILE_IMAGE_OFFSET) { in ivpu_fw_parse()
145 ivpu_err(vdev, "Firmware file is too small: %zu\n", fw->file->size); in ivpu_fw_parse()
164 if (runtime_size < fw->file->size || runtime_size > FW_RUNTIME_MAX_SIZE) { in ivpu_fw_parse()
169 if (FW_FILE_IMAGE_OFFSET + image_size > fw->file->size) { in ivpu_fw_parse()
194 ivpu_info(vdev, "Firmware: %s, version: %s", fw->name, in ivpu_fw_parse()
202 fw->runtime_addr = runtime_addr; in ivpu_fw_parse()
203 fw->runtime_size = runtime_size; in ivpu_fw_parse()
204 fw->image_load_offset = image_load_addr - runtime_addr; in ivpu_fw_parse()
205 fw->image_size = image_size; in ivpu_fw_parse()
206 fw->shave_nn_size = PAGE_ALIGN(fw_hdr->shave_nn_fw_size); in ivpu_fw_parse()
208 fw->cold_boot_entry_point = fw_hdr->entry_point; in ivpu_fw_parse()
209 fw->entry_point = fw->cold_boot_entry_point; in ivpu_fw_parse()
211 fw->trace_level = min_t(u32, ivpu_log_level, IVPU_FW_LOG_FATAL); in ivpu_fw_parse()
212 fw->trace_destination_mask = VPU_TRACE_DESTINATION_VERBOSE_TRACING; in ivpu_fw_parse()
213 fw->trace_hw_component_mask = -1; in ivpu_fw_parse()
215 fw->dvfs_mode = 0; in ivpu_fw_parse()
217 fw->primary_preempt_buf_size = fw_hdr->preemption_buffer_1_size; in ivpu_fw_parse()
218 fw->secondary_preempt_buf_size = fw_hdr->preemption_buffer_2_size; in ivpu_fw_parse()
229 fw->read_only_addr = fw_hdr->ro_section_start_address; in ivpu_fw_parse()
230 fw->read_only_size = fw_hdr->ro_section_size; in ivpu_fw_parse()
233 fw->file->size, fw->image_size, fw->runtime_size, fw->shave_nn_size); in ivpu_fw_parse()
235 fw->runtime_addr, image_load_addr, fw->entry_point); in ivpu_fw_parse()
237 fw->read_only_addr, fw->read_only_size); in ivpu_fw_parse()
244 release_firmware(vdev->fw->file); in ivpu_fw_release()
247 /* Initialize workarounds that depend on FW version */
251 const struct vpu_firmware_header *fw_hdr = (const void *)vdev->fw->file->data; in ivpu_fw_init_wa()
266 struct ivpu_fw_info *fw = vdev->fw; in ivpu_fw_update_global_range() local
267 u64 start = ALIGN(fw->runtime_addr + fw->runtime_size, FW_SHARED_MEM_ALIGNMENT); in ivpu_fw_update_global_range()
281 struct ivpu_fw_info *fw = vdev->fw; in ivpu_fw_mem_init() local
290 fw_range.start = fw->runtime_addr; in ivpu_fw_mem_init()
291 fw_range.end = fw->runtime_addr + fw->runtime_size; in ivpu_fw_mem_init()
292 fw->mem = ivpu_bo_create(vdev, &vdev->gctx, &fw_range, fw->runtime_size, in ivpu_fw_mem_init()
294 if (!fw->mem) { in ivpu_fw_mem_init()
299 ret = ivpu_mmu_context_set_pages_ro(vdev, &vdev->gctx, fw->read_only_addr, in ivpu_fw_mem_init()
300 fw->read_only_size); in ivpu_fw_mem_init()
306 fw->mem_log_crit = ivpu_bo_create_global(vdev, IVPU_FW_CRITICAL_BUFFER_SIZE, in ivpu_fw_mem_init()
308 if (!fw->mem_log_crit) { in ivpu_fw_mem_init()
319 fw->mem_log_verb = ivpu_bo_create_global(vdev, log_verb_size, in ivpu_fw_mem_init()
321 if (!fw->mem_log_verb) { in ivpu_fw_mem_init()
327 if (fw->shave_nn_size) { in ivpu_fw_mem_init()
328 fw->mem_shave_nn = ivpu_bo_create(vdev, &vdev->gctx, &vdev->hw->ranges.shave, in ivpu_fw_mem_init()
329 fw->shave_nn_size, DRM_IVPU_BO_WC); in ivpu_fw_mem_init()
330 if (!fw->mem_shave_nn) { in ivpu_fw_mem_init()
340 ivpu_bo_free(fw->mem_log_verb); in ivpu_fw_mem_init()
342 ivpu_bo_free(fw->mem_log_crit); in ivpu_fw_mem_init()
344 ivpu_bo_free(fw->mem); in ivpu_fw_mem_init()
350 struct ivpu_fw_info *fw = vdev->fw; in ivpu_fw_mem_fini() local
352 if (fw->mem_shave_nn) { in ivpu_fw_mem_fini()
353 ivpu_bo_free(fw->mem_shave_nn); in ivpu_fw_mem_fini()
354 fw->mem_shave_nn = NULL; in ivpu_fw_mem_fini()
357 ivpu_bo_free(fw->mem_log_verb); in ivpu_fw_mem_fini()
358 ivpu_bo_free(fw->mem_log_crit); in ivpu_fw_mem_fini()
359 ivpu_bo_free(fw->mem); in ivpu_fw_mem_fini()
361 fw->mem_log_verb = NULL; in ivpu_fw_mem_fini()
362 fw->mem_log_crit = NULL; in ivpu_fw_mem_fini()
363 fw->mem = NULL; in ivpu_fw_mem_fini()
401 struct ivpu_fw_info *fw = vdev->fw; in ivpu_fw_load() local
402 u64 image_end_offset = fw->image_load_offset + fw->image_size; in ivpu_fw_load()
404 memset(ivpu_bo_vaddr(fw->mem), 0, fw->image_load_offset); in ivpu_fw_load()
405 memcpy(ivpu_bo_vaddr(fw->mem) + fw->image_load_offset, in ivpu_fw_load()
406 fw->file->data + FW_FILE_IMAGE_OFFSET, fw->image_size); in ivpu_fw_load()
409 u8 *start = ivpu_bo_vaddr(fw->mem) + image_end_offset; in ivpu_fw_load()
410 u64 size = ivpu_bo_size(fw->mem) - image_end_offset; in ivpu_fw_load()
415 wmb(); /* Flush WC buffers after writing fw->mem */ in ivpu_fw_load()
581 if (vdev->fw->mem_shave_nn) in ivpu_fw_boot_params_setup()
582 boot_params->shave_nn_fw_base = vdev->fw->mem_shave_nn->vpu_addr; in ivpu_fw_boot_params_setup()
595 boot_params->default_trace_level = vdev->fw->trace_level; in ivpu_fw_boot_params_setup()
597 boot_params->trace_destination_mask = vdev->fw->trace_destination_mask; in ivpu_fw_boot_params_setup()
598 boot_params->trace_hw_component_mask = vdev->fw->trace_hw_component_mask; in ivpu_fw_boot_params_setup()
599 boot_params->crit_tracing_buff_addr = vdev->fw->mem_log_crit->vpu_addr; in ivpu_fw_boot_params_setup()
600 boot_params->crit_tracing_buff_size = ivpu_bo_size(vdev->fw->mem_log_crit); in ivpu_fw_boot_params_setup()
601 boot_params->verbose_tracing_buff_addr = vdev->fw->mem_log_verb->vpu_addr; in ivpu_fw_boot_params_setup()
602 boot_params->verbose_tracing_buff_size = ivpu_bo_size(vdev->fw->mem_log_verb); in ivpu_fw_boot_params_setup()
610 boot_params->dvfs_mode = vdev->fw->dvfs_mode; in ivpu_fw_boot_params_setup()