1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
4  * Copyright (C) 2017 Linaro Ltd.
5  */
6 #ifndef __VENUS_HFI_MSGS_H__
7 #define __VENUS_HFI_MSGS_H__
8 
9 /* message calls */
10 #define HFI_MSG_SYS_INIT			0x20001
11 #define HFI_MSG_SYS_PC_PREP			0x20002
12 #define HFI_MSG_SYS_RELEASE_RESOURCE		0x20003
13 #define HFI_MSG_SYS_DEBUG			0x20004
14 #define HFI_MSG_SYS_SESSION_INIT		0x20006
15 #define HFI_MSG_SYS_SESSION_END			0x20007
16 #define HFI_MSG_SYS_IDLE			0x20008
17 #define HFI_MSG_SYS_COV				0x20009
18 #define HFI_MSG_SYS_PROPERTY_INFO		0x2000a
19 
20 #define HFI_MSG_EVENT_NOTIFY			0x21001
21 #define HFI_MSG_SESSION_GET_SEQUENCE_HEADER	0x21002
22 
23 #define HFI_MSG_SYS_PING_ACK			0x220002
24 #define HFI_MSG_SYS_SESSION_ABORT		0x220004
25 
26 #define HFI_MSG_SESSION_LOAD_RESOURCES		0x221001
27 #define HFI_MSG_SESSION_START			0x221002
28 #define HFI_MSG_SESSION_STOP			0x221003
29 #define HFI_MSG_SESSION_SUSPEND			0x221004
30 #define HFI_MSG_SESSION_RESUME			0x221005
31 #define HFI_MSG_SESSION_FLUSH			0x221006
32 #define HFI_MSG_SESSION_EMPTY_BUFFER		0x221007
33 #define HFI_MSG_SESSION_FILL_BUFFER		0x221008
34 #define HFI_MSG_SESSION_PROPERTY_INFO		0x221009
35 #define HFI_MSG_SESSION_RELEASE_RESOURCES	0x22100a
36 #define HFI_MSG_SESSION_PARSE_SEQUENCE_HEADER	0x22100b
37 #define HFI_MSG_SESSION_RELEASE_BUFFERS		0x22100c
38 
39 #define HFI_PICTURE_I				0x00000001
40 #define HFI_PICTURE_P				0x00000002
41 #define HFI_PICTURE_B				0x00000004
42 #define HFI_PICTURE_IDR				0x00000008
43 #define HFI_FRAME_NOTCODED			0x7f002000
44 #define HFI_FRAME_YUV				0x7f004000
45 #define HFI_UNUSED_PICT				0x10000000
46 
47 /* message packets */
48 struct hfi_msg_event_notify_pkt {
49 	struct hfi_session_hdr_pkt shdr;
50 	u32 event_id;
51 	u32 event_data1;
52 	u32 event_data2;
53 	u32 ext_event_data[1];
54 };
55 
56 struct hfi_msg_event_release_buffer_ref_pkt {
57 	u32 packet_buffer;
58 	u32 extradata_buffer;
59 	u32 output_tag;
60 };
61 
62 struct hfi_msg_sys_init_done_pkt {
63 	struct hfi_pkt_hdr hdr;
64 	u32 error_type;
65 	u32 num_properties;
66 	u32 data[1];
67 };
68 
69 struct hfi_msg_sys_pc_prep_done_pkt {
70 	struct hfi_pkt_hdr hdr;
71 	u32 error_type;
72 };
73 
74 struct hfi_msg_sys_release_resource_done_pkt {
75 	struct hfi_pkt_hdr hdr;
76 	u32 resource_handle;
77 	u32 error_type;
78 };
79 
80 struct hfi_msg_session_init_done_pkt {
81 	struct hfi_session_hdr_pkt shdr;
82 	u32 error_type;
83 	u32 num_properties;
84 	u32 data[1];
85 };
86 
87 struct hfi_msg_session_end_done_pkt {
88 	struct hfi_session_hdr_pkt shdr;
89 	u32 error_type;
90 };
91 
92 struct hfi_msg_session_get_sequence_hdr_done_pkt {
93 	struct hfi_session_hdr_pkt shdr;
94 	u32 error_type;
95 	u32 header_len;
96 	u32 sequence_header;
97 };
98 
99 struct hfi_msg_sys_session_abort_done_pkt {
100 	struct hfi_session_hdr_pkt shdr;
101 	u32 error_type;
102 };
103 
104 struct hfi_msg_sys_idle_pkt {
105 	struct hfi_pkt_hdr hdr;
106 };
107 
108 struct hfi_msg_sys_ping_ack_pkt {
109 	struct hfi_pkt_hdr hdr;
110 	u32 client_data;
111 };
112 
113 struct hfi_msg_sys_property_info_pkt {
114 	struct hfi_pkt_hdr hdr;
115 	u32 num_properties;
116 	u32 data[1];
117 };
118 
119 struct hfi_msg_session_load_resources_done_pkt {
120 	struct hfi_session_hdr_pkt shdr;
121 	u32 error_type;
122 };
123 
124 struct hfi_msg_session_start_done_pkt {
125 	struct hfi_session_hdr_pkt shdr;
126 	u32 error_type;
127 };
128 
129 struct hfi_msg_session_stop_done_pkt {
130 	struct hfi_session_hdr_pkt shdr;
131 	u32 error_type;
132 };
133 
134 struct hfi_msg_session_suspend_done_pkt {
135 	struct hfi_session_hdr_pkt shdr;
136 	u32 error_type;
137 };
138 
139 struct hfi_msg_session_resume_done_pkt {
140 	struct hfi_session_hdr_pkt shdr;
141 	u32 error_type;
142 };
143 
144 struct hfi_msg_session_flush_done_pkt {
145 	struct hfi_session_hdr_pkt shdr;
146 	u32 error_type;
147 	u32 flush_type;
148 };
149 
150 struct hfi_msg_session_empty_buffer_done_pkt {
151 	struct hfi_session_hdr_pkt shdr;
152 	u32 error_type;
153 	u32 offset;
154 	u32 filled_len;
155 	u32 input_tag;
156 	u32 packet_buffer;
157 	u32 extradata_buffer;
158 	u32 data[0];
159 };
160 
161 struct hfi_msg_session_fbd_compressed_pkt {
162 	struct hfi_session_hdr_pkt shdr;
163 	u32 time_stamp_hi;
164 	u32 time_stamp_lo;
165 	u32 error_type;
166 	u32 flags;
167 	u32 mark_target;
168 	u32 mark_data;
169 	u32 stats;
170 	u32 offset;
171 	u32 alloc_len;
172 	u32 filled_len;
173 	u32 input_tag;
174 	u32 output_tag;
175 	u32 picture_type;
176 	u32 packet_buffer;
177 	u32 extradata_buffer;
178 	u32 data[0];
179 };
180 
181 struct hfi_msg_session_fbd_uncompressed_plane0_pkt {
182 	struct hfi_session_hdr_pkt shdr;
183 	u32 stream_id;
184 	u32 view_id;
185 	u32 error_type;
186 	u32 time_stamp_hi;
187 	u32 time_stamp_lo;
188 	u32 flags;
189 	u32 mark_target;
190 	u32 mark_data;
191 	u32 stats;
192 	u32 alloc_len;
193 	u32 filled_len;
194 	u32 offset;
195 	u32 frame_width;
196 	u32 frame_height;
197 	u32 start_x_coord;
198 	u32 start_y_coord;
199 	u32 input_tag;
200 	u32 input_tag2;
201 	u32 output_tag;
202 	u32 picture_type;
203 	u32 packet_buffer;
204 	u32 extradata_buffer;
205 	u32 data[0];
206 };
207 
208 struct hfi_msg_session_fbd_uncompressed_plane1_pkt {
209 	u32 flags;
210 	u32 alloc_len;
211 	u32 filled_len;
212 	u32 offset;
213 	u32 packet_buffer2;
214 	u32 data[0];
215 };
216 
217 struct hfi_msg_session_fbd_uncompressed_plane2_pkt {
218 	u32 flags;
219 	u32 alloc_len;
220 	u32 filled_len;
221 	u32 offset;
222 	u32 packet_buffer3;
223 	u32 data[0];
224 };
225 
226 struct hfi_msg_session_parse_sequence_header_done_pkt {
227 	struct hfi_session_hdr_pkt shdr;
228 	u32 error_type;
229 	u32 num_properties;
230 	u32 data[1];
231 };
232 
233 struct hfi_msg_session_property_info_pkt {
234 	struct hfi_session_hdr_pkt shdr;
235 	u32 num_properties;
236 	u32 data[1];
237 };
238 
239 struct hfi_msg_session_release_resources_done_pkt {
240 	struct hfi_session_hdr_pkt shdr;
241 	u32 error_type;
242 };
243 
244 struct hfi_msg_session_release_buffers_done_pkt {
245 	struct hfi_session_hdr_pkt shdr;
246 	u32 error_type;
247 	u32 num_buffers;
248 	u32 buffer_info[1];
249 };
250 
251 struct hfi_msg_sys_debug_pkt {
252 	struct hfi_pkt_hdr hdr;
253 	u32 msg_type;
254 	u32 msg_size;
255 	u32 time_stamp_hi;
256 	u32 time_stamp_lo;
257 	u8 msg_data[1];
258 };
259 
260 struct hfi_msg_sys_coverage_pkt {
261 	struct hfi_pkt_hdr hdr;
262 	u32 msg_size;
263 	u32 time_stamp_hi;
264 	u32 time_stamp_lo;
265 	u8 msg_data[1];
266 };
267 
268 struct venus_core;
269 struct hfi_pkt_hdr;
270 
271 void hfi_process_watchdog_timeout(struct venus_core *core);
272 u32 hfi_process_msg_packet(struct venus_core *core, struct hfi_pkt_hdr *hdr);
273 
274 #endif
275