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[];
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[];
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[];
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 property;
117 	u8 data[];
118 };
119 
120 struct hfi_msg_session_load_resources_done_pkt {
121 	struct hfi_session_hdr_pkt shdr;
122 	u32 error_type;
123 };
124 
125 struct hfi_msg_session_start_done_pkt {
126 	struct hfi_session_hdr_pkt shdr;
127 	u32 error_type;
128 };
129 
130 struct hfi_msg_session_stop_done_pkt {
131 	struct hfi_session_hdr_pkt shdr;
132 	u32 error_type;
133 };
134 
135 struct hfi_msg_session_suspend_done_pkt {
136 	struct hfi_session_hdr_pkt shdr;
137 	u32 error_type;
138 };
139 
140 struct hfi_msg_session_resume_done_pkt {
141 	struct hfi_session_hdr_pkt shdr;
142 	u32 error_type;
143 };
144 
145 struct hfi_msg_session_flush_done_pkt {
146 	struct hfi_session_hdr_pkt shdr;
147 	u32 error_type;
148 	u32 flush_type;
149 };
150 
151 struct hfi_msg_session_empty_buffer_done_pkt {
152 	struct hfi_session_hdr_pkt shdr;
153 	u32 error_type;
154 	u32 offset;
155 	u32 filled_len;
156 	u32 input_tag;
157 	u32 packet_buffer;
158 	u32 extradata_buffer;
159 	u32 data[];
160 };
161 
162 struct hfi_msg_session_fbd_compressed_pkt {
163 	struct hfi_session_hdr_pkt shdr;
164 	u32 time_stamp_hi;
165 	u32 time_stamp_lo;
166 	u32 error_type;
167 	u32 flags;
168 	u32 mark_target;
169 	u32 mark_data;
170 	u32 stats;
171 	u32 offset;
172 	u32 alloc_len;
173 	u32 filled_len;
174 	u32 input_tag;
175 	u32 output_tag;
176 	u32 picture_type;
177 	u32 packet_buffer;
178 	u32 extradata_buffer;
179 	u32 data[];
180 };
181 
182 struct hfi_msg_session_fbd_uncompressed_plane0_pkt {
183 	struct hfi_session_hdr_pkt shdr;
184 	u32 stream_id;
185 	u32 view_id;
186 	u32 error_type;
187 	u32 time_stamp_hi;
188 	u32 time_stamp_lo;
189 	u32 flags;
190 	u32 mark_target;
191 	u32 mark_data;
192 	u32 stats;
193 	u32 alloc_len;
194 	u32 filled_len;
195 	u32 offset;
196 	u32 frame_width;
197 	u32 frame_height;
198 	u32 start_x_coord;
199 	u32 start_y_coord;
200 	u32 input_tag;
201 	u32 input_tag2;
202 	u32 output_tag;
203 	u32 picture_type;
204 	u32 packet_buffer;
205 	u32 extradata_buffer;
206 	u32 data[];
207 };
208 
209 struct hfi_msg_session_fbd_uncompressed_plane1_pkt {
210 	u32 flags;
211 	u32 alloc_len;
212 	u32 filled_len;
213 	u32 offset;
214 	u32 packet_buffer2;
215 	u32 data[];
216 };
217 
218 struct hfi_msg_session_fbd_uncompressed_plane2_pkt {
219 	u32 flags;
220 	u32 alloc_len;
221 	u32 filled_len;
222 	u32 offset;
223 	u32 packet_buffer3;
224 	u32 data[];
225 };
226 
227 struct hfi_msg_session_parse_sequence_header_done_pkt {
228 	struct hfi_session_hdr_pkt shdr;
229 	u32 error_type;
230 	u32 num_properties;
231 	u32 data[];
232 };
233 
234 struct hfi_msg_session_property_info_pkt {
235 	struct hfi_session_hdr_pkt shdr;
236 	u32 num_properties;
237 	u32 property;
238 	u8 data[];
239 };
240 
241 struct hfi_msg_session_release_resources_done_pkt {
242 	struct hfi_session_hdr_pkt shdr;
243 	u32 error_type;
244 };
245 
246 struct hfi_msg_session_release_buffers_done_pkt {
247 	struct hfi_session_hdr_pkt shdr;
248 	u32 error_type;
249 	u32 num_buffers;
250 	u32 buffer_info[];
251 };
252 
253 struct hfi_msg_sys_debug_pkt {
254 	struct hfi_pkt_hdr hdr;
255 	u32 msg_type;
256 	u32 msg_size;
257 	u32 time_stamp_hi;
258 	u32 time_stamp_lo;
259 	u8 msg_data[];
260 };
261 
262 struct hfi_msg_sys_coverage_pkt {
263 	struct hfi_pkt_hdr hdr;
264 	u32 msg_size;
265 	u32 time_stamp_hi;
266 	u32 time_stamp_lo;
267 	u8 msg_data[];
268 };
269 
270 struct venus_core;
271 struct hfi_pkt_hdr;
272 
273 void hfi_process_watchdog_timeout(struct venus_core *core);
274 u32 hfi_process_msg_packet(struct venus_core *core, struct hfi_pkt_hdr *hdr);
275 
276 #endif
277