Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0-only */
2/*
3 * Copyright (C) 2020-2025 Intel Corporation
4 */
5
6#ifndef __IVPU_FW_H__
7#define __IVPU_FW_H__
8
9#include "vpu_boot_api.h"
10#include "vpu_jsm_api.h"
11
12#define FW_VERSION_HEADER_SIZE SZ_4K
13#define FW_VERSION_STR_SIZE SZ_256
14
15struct ivpu_device;
16struct ivpu_bo;
17struct vpu_boot_params;
18
19struct ivpu_fw_info {
20 const struct firmware *file;
21 const char *name;
22 char version[FW_VERSION_STR_SIZE];
23 struct ivpu_bo *mem_bp;
24 struct ivpu_bo *mem_fw_ver;
25 struct ivpu_bo *mem;
26 struct ivpu_bo *mem_shave_nn;
27 struct ivpu_bo *mem_log_crit;
28 struct ivpu_bo *mem_log_verb;
29 u64 boot_params_addr;
30 u64 boot_params_size;
31 u64 fw_version_addr;
32 u64 fw_version_size;
33 u64 runtime_addr;
34 u32 runtime_size;
35 u64 image_load_offset;
36 u32 image_size;
37 u32 shave_nn_size;
38 u64 warm_boot_entry_point;
39 u64 cold_boot_entry_point;
40 u8 last_boot_mode;
41 u8 next_boot_mode;
42 u32 trace_level;
43 u32 trace_destination_mask;
44 u64 trace_hw_component_mask;
45 u32 dvfs_mode;
46 u32 primary_preempt_buf_size;
47 u32 secondary_preempt_buf_size;
48 u64 read_only_addr;
49 u32 read_only_size;
50 u32 sched_mode;
51 u64 last_heartbeat;
52};
53
54bool ivpu_is_within_range(u64 addr, size_t size, struct ivpu_addr_range *range);
55int ivpu_fw_init(struct ivpu_device *vdev);
56void ivpu_fw_fini(struct ivpu_device *vdev);
57void ivpu_fw_load(struct ivpu_device *vdev);
58void ivpu_fw_boot_params_setup(struct ivpu_device *vdev, struct vpu_boot_params *boot_params);
59
60static inline bool ivpu_fw_is_warm_boot(struct ivpu_device *vdev)
61{
62 return vdev->fw->next_boot_mode == VPU_BOOT_TYPE_WARMBOOT;
63}
64
65static inline u32 ivpu_fw_preempt_buf_size(struct ivpu_device *vdev)
66{
67 return vdev->fw->primary_preempt_buf_size + vdev->fw->secondary_preempt_buf_size;
68}
69
70#endif /* __IVPU_FW_H__ */