1
2
3
4 #ifndef __IPU3_CSS_FW_H
5 #define __IPU3_CSS_FW_H
6
7
8
9 #define IMGU_FW_NAME "intel/ipu3-fw.bin"
10
11 typedef u32 imgu_fw_ptr;
12
13 enum imgu_fw_type {
14 IMGU_FW_SP_FIRMWARE,
15 IMGU_FW_SP1_FIRMWARE,
16 IMGU_FW_ISP_FIRMWARE,
17 IMGU_FW_BOOTLOADER_FIRMWARE,
18 IMGU_FW_ACC_FIRMWARE
19 };
20
21 enum imgu_fw_acc_type {
22 IMGU_FW_ACC_NONE,
23 IMGU_FW_ACC_OUTPUT,
24 IMGU_FW_ACC_VIEWFINDER,
25 IMGU_FW_ACC_STANDALONE,
26 };
27
28 struct imgu_fw_isp_parameter {
29 u32 offset;
30 u32 size;
31 };
32
33 struct imgu_fw_param_memory_offsets {
34 struct {
35 struct imgu_fw_isp_parameter lin;
36 struct imgu_fw_isp_parameter tnr3;
37 struct imgu_fw_isp_parameter xnr3;
38 } vmem;
39 struct {
40 struct imgu_fw_isp_parameter tnr;
41 struct imgu_fw_isp_parameter tnr3;
42 struct imgu_fw_isp_parameter xnr3;
43 struct imgu_fw_isp_parameter plane_io_config;
44 struct imgu_fw_isp_parameter rgbir;
45 } dmem;
46 };
47
48 struct imgu_fw_config_memory_offsets {
49 struct {
50 struct imgu_fw_isp_parameter iterator;
51 struct imgu_fw_isp_parameter dvs;
52 struct imgu_fw_isp_parameter output;
53 struct imgu_fw_isp_parameter raw;
54 struct imgu_fw_isp_parameter input_yuv;
55 struct imgu_fw_isp_parameter tnr;
56 struct imgu_fw_isp_parameter tnr3;
57 struct imgu_fw_isp_parameter ref;
58 } dmem;
59 };
60
61 struct imgu_fw_state_memory_offsets {
62 struct {
63 struct imgu_fw_isp_parameter tnr;
64 struct imgu_fw_isp_parameter tnr3;
65 struct imgu_fw_isp_parameter ref;
66 } dmem;
67 };
68
69 union imgu_fw_all_memory_offsets {
70 struct {
71 u64 imgu_fw_mem_offsets[3];
72 } offsets;
73 struct {
74 u64 ptr;
75 } array[IMGU_ABI_PARAM_CLASS_NUM];
76 };
77
78 struct imgu_fw_binary_xinfo {
79
80 struct imgu_abi_binary_info sp;
81
82
83 u32 type;
84
85 u32 num_output_formats __aligned(8);
86 u32 output_formats[IMGU_ABI_FRAME_FORMAT_NUM];
87
88
89 u32 num_vf_formats __aligned(8);
90
91 u32 vf_formats[IMGU_ABI_FRAME_FORMAT_NUM];
92 u8 num_output_pins;
93 imgu_fw_ptr xmem_addr;
94
95 u64 imgu_fw_blob_descr_ptr __aligned(8);
96 u32 blob_index __aligned(8);
97 union imgu_fw_all_memory_offsets mem_offsets __aligned(8);
98 struct imgu_fw_binary_xinfo *next __aligned(8);
99 };
100
101 struct imgu_fw_sp_info {
102 u32 init_dmem_data;
103 u32 per_frame_data;
104 u32 group;
105 u32 output;
106 u32 host_sp_queue;
107 u32 host_sp_com;
108 u32 isp_started;
109 u32 sw_state;
110 u32 host_sp_queues_initialized;
111 u32 sleep_mode;
112 u32 invalidate_tlb;
113 u32 debug_buffer_ddr_address;
114
115
116 u32 perf_counter_input_system_error;
117 u32 threads_stack;
118 u32 threads_stack_size;
119 u32 curr_binary_id;
120 u32 raw_copy_line_count;
121 u32 ddr_parameter_address;
122 u32 ddr_parameter_size;
123
124 u32 sp_entry;
125 u32 tagger_frames_addr;
126 };
127
128 struct imgu_fw_bl_info {
129 u32 num_dma_cmds;
130 u32 dma_cmd_list;
131 u32 sw_state;
132
133 u32 bl_entry;
134 };
135
136 struct imgu_fw_acc_info {
137 u32 per_frame_data;
138 };
139
140 union imgu_fw_union {
141 struct imgu_fw_binary_xinfo isp;
142 struct imgu_fw_sp_info sp;
143 struct imgu_fw_sp_info sp1;
144 struct imgu_fw_bl_info bl;
145 struct imgu_fw_acc_info acc;
146 };
147
148 struct imgu_fw_info {
149 size_t header_size;
150 u32 type __aligned(8);
151 union imgu_fw_union info;
152 struct imgu_abi_blob_info blob;
153
154 u64 next;
155
156 u32 loaded __aligned(8);
157 const u64 isp_code __aligned(8);
158
159 u32 handle __aligned(8);
160
161 struct imgu_abi_isp_param_segments mem_initializers;
162
163 };
164
165 struct imgu_fw_bi_file_h {
166 char version[64];
167 int binary_nr;
168 unsigned int h_size;
169 };
170
171 struct imgu_fw_header {
172 struct imgu_fw_bi_file_h file_header;
173 struct imgu_fw_info binary_header[1];
174 };
175
176
177
178 int imgu_css_fw_init(struct imgu_css *css);
179 void imgu_css_fw_cleanup(struct imgu_css *css);
180
181 unsigned int imgu_css_fw_obgrid_size(const struct imgu_fw_info *bi);
182 void *imgu_css_fw_pipeline_params(struct imgu_css *css, unsigned int pipe,
183 enum imgu_abi_param_class cls,
184 enum imgu_abi_memories mem,
185 struct imgu_fw_isp_parameter *par,
186 size_t par_size, void *binary_params);
187
188 #endif