Loading...
1/*
2 * Copyright 2013-2016 Freescale Semiconductor Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of the above-listed copyright holders nor the
12 * names of any contributors may be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * ALTERNATIVELY, this software may be distributed under the terms of the
16 * GNU General Public License ("GPL") as published by the Free Software
17 * Foundation, either version 2 of that License or (at your option) any
18 * later version.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/*
34 * dprc-cmd.h
35 *
36 * defines dprc portal commands
37 *
38 */
39
40#ifndef _FSL_DPRC_CMD_H
41#define _FSL_DPRC_CMD_H
42
43/* Minimal supported DPRC Version */
44#define DPRC_MIN_VER_MAJOR 6
45#define DPRC_MIN_VER_MINOR 0
46
47/* Command versioning */
48#define DPRC_CMD_BASE_VERSION 1
49#define DPRC_CMD_ID_OFFSET 4
50
51#define DPRC_CMD(id) ((id << DPRC_CMD_ID_OFFSET) | DPRC_CMD_BASE_VERSION)
52
53/* Command IDs */
54#define DPRC_CMDID_CLOSE DPRC_CMD(0x800)
55#define DPRC_CMDID_OPEN DPRC_CMD(0x805)
56#define DPRC_CMDID_CREATE DPRC_CMD(0x905)
57#define DPRC_CMDID_GET_API_VERSION DPRC_CMD(0xa05)
58
59#define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
60#define DPRC_CMDID_RESET_CONT DPRC_CMD(0x005)
61
62#define DPRC_CMDID_SET_IRQ DPRC_CMD(0x010)
63#define DPRC_CMDID_GET_IRQ DPRC_CMD(0x011)
64#define DPRC_CMDID_SET_IRQ_ENABLE DPRC_CMD(0x012)
65#define DPRC_CMDID_GET_IRQ_ENABLE DPRC_CMD(0x013)
66#define DPRC_CMDID_SET_IRQ_MASK DPRC_CMD(0x014)
67#define DPRC_CMDID_GET_IRQ_MASK DPRC_CMD(0x015)
68#define DPRC_CMDID_GET_IRQ_STATUS DPRC_CMD(0x016)
69#define DPRC_CMDID_CLEAR_IRQ_STATUS DPRC_CMD(0x017)
70
71#define DPRC_CMDID_CREATE_CONT DPRC_CMD(0x151)
72#define DPRC_CMDID_DESTROY_CONT DPRC_CMD(0x152)
73#define DPRC_CMDID_GET_CONT_ID DPRC_CMD(0x830)
74#define DPRC_CMDID_SET_RES_QUOTA DPRC_CMD(0x155)
75#define DPRC_CMDID_GET_RES_QUOTA DPRC_CMD(0x156)
76#define DPRC_CMDID_ASSIGN DPRC_CMD(0x157)
77#define DPRC_CMDID_UNASSIGN DPRC_CMD(0x158)
78#define DPRC_CMDID_GET_OBJ_COUNT DPRC_CMD(0x159)
79#define DPRC_CMDID_GET_OBJ DPRC_CMD(0x15A)
80#define DPRC_CMDID_GET_RES_COUNT DPRC_CMD(0x15B)
81#define DPRC_CMDID_GET_RES_IDS DPRC_CMD(0x15C)
82#define DPRC_CMDID_GET_OBJ_REG DPRC_CMD(0x15E)
83#define DPRC_CMDID_SET_OBJ_IRQ DPRC_CMD(0x15F)
84#define DPRC_CMDID_GET_OBJ_IRQ DPRC_CMD(0x160)
85#define DPRC_CMDID_SET_OBJ_LABEL DPRC_CMD(0x161)
86#define DPRC_CMDID_GET_OBJ_DESC DPRC_CMD(0x162)
87
88#define DPRC_CMDID_CONNECT DPRC_CMD(0x167)
89#define DPRC_CMDID_DISCONNECT DPRC_CMD(0x168)
90#define DPRC_CMDID_GET_POOL DPRC_CMD(0x169)
91#define DPRC_CMDID_GET_POOL_COUNT DPRC_CMD(0x16A)
92
93#define DPRC_CMDID_GET_CONNECTION DPRC_CMD(0x16C)
94
95struct dprc_cmd_open {
96 __le32 container_id;
97};
98
99struct dprc_cmd_create_container {
100 /* cmd word 0 */
101 __le32 options;
102 __le16 icid;
103 __le16 pad0;
104 /* cmd word 1 */
105 __le32 pad1;
106 __le32 portal_id;
107 /* cmd words 2-3 */
108 u8 label[16];
109};
110
111struct dprc_rsp_create_container {
112 /* response word 0 */
113 __le64 pad0;
114 /* response word 1 */
115 __le32 child_container_id;
116 __le32 pad1;
117 /* response word 2 */
118 __le64 child_portal_addr;
119};
120
121struct dprc_cmd_destroy_container {
122 __le32 child_container_id;
123};
124
125struct dprc_cmd_reset_container {
126 __le32 child_container_id;
127};
128
129struct dprc_cmd_set_irq {
130 /* cmd word 0 */
131 __le32 irq_val;
132 u8 irq_index;
133 u8 pad[3];
134 /* cmd word 1 */
135 __le64 irq_addr;
136 /* cmd word 2 */
137 __le32 irq_num;
138};
139
140struct dprc_cmd_get_irq {
141 __le32 pad;
142 u8 irq_index;
143};
144
145struct dprc_rsp_get_irq {
146 /* response word 0 */
147 __le32 irq_val;
148 __le32 pad;
149 /* response word 1 */
150 __le64 irq_addr;
151 /* response word 2 */
152 __le32 irq_num;
153 __le32 type;
154};
155
156#define DPRC_ENABLE 0x1
157
158struct dprc_cmd_set_irq_enable {
159 u8 enable;
160 u8 pad[3];
161 u8 irq_index;
162};
163
164struct dprc_cmd_get_irq_enable {
165 __le32 pad;
166 u8 irq_index;
167};
168
169struct dprc_rsp_get_irq_enable {
170 u8 enabled;
171};
172
173struct dprc_cmd_set_irq_mask {
174 __le32 mask;
175 u8 irq_index;
176};
177
178struct dprc_cmd_get_irq_mask {
179 __le32 pad;
180 u8 irq_index;
181};
182
183struct dprc_rsp_get_irq_mask {
184 __le32 mask;
185};
186
187struct dprc_cmd_get_irq_status {
188 __le32 status;
189 u8 irq_index;
190};
191
192struct dprc_rsp_get_irq_status {
193 __le32 status;
194};
195
196struct dprc_cmd_clear_irq_status {
197 __le32 status;
198 u8 irq_index;
199};
200
201struct dprc_rsp_get_attributes {
202 /* response word 0 */
203 __le32 container_id;
204 __le16 icid;
205 __le16 pad;
206 /* response word 1 */
207 __le32 options;
208 __le32 portal_id;
209};
210
211struct dprc_cmd_set_res_quota {
212 /* cmd word 0 */
213 __le32 child_container_id;
214 __le16 quota;
215 __le16 pad;
216 /* cmd words 1-2 */
217 u8 type[16];
218};
219
220struct dprc_cmd_get_res_quota {
221 /* cmd word 0 */
222 __le32 child_container_id;
223 __le32 pad;
224 /* cmd word 1-2 */
225 u8 type[16];
226};
227
228struct dprc_rsp_get_res_quota {
229 __le32 pad;
230 __le16 quota;
231};
232
233struct dprc_cmd_assign {
234 /* cmd word 0 */
235 __le32 container_id;
236 __le32 options;
237 /* cmd word 1 */
238 __le32 num;
239 __le32 id_base_align;
240 /* cmd word 2-3 */
241 u8 type[16];
242};
243
244struct dprc_cmd_unassign {
245 /* cmd word 0 */
246 __le32 child_container_id;
247 __le32 options;
248 /* cmd word 1 */
249 __le32 num;
250 __le32 id_base_align;
251 /* cmd word 2-3 */
252 u8 type[16];
253};
254
255struct dprc_rsp_get_pool_count {
256 __le32 pool_count;
257};
258
259struct dprc_cmd_get_pool {
260 __le32 pool_index;
261};
262
263struct dprc_rsp_get_pool {
264 /* response word 0 */
265 __le64 pad;
266 /* response word 1-2 */
267 u8 type[16];
268};
269
270struct dprc_rsp_get_obj_count {
271 __le32 pad;
272 __le32 obj_count;
273};
274
275struct dprc_cmd_get_obj {
276 __le32 obj_index;
277};
278
279struct dprc_rsp_get_obj {
280 /* response word 0 */
281 __le32 pad0;
282 __le32 id;
283 /* response word 1 */
284 __le16 vendor;
285 u8 irq_count;
286 u8 region_count;
287 __le32 state;
288 /* response word 2 */
289 __le16 version_major;
290 __le16 version_minor;
291 __le16 flags;
292 __le16 pad1;
293 /* response word 3-4 */
294 u8 type[16];
295 /* response word 5-6 */
296 u8 label[16];
297};
298
299struct dprc_cmd_get_obj_desc {
300 /* cmd word 0 */
301 __le32 obj_id;
302 __le32 pad;
303 /* cmd word 1-2 */
304 u8 type[16];
305};
306
307struct dprc_rsp_get_obj_desc {
308 /* response word 0 */
309 __le32 pad0;
310 __le32 id;
311 /* response word 1 */
312 __le16 vendor;
313 u8 irq_count;
314 u8 region_count;
315 __le32 state;
316 /* response word 2 */
317 __le16 version_major;
318 __le16 version_minor;
319 __le16 flags;
320 __le16 pad1;
321 /* response word 3-4 */
322 u8 type[16];
323 /* response word 5-6 */
324 u8 label[16];
325};
326
327struct dprc_cmd_get_res_count {
328 /* cmd word 0 */
329 __le64 pad;
330 /* cmd word 1-2 */
331 u8 type[16];
332};
333
334struct dprc_rsp_get_res_count {
335 __le32 res_count;
336};
337
338struct dprc_cmd_get_res_ids {
339 /* cmd word 0 */
340 u8 pad0[5];
341 u8 iter_status;
342 __le16 pad1;
343 /* cmd word 1 */
344 __le32 base_id;
345 __le32 last_id;
346 /* cmd word 2-3 */
347 u8 type[16];
348};
349
350struct dprc_rsp_get_res_ids {
351 /* response word 0 */
352 u8 pad0[5];
353 u8 iter_status;
354 __le16 pad1;
355 /* response word 1 */
356 __le32 base_id;
357 __le32 last_id;
358};
359
360struct dprc_cmd_get_obj_region {
361 /* cmd word 0 */
362 __le32 obj_id;
363 __le16 pad0;
364 u8 region_index;
365 u8 pad1;
366 /* cmd word 1-2 */
367 __le64 pad2[2];
368 /* cmd word 3-4 */
369 u8 obj_type[16];
370};
371
372struct dprc_rsp_get_obj_region {
373 /* response word 0 */
374 __le64 pad;
375 /* response word 1 */
376 __le64 base_addr;
377 /* response word 2 */
378 __le32 size;
379};
380
381struct dprc_cmd_set_obj_label {
382 /* cmd word 0 */
383 __le32 obj_id;
384 __le32 pad;
385 /* cmd word 1-2 */
386 u8 label[16];
387 /* cmd word 3-4 */
388 u8 obj_type[16];
389};
390
391struct dprc_cmd_set_obj_irq {
392 /* cmd word 0 */
393 __le32 irq_val;
394 u8 irq_index;
395 u8 pad[3];
396 /* cmd word 1 */
397 __le64 irq_addr;
398 /* cmd word 2 */
399 __le32 irq_num;
400 __le32 obj_id;
401 /* cmd word 3-4 */
402 u8 obj_type[16];
403};
404
405struct dprc_cmd_get_obj_irq {
406 /* cmd word 0 */
407 __le32 obj_id;
408 u8 irq_index;
409 u8 pad[3];
410 /* cmd word 1-2 */
411 u8 obj_type[16];
412};
413
414struct dprc_rsp_get_obj_irq {
415 /* response word 0 */
416 __le32 irq_val;
417 __le32 pad;
418 /* response word 1 */
419 __le64 irq_addr;
420 /* response word 2 */
421 __le32 irq_num;
422 __le32 type;
423};
424
425struct dprc_cmd_connect {
426 /* cmd word 0 */
427 __le32 ep1_id;
428 __le32 ep1_interface_id;
429 /* cmd word 1 */
430 __le32 ep2_id;
431 __le32 ep2_interface_id;
432 /* cmd word 2-3 */
433 u8 ep1_type[16];
434 /* cmd word 4 */
435 __le32 max_rate;
436 __le32 committed_rate;
437 /* cmd word 5-6 */
438 u8 ep2_type[16];
439};
440
441struct dprc_cmd_disconnect {
442 /* cmd word 0 */
443 __le32 id;
444 __le32 interface_id;
445 /* cmd word 1-2 */
446 u8 type[16];
447};
448
449struct dprc_cmd_get_connection {
450 /* cmd word 0 */
451 __le32 ep1_id;
452 __le32 ep1_interface_id;
453 /* cmd word 1-2 */
454 u8 ep1_type[16];
455};
456
457struct dprc_rsp_get_connection {
458 /* response word 0-2 */
459 __le64 pad[3];
460 /* response word 3 */
461 __le32 ep2_id;
462 __le32 ep2_interface_id;
463 /* response word 4-5 */
464 u8 ep2_type[16];
465 /* response word 6 */
466 __le32 state;
467};
468
469#endif /* _FSL_DPRC_CMD_H */