Commit | Line | Data |
---|---|---|
9989b599 | 1 | /* Copyright 2013-2016 Freescale Semiconductor Inc. |
31c88965 GR |
2 | * |
3 | * Redistribution and use in source and binary forms, with or without | |
4 | * modification, are permitted provided that the following conditions are met: | |
5 | * * Redistributions of source code must retain the above copyright | |
6 | * notice, this list of conditions and the following disclaimer. | |
7 | * * Redistributions in binary form must reproduce the above copyright | |
8 | * notice, this list of conditions and the following disclaimer in the | |
9 | * documentation and/or other materials provided with the distribution. | |
10 | * * Neither the name of the above-listed copyright holders nor the | |
11 | * names of any contributors may be used to endorse or promote products | |
12 | * derived from this software without specific prior written permission. | |
13 | * | |
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 | #include "../include/mc-sys.h" | |
33 | #include "../include/mc-cmd.h" | |
34 | #include "../include/dprc.h" | |
d4e75132 | 35 | |
31c88965 GR |
36 | #include "dprc-cmd.h" |
37 | ||
e9bf3f20 GR |
38 | /** |
39 | * dprc_open() - Open DPRC object for use | |
40 | * @mc_io: Pointer to MC portal's I/O object | |
41 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
42 | * @container_id: Container ID to open | |
43 | * @token: Returned token of DPRC object | |
44 | * | |
45 | * Return: '0' on Success; Error code otherwise. | |
46 | * | |
47 | * @warning Required before any operation on the object. | |
48 | */ | |
1ee695fa | 49 | int dprc_open(struct fsl_mc_io *mc_io, |
ba72f25b | 50 | u32 cmd_flags, |
1ee695fa | 51 | int container_id, |
ba72f25b | 52 | u16 *token) |
31c88965 GR |
53 | { |
54 | struct mc_command cmd = { 0 }; | |
9989b599 | 55 | struct dprc_cmd_open *cmd_params; |
31c88965 GR |
56 | int err; |
57 | ||
58 | /* prepare command */ | |
1ee695fa | 59 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, cmd_flags, |
31c88965 | 60 | 0); |
9989b599 IR |
61 | cmd_params = (struct dprc_cmd_open *)cmd.params; |
62 | cmd_params->container_id = cpu_to_le32(container_id); | |
31c88965 GR |
63 | |
64 | /* send command to mc*/ | |
65 | err = mc_send_command(mc_io, &cmd); | |
66 | if (err) | |
67 | return err; | |
68 | ||
69 | /* retrieve response parameters */ | |
9989b599 | 70 | *token = mc_cmd_hdr_read_token(&cmd); |
31c88965 GR |
71 | |
72 | return 0; | |
73 | } | |
74 | EXPORT_SYMBOL(dprc_open); | |
75 | ||
e9bf3f20 GR |
76 | /** |
77 | * dprc_close() - Close the control session of the object | |
78 | * @mc_io: Pointer to MC portal's I/O object | |
79 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
80 | * @token: Token of DPRC object | |
81 | * | |
82 | * After this function is called, no further operations are | |
83 | * allowed on the object without opening a new control session. | |
84 | * | |
85 | * Return: '0' on Success; Error code otherwise. | |
86 | */ | |
1ee695fa | 87 | int dprc_close(struct fsl_mc_io *mc_io, |
ba72f25b GR |
88 | u32 cmd_flags, |
89 | u16 token) | |
31c88965 GR |
90 | { |
91 | struct mc_command cmd = { 0 }; | |
92 | ||
93 | /* prepare command */ | |
1ee695fa | 94 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, cmd_flags, |
31c88965 GR |
95 | token); |
96 | ||
97 | /* send command to mc*/ | |
98 | return mc_send_command(mc_io, &cmd); | |
99 | } | |
100 | EXPORT_SYMBOL(dprc_close); | |
101 | ||
e9bf3f20 GR |
102 | /** |
103 | * dprc_create_container() - Create child container | |
104 | * @mc_io: Pointer to MC portal's I/O object | |
105 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
106 | * @token: Token of DPRC object | |
107 | * @cfg: Child container configuration | |
108 | * @child_container_id: Returned child container ID | |
109 | * @child_portal_offset: Returned child portal offset from MC portal base | |
110 | * | |
111 | * Return: '0' on Success; Error code otherwise. | |
112 | */ | |
31c88965 | 113 | int dprc_create_container(struct fsl_mc_io *mc_io, |
ba72f25b GR |
114 | u32 cmd_flags, |
115 | u16 token, | |
31c88965 GR |
116 | struct dprc_cfg *cfg, |
117 | int *child_container_id, | |
ba72f25b | 118 | u64 *child_portal_offset) |
31c88965 GR |
119 | { |
120 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
121 | struct dprc_cmd_create_container *cmd_params; |
122 | struct dprc_rsp_create_container *rsp_params; | |
31c88965 GR |
123 | int err; |
124 | ||
125 | /* prepare command */ | |
9989b599 IR |
126 | cmd_params = (struct dprc_cmd_create_container *)cmd.params; |
127 | cmd_params->options = cpu_to_le32(cfg->options); | |
128 | cmd_params->icid = cpu_to_le16(cfg->icid); | |
129 | cmd_params->portal_id = cpu_to_le32(cfg->portal_id); | |
130 | strncpy(cmd_params->label, cfg->label, 16); | |
131 | cmd_params->label[15] = '\0'; | |
31c88965 GR |
132 | |
133 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_CREATE_CONT, | |
1ee695fa | 134 | cmd_flags, token); |
31c88965 GR |
135 | |
136 | /* send command to mc*/ | |
137 | err = mc_send_command(mc_io, &cmd); | |
138 | if (err) | |
139 | return err; | |
140 | ||
141 | /* retrieve response parameters */ | |
9989b599 IR |
142 | rsp_params = (struct dprc_rsp_create_container *)cmd.params; |
143 | *child_container_id = le32_to_cpu(rsp_params->child_container_id); | |
144 | *child_portal_offset = le64_to_cpu(rsp_params->child_portal_addr); | |
31c88965 GR |
145 | |
146 | return 0; | |
147 | } | |
148 | ||
e9bf3f20 GR |
149 | /** |
150 | * dprc_destroy_container() - Destroy child container. | |
151 | * @mc_io: Pointer to MC portal's I/O object | |
152 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
153 | * @token: Token of DPRC object | |
154 | * @child_container_id: ID of the container to destroy | |
155 | * | |
156 | * This function terminates the child container, so following this call the | |
157 | * child container ID becomes invalid. | |
158 | * | |
159 | * Notes: | |
160 | * - All resources and objects of the destroyed container are returned to the | |
161 | * parent container or destroyed if were created be the destroyed container. | |
162 | * - This function destroy all the child containers of the specified | |
163 | * container prior to destroying the container itself. | |
164 | * | |
165 | * warning: Only the parent container is allowed to destroy a child policy | |
166 | * Container 0 can't be destroyed | |
167 | * | |
168 | * Return: '0' on Success; Error code otherwise. | |
169 | * | |
170 | */ | |
31c88965 | 171 | int dprc_destroy_container(struct fsl_mc_io *mc_io, |
ba72f25b GR |
172 | u32 cmd_flags, |
173 | u16 token, | |
31c88965 GR |
174 | int child_container_id) |
175 | { | |
176 | struct mc_command cmd = { 0 }; | |
9989b599 | 177 | struct dprc_cmd_destroy_container *cmd_params; |
31c88965 GR |
178 | |
179 | /* prepare command */ | |
180 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_DESTROY_CONT, | |
1ee695fa | 181 | cmd_flags, token); |
9989b599 IR |
182 | cmd_params = (struct dprc_cmd_destroy_container *)cmd.params; |
183 | cmd_params->child_container_id = cpu_to_le32(child_container_id); | |
31c88965 GR |
184 | |
185 | /* send command to mc*/ | |
186 | return mc_send_command(mc_io, &cmd); | |
187 | } | |
188 | ||
e9bf3f20 GR |
189 | /** |
190 | * dprc_reset_container - Reset child container. | |
191 | * @mc_io: Pointer to MC portal's I/O object | |
192 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
193 | * @token: Token of DPRC object | |
194 | * @child_container_id: ID of the container to reset | |
195 | * | |
196 | * In case a software context crashes or becomes non-responsive, the parent | |
197 | * may wish to reset its resources container before the software context is | |
198 | * restarted. | |
199 | * | |
200 | * This routine informs all objects assigned to the child container that the | |
201 | * container is being reset, so they may perform any cleanup operations that are | |
202 | * needed. All objects handles that were owned by the child container shall be | |
203 | * closed. | |
204 | * | |
205 | * Note that such request may be submitted even if the child software context | |
206 | * has not crashed, but the resulting object cleanup operations will not be | |
207 | * aware of that. | |
208 | * | |
209 | * Return: '0' on Success; Error code otherwise. | |
210 | */ | |
31c88965 | 211 | int dprc_reset_container(struct fsl_mc_io *mc_io, |
ba72f25b GR |
212 | u32 cmd_flags, |
213 | u16 token, | |
31c88965 GR |
214 | int child_container_id) |
215 | { | |
216 | struct mc_command cmd = { 0 }; | |
9989b599 | 217 | struct dprc_cmd_reset_container *cmd_params; |
31c88965 GR |
218 | |
219 | /* prepare command */ | |
220 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_RESET_CONT, | |
1ee695fa | 221 | cmd_flags, token); |
9989b599 IR |
222 | cmd_params = (struct dprc_cmd_reset_container *)cmd.params; |
223 | cmd_params->child_container_id = cpu_to_le32(child_container_id); | |
31c88965 GR |
224 | |
225 | /* send command to mc*/ | |
226 | return mc_send_command(mc_io, &cmd); | |
227 | } | |
228 | ||
e9bf3f20 GR |
229 | /** |
230 | * dprc_get_irq() - Get IRQ information from the DPRC. | |
231 | * @mc_io: Pointer to MC portal's I/O object | |
232 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
233 | * @token: Token of DPRC object | |
234 | * @irq_index: The interrupt index to configure | |
235 | * @type: Interrupt type: 0 represents message interrupt | |
236 | * type (both irq_addr and irq_val are valid) | |
237 | * @irq_cfg: IRQ attributes | |
238 | * | |
239 | * Return: '0' on Success; Error code otherwise. | |
240 | */ | |
31c88965 | 241 | int dprc_get_irq(struct fsl_mc_io *mc_io, |
ba72f25b GR |
242 | u32 cmd_flags, |
243 | u16 token, | |
244 | u8 irq_index, | |
31c88965 | 245 | int *type, |
1ee695fa | 246 | struct dprc_irq_cfg *irq_cfg) |
31c88965 GR |
247 | { |
248 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
249 | struct dprc_cmd_get_irq *cmd_params; |
250 | struct dprc_rsp_get_irq *rsp_params; | |
31c88965 GR |
251 | int err; |
252 | ||
253 | /* prepare command */ | |
254 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ, | |
1ee695fa | 255 | cmd_flags, |
31c88965 | 256 | token); |
9989b599 IR |
257 | cmd_params = (struct dprc_cmd_get_irq *)cmd.params; |
258 | cmd_params->irq_index = irq_index; | |
31c88965 GR |
259 | |
260 | /* send command to mc*/ | |
261 | err = mc_send_command(mc_io, &cmd); | |
262 | if (err) | |
263 | return err; | |
264 | ||
265 | /* retrieve response parameters */ | |
9989b599 IR |
266 | rsp_params = (struct dprc_rsp_get_irq *)cmd.params; |
267 | irq_cfg->val = le32_to_cpu(rsp_params->irq_val); | |
268 | irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr); | |
269 | irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num); | |
270 | *type = le32_to_cpu(rsp_params->type); | |
31c88965 GR |
271 | |
272 | return 0; | |
273 | } | |
274 | ||
e9bf3f20 GR |
275 | /** |
276 | * dprc_set_irq() - Set IRQ information for the DPRC to trigger an interrupt. | |
277 | * @mc_io: Pointer to MC portal's I/O object | |
278 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
279 | * @token: Token of DPRC object | |
280 | * @irq_index: Identifies the interrupt index to configure | |
281 | * @irq_cfg: IRQ configuration | |
282 | * | |
283 | * Return: '0' on Success; Error code otherwise. | |
284 | */ | |
31c88965 | 285 | int dprc_set_irq(struct fsl_mc_io *mc_io, |
ba72f25b GR |
286 | u32 cmd_flags, |
287 | u16 token, | |
288 | u8 irq_index, | |
1ee695fa | 289 | struct dprc_irq_cfg *irq_cfg) |
31c88965 GR |
290 | { |
291 | struct mc_command cmd = { 0 }; | |
9989b599 | 292 | struct dprc_cmd_set_irq *cmd_params; |
31c88965 GR |
293 | |
294 | /* prepare command */ | |
295 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ, | |
1ee695fa | 296 | cmd_flags, |
31c88965 | 297 | token); |
9989b599 IR |
298 | cmd_params = (struct dprc_cmd_set_irq *)cmd.params; |
299 | cmd_params->irq_val = cpu_to_le32(irq_cfg->val); | |
300 | cmd_params->irq_index = irq_index; | |
301 | cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr); | |
302 | cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num); | |
31c88965 GR |
303 | |
304 | /* send command to mc*/ | |
305 | return mc_send_command(mc_io, &cmd); | |
306 | } | |
307 | ||
e9bf3f20 GR |
308 | /** |
309 | * dprc_get_irq_enable() - Get overall interrupt state. | |
310 | * @mc_io: Pointer to MC portal's I/O object | |
311 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
312 | * @token: Token of DPRC object | |
313 | * @irq_index: The interrupt index to configure | |
314 | * @en: Returned interrupt state - enable = 1, disable = 0 | |
315 | * | |
316 | * Return: '0' on Success; Error code otherwise. | |
317 | */ | |
31c88965 | 318 | int dprc_get_irq_enable(struct fsl_mc_io *mc_io, |
ba72f25b GR |
319 | u32 cmd_flags, |
320 | u16 token, | |
321 | u8 irq_index, | |
322 | u8 *en) | |
31c88965 GR |
323 | { |
324 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
325 | struct dprc_cmd_get_irq_enable *cmd_params; |
326 | struct dprc_rsp_get_irq_enable *rsp_params; | |
31c88965 GR |
327 | int err; |
328 | ||
329 | /* prepare command */ | |
330 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_ENABLE, | |
1ee695fa | 331 | cmd_flags, token); |
9989b599 IR |
332 | cmd_params = (struct dprc_cmd_get_irq_enable *)cmd.params; |
333 | cmd_params->irq_index = irq_index; | |
31c88965 GR |
334 | |
335 | /* send command to mc*/ | |
336 | err = mc_send_command(mc_io, &cmd); | |
337 | if (err) | |
338 | return err; | |
339 | ||
340 | /* retrieve response parameters */ | |
9989b599 IR |
341 | rsp_params = (struct dprc_rsp_get_irq_enable *)cmd.params; |
342 | *en = rsp_params->enabled & DPRC_ENABLE; | |
31c88965 GR |
343 | |
344 | return 0; | |
345 | } | |
346 | ||
e9bf3f20 GR |
347 | /** |
348 | * dprc_set_irq_enable() - Set overall interrupt state. | |
349 | * @mc_io: Pointer to MC portal's I/O object | |
350 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
351 | * @token: Token of DPRC object | |
352 | * @irq_index: The interrupt index to configure | |
353 | * @en: Interrupt state - enable = 1, disable = 0 | |
354 | * | |
355 | * Allows GPP software to control when interrupts are generated. | |
356 | * Each interrupt can have up to 32 causes. The enable/disable control's the | |
357 | * overall interrupt state. if the interrupt is disabled no causes will cause | |
358 | * an interrupt. | |
359 | * | |
360 | * Return: '0' on Success; Error code otherwise. | |
361 | */ | |
31c88965 | 362 | int dprc_set_irq_enable(struct fsl_mc_io *mc_io, |
ba72f25b GR |
363 | u32 cmd_flags, |
364 | u16 token, | |
365 | u8 irq_index, | |
366 | u8 en) | |
31c88965 GR |
367 | { |
368 | struct mc_command cmd = { 0 }; | |
9989b599 | 369 | struct dprc_cmd_set_irq_enable *cmd_params; |
31c88965 GR |
370 | |
371 | /* prepare command */ | |
372 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_ENABLE, | |
1ee695fa | 373 | cmd_flags, token); |
9989b599 IR |
374 | cmd_params = (struct dprc_cmd_set_irq_enable *)cmd.params; |
375 | cmd_params->enable = en & DPRC_ENABLE; | |
376 | cmd_params->irq_index = irq_index; | |
31c88965 GR |
377 | |
378 | /* send command to mc*/ | |
379 | return mc_send_command(mc_io, &cmd); | |
380 | } | |
381 | ||
e9bf3f20 GR |
382 | /** |
383 | * dprc_get_irq_mask() - Get interrupt mask. | |
384 | * @mc_io: Pointer to MC portal's I/O object | |
385 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
386 | * @token: Token of DPRC object | |
387 | * @irq_index: The interrupt index to configure | |
388 | * @mask: Returned event mask to trigger interrupt | |
389 | * | |
390 | * Every interrupt can have up to 32 causes and the interrupt model supports | |
391 | * masking/unmasking each cause independently | |
392 | * | |
393 | * Return: '0' on Success; Error code otherwise. | |
394 | */ | |
31c88965 | 395 | int dprc_get_irq_mask(struct fsl_mc_io *mc_io, |
ba72f25b GR |
396 | u32 cmd_flags, |
397 | u16 token, | |
398 | u8 irq_index, | |
399 | u32 *mask) | |
31c88965 GR |
400 | { |
401 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
402 | struct dprc_cmd_get_irq_mask *cmd_params; |
403 | struct dprc_rsp_get_irq_mask *rsp_params; | |
31c88965 GR |
404 | int err; |
405 | ||
406 | /* prepare command */ | |
407 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_MASK, | |
1ee695fa | 408 | cmd_flags, token); |
9989b599 IR |
409 | cmd_params = (struct dprc_cmd_get_irq_mask *)cmd.params; |
410 | cmd_params->irq_index = irq_index; | |
31c88965 GR |
411 | |
412 | /* send command to mc*/ | |
413 | err = mc_send_command(mc_io, &cmd); | |
414 | if (err) | |
415 | return err; | |
416 | ||
417 | /* retrieve response parameters */ | |
9989b599 IR |
418 | rsp_params = (struct dprc_rsp_get_irq_mask *)cmd.params; |
419 | *mask = le32_to_cpu(rsp_params->mask); | |
31c88965 GR |
420 | |
421 | return 0; | |
422 | } | |
423 | ||
e9bf3f20 GR |
424 | /** |
425 | * dprc_set_irq_mask() - Set interrupt mask. | |
426 | * @mc_io: Pointer to MC portal's I/O object | |
427 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
428 | * @token: Token of DPRC object | |
429 | * @irq_index: The interrupt index to configure | |
430 | * @mask: event mask to trigger interrupt; | |
431 | * each bit: | |
432 | * 0 = ignore event | |
433 | * 1 = consider event for asserting irq | |
434 | * | |
435 | * Every interrupt can have up to 32 causes and the interrupt model supports | |
436 | * masking/unmasking each cause independently | |
437 | * | |
438 | * Return: '0' on Success; Error code otherwise. | |
439 | */ | |
31c88965 | 440 | int dprc_set_irq_mask(struct fsl_mc_io *mc_io, |
ba72f25b GR |
441 | u32 cmd_flags, |
442 | u16 token, | |
443 | u8 irq_index, | |
444 | u32 mask) | |
31c88965 GR |
445 | { |
446 | struct mc_command cmd = { 0 }; | |
9989b599 | 447 | struct dprc_cmd_set_irq_mask *cmd_params; |
31c88965 GR |
448 | |
449 | /* prepare command */ | |
450 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_IRQ_MASK, | |
1ee695fa | 451 | cmd_flags, token); |
9989b599 IR |
452 | cmd_params = (struct dprc_cmd_set_irq_mask *)cmd.params; |
453 | cmd_params->mask = cpu_to_le32(mask); | |
454 | cmd_params->irq_index = irq_index; | |
31c88965 GR |
455 | |
456 | /* send command to mc*/ | |
457 | return mc_send_command(mc_io, &cmd); | |
458 | } | |
459 | ||
e9bf3f20 GR |
460 | /** |
461 | * dprc_get_irq_status() - Get the current status of any pending interrupts. | |
462 | * @mc_io: Pointer to MC portal's I/O object | |
463 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
464 | * @token: Token of DPRC object | |
465 | * @irq_index: The interrupt index to configure | |
466 | * @status: Returned interrupts status - one bit per cause: | |
467 | * 0 = no interrupt pending | |
468 | * 1 = interrupt pending | |
469 | * | |
470 | * Return: '0' on Success; Error code otherwise. | |
471 | */ | |
31c88965 | 472 | int dprc_get_irq_status(struct fsl_mc_io *mc_io, |
ba72f25b GR |
473 | u32 cmd_flags, |
474 | u16 token, | |
475 | u8 irq_index, | |
476 | u32 *status) | |
31c88965 GR |
477 | { |
478 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
479 | struct dprc_cmd_get_irq_status *cmd_params; |
480 | struct dprc_rsp_get_irq_status *rsp_params; | |
31c88965 GR |
481 | int err; |
482 | ||
483 | /* prepare command */ | |
484 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_IRQ_STATUS, | |
1ee695fa | 485 | cmd_flags, token); |
9989b599 IR |
486 | cmd_params = (struct dprc_cmd_get_irq_status *)cmd.params; |
487 | cmd_params->status = cpu_to_le32(*status); | |
488 | cmd_params->irq_index = irq_index; | |
31c88965 GR |
489 | |
490 | /* send command to mc*/ | |
491 | err = mc_send_command(mc_io, &cmd); | |
492 | if (err) | |
493 | return err; | |
494 | ||
495 | /* retrieve response parameters */ | |
9989b599 IR |
496 | rsp_params = (struct dprc_rsp_get_irq_status *)cmd.params; |
497 | *status = le32_to_cpu(rsp_params->status); | |
31c88965 GR |
498 | |
499 | return 0; | |
500 | } | |
501 | ||
e9bf3f20 GR |
502 | /** |
503 | * dprc_clear_irq_status() - Clear a pending interrupt's status | |
504 | * @mc_io: Pointer to MC portal's I/O object | |
505 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
506 | * @token: Token of DPRC object | |
507 | * @irq_index: The interrupt index to configure | |
508 | * @status: bits to clear (W1C) - one bit per cause: | |
509 | * 0 = don't change | |
510 | * 1 = clear status bit | |
511 | * | |
512 | * Return: '0' on Success; Error code otherwise. | |
513 | */ | |
31c88965 | 514 | int dprc_clear_irq_status(struct fsl_mc_io *mc_io, |
ba72f25b GR |
515 | u32 cmd_flags, |
516 | u16 token, | |
517 | u8 irq_index, | |
518 | u32 status) | |
31c88965 GR |
519 | { |
520 | struct mc_command cmd = { 0 }; | |
9989b599 | 521 | struct dprc_cmd_clear_irq_status *cmd_params; |
31c88965 GR |
522 | |
523 | /* prepare command */ | |
524 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLEAR_IRQ_STATUS, | |
1ee695fa | 525 | cmd_flags, token); |
9989b599 IR |
526 | cmd_params = (struct dprc_cmd_clear_irq_status *)cmd.params; |
527 | cmd_params->status = cpu_to_le32(status); | |
528 | cmd_params->irq_index = irq_index; | |
31c88965 GR |
529 | |
530 | /* send command to mc*/ | |
531 | return mc_send_command(mc_io, &cmd); | |
532 | } | |
533 | ||
e9bf3f20 GR |
534 | /** |
535 | * dprc_get_attributes() - Obtains container attributes | |
536 | * @mc_io: Pointer to MC portal's I/O object | |
537 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
538 | * @token: Token of DPRC object | |
539 | * @attributes Returned container attributes | |
540 | * | |
541 | * Return: '0' on Success; Error code otherwise. | |
542 | */ | |
31c88965 | 543 | int dprc_get_attributes(struct fsl_mc_io *mc_io, |
ba72f25b GR |
544 | u32 cmd_flags, |
545 | u16 token, | |
31c88965 GR |
546 | struct dprc_attributes *attr) |
547 | { | |
548 | struct mc_command cmd = { 0 }; | |
9989b599 | 549 | struct dprc_rsp_get_attributes *rsp_params; |
31c88965 GR |
550 | int err; |
551 | ||
552 | /* prepare command */ | |
553 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_ATTR, | |
1ee695fa | 554 | cmd_flags, |
31c88965 GR |
555 | token); |
556 | ||
557 | /* send command to mc*/ | |
558 | err = mc_send_command(mc_io, &cmd); | |
559 | if (err) | |
560 | return err; | |
561 | ||
562 | /* retrieve response parameters */ | |
9989b599 IR |
563 | rsp_params = (struct dprc_rsp_get_attributes *)cmd.params; |
564 | attr->container_id = le32_to_cpu(rsp_params->container_id); | |
565 | attr->icid = le16_to_cpu(rsp_params->icid); | |
566 | attr->options = le32_to_cpu(rsp_params->options); | |
567 | attr->portal_id = le32_to_cpu(rsp_params->portal_id); | |
568 | attr->version.major = le16_to_cpu(rsp_params->version_major); | |
569 | attr->version.minor = le16_to_cpu(rsp_params->version_minor); | |
31c88965 GR |
570 | |
571 | return 0; | |
572 | } | |
573 | ||
e9bf3f20 GR |
574 | /** |
575 | * dprc_set_res_quota() - Set allocation policy for a specific resource/object | |
576 | * type in a child container | |
577 | * @mc_io: Pointer to MC portal's I/O object | |
578 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
579 | * @token: Token of DPRC object | |
580 | * @child_container_id: ID of the child container | |
581 | * @type: Resource/object type | |
582 | * @quota: Sets the maximum number of resources of the selected type | |
583 | * that the child container is allowed to allocate from its parent; | |
584 | * when quota is set to -1, the policy is the same as container's | |
585 | * general policy. | |
586 | * | |
587 | * Allocation policy determines whether or not a container may allocate | |
588 | * resources from its parent. Each container has a 'global' allocation policy | |
589 | * that is set when the container is created. | |
590 | * | |
591 | * This function sets allocation policy for a specific resource type. | |
592 | * The default policy for all resource types matches the container's 'global' | |
593 | * allocation policy. | |
594 | * | |
595 | * Return: '0' on Success; Error code otherwise. | |
596 | * | |
597 | * @warning Only the parent container is allowed to change a child policy. | |
598 | */ | |
31c88965 | 599 | int dprc_set_res_quota(struct fsl_mc_io *mc_io, |
ba72f25b GR |
600 | u32 cmd_flags, |
601 | u16 token, | |
31c88965 GR |
602 | int child_container_id, |
603 | char *type, | |
ba72f25b | 604 | u16 quota) |
31c88965 GR |
605 | { |
606 | struct mc_command cmd = { 0 }; | |
9989b599 | 607 | struct dprc_cmd_set_res_quota *cmd_params; |
31c88965 GR |
608 | |
609 | /* prepare command */ | |
610 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_RES_QUOTA, | |
1ee695fa | 611 | cmd_flags, token); |
9989b599 IR |
612 | cmd_params = (struct dprc_cmd_set_res_quota *)cmd.params; |
613 | cmd_params->child_container_id = cpu_to_le32(child_container_id); | |
614 | cmd_params->quota = cpu_to_le16(quota); | |
615 | strncpy(cmd_params->type, type, 16); | |
616 | cmd_params->type[15] = '\0'; | |
31c88965 GR |
617 | |
618 | /* send command to mc*/ | |
619 | return mc_send_command(mc_io, &cmd); | |
620 | } | |
621 | ||
e9bf3f20 GR |
622 | /** |
623 | * dprc_get_res_quota() - Gets the allocation policy of a specific | |
624 | * resource/object type in a child container | |
625 | * @mc_io: Pointer to MC portal's I/O object | |
626 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
627 | * @token: Token of DPRC object | |
628 | * @child_container_id; ID of the child container | |
629 | * @type: resource/object type | |
630 | * @quota: Returnes the maximum number of resources of the selected type | |
631 | * that the child container is allowed to allocate from the parent; | |
632 | * when quota is set to -1, the policy is the same as container's | |
633 | * general policy. | |
634 | * | |
635 | * Return: '0' on Success; Error code otherwise. | |
636 | */ | |
31c88965 | 637 | int dprc_get_res_quota(struct fsl_mc_io *mc_io, |
ba72f25b GR |
638 | u32 cmd_flags, |
639 | u16 token, | |
31c88965 GR |
640 | int child_container_id, |
641 | char *type, | |
ba72f25b | 642 | u16 *quota) |
31c88965 GR |
643 | { |
644 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
645 | struct dprc_cmd_get_res_quota *cmd_params; |
646 | struct dprc_rsp_get_res_quota *rsp_params; | |
31c88965 GR |
647 | int err; |
648 | ||
649 | /* prepare command */ | |
650 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_QUOTA, | |
1ee695fa | 651 | cmd_flags, token); |
9989b599 IR |
652 | cmd_params = (struct dprc_cmd_get_res_quota *)cmd.params; |
653 | cmd_params->child_container_id = cpu_to_le32(child_container_id); | |
654 | strncpy(cmd_params->type, type, 16); | |
655 | cmd_params->type[15] = '\0'; | |
31c88965 GR |
656 | |
657 | /* send command to mc*/ | |
658 | err = mc_send_command(mc_io, &cmd); | |
659 | if (err) | |
660 | return err; | |
661 | ||
662 | /* retrieve response parameters */ | |
9989b599 IR |
663 | rsp_params = (struct dprc_rsp_get_res_quota *)cmd.params; |
664 | *quota = le16_to_cpu(rsp_params->quota); | |
31c88965 GR |
665 | |
666 | return 0; | |
667 | } | |
668 | ||
e9bf3f20 GR |
669 | /** |
670 | * dprc_assign() - Assigns objects or resource to a child container. | |
671 | * @mc_io: Pointer to MC portal's I/O object | |
672 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
673 | * @token: Token of DPRC object | |
674 | * @container_id: ID of the child container | |
675 | * @res_req: Describes the type and amount of resources to | |
676 | * assign to the given container | |
677 | * | |
678 | * Assignment is usually done by a parent (this DPRC) to one of its child | |
679 | * containers. | |
680 | * | |
681 | * According to the DPRC allocation policy, the assigned resources may be taken | |
682 | * (allocated) from the container's ancestors, if not enough resources are | |
683 | * available in the container itself. | |
684 | * | |
685 | * The type of assignment depends on the dprc_res_req options, as follows: | |
686 | * - DPRC_RES_REQ_OPT_EXPLICIT: indicates that assigned resources should have | |
687 | * the explicit base ID specified at the id_base_align field of res_req. | |
688 | * - DPRC_RES_REQ_OPT_ALIGNED: indicates that the assigned resources should be | |
689 | * aligned to the value given at id_base_align field of res_req. | |
690 | * - DPRC_RES_REQ_OPT_PLUGGED: Relevant only for object assignment, | |
691 | * and indicates that the object must be set to the plugged state. | |
692 | * | |
693 | * A container may use this function with its own ID in order to change a | |
694 | * object state to plugged or unplugged. | |
695 | * | |
696 | * If IRQ information has been set in the child DPRC, it will signal an | |
697 | * interrupt following every change in its object assignment. | |
698 | * | |
699 | * Return: '0' on Success; Error code otherwise. | |
700 | */ | |
31c88965 | 701 | int dprc_assign(struct fsl_mc_io *mc_io, |
ba72f25b GR |
702 | u32 cmd_flags, |
703 | u16 token, | |
31c88965 GR |
704 | int container_id, |
705 | struct dprc_res_req *res_req) | |
706 | { | |
707 | struct mc_command cmd = { 0 }; | |
9989b599 | 708 | struct dprc_cmd_assign *cmd_params; |
31c88965 GR |
709 | |
710 | /* prepare command */ | |
711 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_ASSIGN, | |
1ee695fa | 712 | cmd_flags, token); |
9989b599 IR |
713 | cmd_params = (struct dprc_cmd_assign *)cmd.params; |
714 | cmd_params->container_id = cpu_to_le32(container_id); | |
715 | cmd_params->options = cpu_to_le32(res_req->options); | |
716 | cmd_params->num = cpu_to_le32(res_req->num); | |
717 | cmd_params->id_base_align = cpu_to_le32(res_req->id_base_align); | |
718 | strncpy(cmd_params->type, res_req->type, 16); | |
719 | cmd_params->type[15] = '\0'; | |
31c88965 GR |
720 | |
721 | /* send command to mc*/ | |
722 | return mc_send_command(mc_io, &cmd); | |
723 | } | |
724 | ||
e9bf3f20 GR |
725 | /** |
726 | * dprc_unassign() - Un-assigns objects or resources from a child container | |
727 | * and moves them into this (parent) DPRC. | |
728 | * @mc_io: Pointer to MC portal's I/O object | |
729 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
730 | * @token: Token of DPRC object | |
731 | * @child_container_id: ID of the child container | |
732 | * @res_req: Describes the type and amount of resources to un-assign from | |
733 | * the child container | |
734 | * | |
735 | * Un-assignment of objects can succeed only if the object is not in the | |
736 | * plugged or opened state. | |
737 | * | |
738 | * Return: '0' on Success; Error code otherwise. | |
739 | */ | |
31c88965 | 740 | int dprc_unassign(struct fsl_mc_io *mc_io, |
ba72f25b GR |
741 | u32 cmd_flags, |
742 | u16 token, | |
31c88965 GR |
743 | int child_container_id, |
744 | struct dprc_res_req *res_req) | |
745 | { | |
746 | struct mc_command cmd = { 0 }; | |
9989b599 | 747 | struct dprc_cmd_unassign *cmd_params; |
31c88965 GR |
748 | |
749 | /* prepare command */ | |
750 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_UNASSIGN, | |
1ee695fa | 751 | cmd_flags, |
31c88965 | 752 | token); |
9989b599 IR |
753 | cmd_params = (struct dprc_cmd_unassign *)cmd.params; |
754 | cmd_params->child_container_id = cpu_to_le32(child_container_id); | |
755 | cmd_params->options = cpu_to_le32(res_req->options); | |
756 | cmd_params->num = cpu_to_le32(res_req->num); | |
757 | cmd_params->id_base_align = cpu_to_le32(res_req->id_base_align); | |
758 | strncpy(cmd_params->type, res_req->type, 16); | |
759 | cmd_params->type[15] = '\0'; | |
31c88965 GR |
760 | |
761 | /* send command to mc*/ | |
762 | return mc_send_command(mc_io, &cmd); | |
763 | } | |
764 | ||
e9bf3f20 GR |
765 | /** |
766 | * dprc_get_pool_count() - Get the number of dprc's pools | |
767 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
768 | * @mc_io: Pointer to MC portal's I/O object | |
769 | * @token: Token of DPRC object | |
770 | * @pool_count: Returned number of resource pools in the dprc | |
771 | * | |
772 | * Return: '0' on Success; Error code otherwise. | |
773 | */ | |
31c88965 | 774 | int dprc_get_pool_count(struct fsl_mc_io *mc_io, |
ba72f25b GR |
775 | u32 cmd_flags, |
776 | u16 token, | |
31c88965 GR |
777 | int *pool_count) |
778 | { | |
779 | struct mc_command cmd = { 0 }; | |
9989b599 | 780 | struct dprc_rsp_get_pool_count *rsp_params; |
31c88965 GR |
781 | int err; |
782 | ||
783 | /* prepare command */ | |
784 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL_COUNT, | |
1ee695fa | 785 | cmd_flags, token); |
31c88965 GR |
786 | |
787 | /* send command to mc*/ | |
788 | err = mc_send_command(mc_io, &cmd); | |
789 | if (err) | |
790 | return err; | |
791 | ||
792 | /* retrieve response parameters */ | |
9989b599 IR |
793 | rsp_params = (struct dprc_rsp_get_pool_count *)cmd.params; |
794 | *pool_count = le32_to_cpu(rsp_params->pool_count); | |
31c88965 GR |
795 | |
796 | return 0; | |
797 | } | |
798 | ||
e9bf3f20 GR |
799 | /** |
800 | * dprc_get_pool() - Get the type (string) of a certain dprc's pool | |
801 | * @mc_io: Pointer to MC portal's I/O object | |
802 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
803 | * @token: Token of DPRC object | |
804 | * @pool_index; Index of the pool to be queried (< pool_count) | |
805 | * @type: The type of the pool | |
806 | * | |
807 | * The pool types retrieved one by one by incrementing | |
808 | * pool_index up to (not including) the value of pool_count returned | |
809 | * from dprc_get_pool_count(). dprc_get_pool_count() must | |
810 | * be called prior to dprc_get_pool(). | |
811 | * | |
812 | * Return: '0' on Success; Error code otherwise. | |
813 | */ | |
31c88965 | 814 | int dprc_get_pool(struct fsl_mc_io *mc_io, |
ba72f25b GR |
815 | u32 cmd_flags, |
816 | u16 token, | |
31c88965 GR |
817 | int pool_index, |
818 | char *type) | |
819 | { | |
820 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
821 | struct dprc_cmd_get_pool *cmd_params; |
822 | struct dprc_rsp_get_pool *rsp_params; | |
31c88965 GR |
823 | int err; |
824 | ||
825 | /* prepare command */ | |
826 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_POOL, | |
1ee695fa | 827 | cmd_flags, |
31c88965 | 828 | token); |
9989b599 IR |
829 | cmd_params = (struct dprc_cmd_get_pool *)cmd.params; |
830 | cmd_params->pool_index = cpu_to_le32(pool_index); | |
31c88965 GR |
831 | |
832 | /* send command to mc*/ | |
833 | err = mc_send_command(mc_io, &cmd); | |
834 | if (err) | |
835 | return err; | |
836 | ||
837 | /* retrieve response parameters */ | |
9989b599 IR |
838 | rsp_params = (struct dprc_rsp_get_pool *)cmd.params; |
839 | strncpy(type, rsp_params->type, 16); | |
31c88965 GR |
840 | type[15] = '\0'; |
841 | ||
842 | return 0; | |
843 | } | |
844 | ||
e9bf3f20 GR |
845 | /** |
846 | * dprc_get_obj_count() - Obtains the number of objects in the DPRC | |
847 | * @mc_io: Pointer to MC portal's I/O object | |
848 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
849 | * @token: Token of DPRC object | |
850 | * @obj_count: Number of objects assigned to the DPRC | |
851 | * | |
852 | * Return: '0' on Success; Error code otherwise. | |
853 | */ | |
1ee695fa | 854 | int dprc_get_obj_count(struct fsl_mc_io *mc_io, |
ba72f25b GR |
855 | u32 cmd_flags, |
856 | u16 token, | |
1ee695fa | 857 | int *obj_count) |
31c88965 GR |
858 | { |
859 | struct mc_command cmd = { 0 }; | |
9989b599 | 860 | struct dprc_rsp_get_obj_count *rsp_params; |
31c88965 GR |
861 | int err; |
862 | ||
863 | /* prepare command */ | |
864 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_COUNT, | |
1ee695fa | 865 | cmd_flags, token); |
31c88965 GR |
866 | |
867 | /* send command to mc*/ | |
868 | err = mc_send_command(mc_io, &cmd); | |
869 | if (err) | |
870 | return err; | |
871 | ||
872 | /* retrieve response parameters */ | |
9989b599 IR |
873 | rsp_params = (struct dprc_rsp_get_obj_count *)cmd.params; |
874 | *obj_count = le32_to_cpu(rsp_params->obj_count); | |
31c88965 GR |
875 | |
876 | return 0; | |
877 | } | |
878 | EXPORT_SYMBOL(dprc_get_obj_count); | |
879 | ||
e9bf3f20 GR |
880 | /** |
881 | * dprc_get_obj() - Get general information on an object | |
882 | * @mc_io: Pointer to MC portal's I/O object | |
883 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
884 | * @token: Token of DPRC object | |
885 | * @obj_index: Index of the object to be queried (< obj_count) | |
886 | * @obj_desc: Returns the requested object descriptor | |
887 | * | |
888 | * The object descriptors are retrieved one by one by incrementing | |
889 | * obj_index up to (not including) the value of obj_count returned | |
890 | * from dprc_get_obj_count(). dprc_get_obj_count() must | |
891 | * be called prior to dprc_get_obj(). | |
892 | * | |
893 | * Return: '0' on Success; Error code otherwise. | |
894 | */ | |
31c88965 | 895 | int dprc_get_obj(struct fsl_mc_io *mc_io, |
ba72f25b GR |
896 | u32 cmd_flags, |
897 | u16 token, | |
31c88965 GR |
898 | int obj_index, |
899 | struct dprc_obj_desc *obj_desc) | |
900 | { | |
901 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
902 | struct dprc_cmd_get_obj *cmd_params; |
903 | struct dprc_rsp_get_obj *rsp_params; | |
31c88965 GR |
904 | int err; |
905 | ||
906 | /* prepare command */ | |
907 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ, | |
1ee695fa | 908 | cmd_flags, |
31c88965 | 909 | token); |
9989b599 IR |
910 | cmd_params = (struct dprc_cmd_get_obj *)cmd.params; |
911 | cmd_params->obj_index = cpu_to_le32(obj_index); | |
31c88965 GR |
912 | |
913 | /* send command to mc*/ | |
914 | err = mc_send_command(mc_io, &cmd); | |
915 | if (err) | |
916 | return err; | |
917 | ||
918 | /* retrieve response parameters */ | |
9989b599 IR |
919 | rsp_params = (struct dprc_rsp_get_obj *)cmd.params; |
920 | obj_desc->id = le32_to_cpu(rsp_params->id); | |
921 | obj_desc->vendor = le16_to_cpu(rsp_params->vendor); | |
922 | obj_desc->irq_count = rsp_params->irq_count; | |
923 | obj_desc->region_count = rsp_params->region_count; | |
924 | obj_desc->state = le32_to_cpu(rsp_params->state); | |
925 | obj_desc->ver_major = le16_to_cpu(rsp_params->version_major); | |
926 | obj_desc->ver_minor = le16_to_cpu(rsp_params->version_minor); | |
927 | obj_desc->flags = le16_to_cpu(rsp_params->flags); | |
928 | strncpy(obj_desc->type, rsp_params->type, 16); | |
31c88965 | 929 | obj_desc->type[15] = '\0'; |
9989b599 | 930 | strncpy(obj_desc->label, rsp_params->label, 16); |
1ee695fa | 931 | obj_desc->label[15] = '\0'; |
31c88965 GR |
932 | return 0; |
933 | } | |
934 | EXPORT_SYMBOL(dprc_get_obj); | |
935 | ||
e9bf3f20 GR |
936 | /** |
937 | * dprc_get_obj_desc() - Get object descriptor. | |
938 | * | |
939 | * @mc_io: Pointer to MC portal's I/O object | |
940 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
941 | * @token: Token of DPRC object | |
942 | * @obj_type: The type of the object to get its descriptor. | |
943 | * @obj_id: The id of the object to get its descriptor | |
944 | * @obj_desc: The returned descriptor to fill and return to the user | |
945 | * | |
946 | * Return: '0' on Success; Error code otherwise. | |
947 | * | |
948 | */ | |
1ee695fa | 949 | int dprc_get_obj_desc(struct fsl_mc_io *mc_io, |
ba72f25b GR |
950 | u32 cmd_flags, |
951 | u16 token, | |
1ee695fa GR |
952 | char *obj_type, |
953 | int obj_id, | |
954 | struct dprc_obj_desc *obj_desc) | |
955 | { | |
956 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
957 | struct dprc_cmd_get_obj_desc *cmd_params; |
958 | struct dprc_rsp_get_obj_desc *rsp_params; | |
1ee695fa GR |
959 | int err; |
960 | ||
961 | /* prepare command */ | |
962 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_DESC, | |
963 | cmd_flags, | |
964 | token); | |
9989b599 IR |
965 | cmd_params = (struct dprc_cmd_get_obj_desc *)cmd.params; |
966 | cmd_params->obj_id = cpu_to_le32(obj_id); | |
967 | strncpy(cmd_params->type, obj_type, 16); | |
968 | cmd_params->type[15] = '\0'; | |
1ee695fa GR |
969 | |
970 | /* send command to mc*/ | |
971 | err = mc_send_command(mc_io, &cmd); | |
972 | if (err) | |
973 | return err; | |
974 | ||
975 | /* retrieve response parameters */ | |
9989b599 IR |
976 | rsp_params = (struct dprc_rsp_get_obj_desc *)cmd.params; |
977 | obj_desc->id = le32_to_cpu(rsp_params->id); | |
978 | obj_desc->vendor = le16_to_cpu(rsp_params->vendor); | |
979 | obj_desc->irq_count = rsp_params->irq_count; | |
980 | obj_desc->region_count = rsp_params->region_count; | |
981 | obj_desc->state = le32_to_cpu(rsp_params->state); | |
982 | obj_desc->ver_major = le16_to_cpu(rsp_params->version_major); | |
983 | obj_desc->ver_minor = le16_to_cpu(rsp_params->version_minor); | |
984 | obj_desc->flags = le16_to_cpu(rsp_params->flags); | |
985 | strncpy(obj_desc->type, rsp_params->type, 16); | |
986 | obj_desc->type[15] = '\0'; | |
987 | strncpy(obj_desc->label, rsp_params->label, 16); | |
988 | obj_desc->label[15] = '\0'; | |
1ee695fa GR |
989 | |
990 | return 0; | |
991 | } | |
992 | EXPORT_SYMBOL(dprc_get_obj_desc); | |
993 | ||
e9bf3f20 GR |
994 | /** |
995 | * dprc_set_obj_irq() - Set IRQ information for object to trigger an interrupt. | |
996 | * @mc_io: Pointer to MC portal's I/O object | |
997 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
998 | * @token: Token of DPRC object | |
999 | * @obj_type: Type of the object to set its IRQ | |
1000 | * @obj_id: ID of the object to set its IRQ | |
1001 | * @irq_index: The interrupt index to configure | |
1002 | * @irq_cfg: IRQ configuration | |
1003 | * | |
1004 | * Return: '0' on Success; Error code otherwise. | |
1005 | */ | |
1ee695fa | 1006 | int dprc_set_obj_irq(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1007 | u32 cmd_flags, |
1008 | u16 token, | |
1ee695fa GR |
1009 | char *obj_type, |
1010 | int obj_id, | |
ba72f25b | 1011 | u8 irq_index, |
1ee695fa GR |
1012 | struct dprc_irq_cfg *irq_cfg) |
1013 | { | |
1014 | struct mc_command cmd = { 0 }; | |
9989b599 | 1015 | struct dprc_cmd_set_obj_irq *cmd_params; |
1ee695fa GR |
1016 | |
1017 | /* prepare command */ | |
1018 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_IRQ, | |
1019 | cmd_flags, | |
1020 | token); | |
9989b599 IR |
1021 | cmd_params = (struct dprc_cmd_set_obj_irq *)cmd.params; |
1022 | cmd_params->irq_val = cpu_to_le32(irq_cfg->val); | |
1023 | cmd_params->irq_index = irq_index; | |
1024 | cmd_params->irq_addr = cpu_to_le64(irq_cfg->paddr); | |
1025 | cmd_params->irq_num = cpu_to_le32(irq_cfg->irq_num); | |
1026 | cmd_params->obj_id = cpu_to_le32(obj_id); | |
1027 | strncpy(cmd_params->obj_type, obj_type, 16); | |
1028 | cmd_params->obj_type[15] = '\0'; | |
1ee695fa GR |
1029 | |
1030 | /* send command to mc*/ | |
1031 | return mc_send_command(mc_io, &cmd); | |
1032 | } | |
1033 | EXPORT_SYMBOL(dprc_set_obj_irq); | |
1034 | ||
e9bf3f20 GR |
1035 | /** |
1036 | * dprc_get_obj_irq() - Get IRQ information from object. | |
1037 | * @mc_io: Pointer to MC portal's I/O object | |
1038 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1039 | * @token: Token of DPRC object | |
1040 | * @obj_type: Type od the object to get its IRQ | |
1041 | * @obj_id: ID of the object to get its IRQ | |
1042 | * @irq_index: The interrupt index to configure | |
1043 | * @type: Interrupt type: 0 represents message interrupt | |
1044 | * type (both irq_addr and irq_val are valid) | |
1045 | * @irq_cfg: The returned IRQ attributes | |
1046 | * | |
1047 | * Return: '0' on Success; Error code otherwise. | |
1048 | */ | |
1ee695fa | 1049 | int dprc_get_obj_irq(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1050 | u32 cmd_flags, |
1051 | u16 token, | |
1ee695fa GR |
1052 | char *obj_type, |
1053 | int obj_id, | |
ba72f25b | 1054 | u8 irq_index, |
1ee695fa GR |
1055 | int *type, |
1056 | struct dprc_irq_cfg *irq_cfg) | |
1057 | { | |
1058 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
1059 | struct dprc_cmd_get_obj_irq *cmd_params; |
1060 | struct dprc_rsp_get_obj_irq *rsp_params; | |
1ee695fa GR |
1061 | int err; |
1062 | ||
1063 | /* prepare command */ | |
1064 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_IRQ, | |
1065 | cmd_flags, | |
1066 | token); | |
9989b599 IR |
1067 | cmd_params = (struct dprc_cmd_get_obj_irq *)cmd.params; |
1068 | cmd_params->obj_id = cpu_to_le32(obj_id); | |
1069 | cmd_params->irq_index = irq_index; | |
1070 | strncpy(cmd_params->obj_type, obj_type, 16); | |
1071 | cmd_params->obj_type[15] = '\0'; | |
1ee695fa GR |
1072 | |
1073 | /* send command to mc*/ | |
1074 | err = mc_send_command(mc_io, &cmd); | |
1075 | if (err) | |
1076 | return err; | |
1077 | ||
1078 | /* retrieve response parameters */ | |
9989b599 IR |
1079 | rsp_params = (struct dprc_rsp_get_obj_irq *)cmd.params; |
1080 | irq_cfg->val = le32_to_cpu(rsp_params->irq_val); | |
1081 | irq_cfg->paddr = le64_to_cpu(rsp_params->irq_addr); | |
1082 | irq_cfg->irq_num = le32_to_cpu(rsp_params->irq_num); | |
1083 | *type = le32_to_cpu(rsp_params->type); | |
1ee695fa GR |
1084 | |
1085 | return 0; | |
1086 | } | |
1087 | EXPORT_SYMBOL(dprc_get_obj_irq); | |
1088 | ||
e9bf3f20 GR |
1089 | /** |
1090 | * dprc_get_res_count() - Obtains the number of free resources that are assigned | |
1091 | * to this container, by pool type | |
1092 | * @mc_io: Pointer to MC portal's I/O object | |
1093 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1094 | * @token: Token of DPRC object | |
1095 | * @type: pool type | |
1096 | * @res_count: Returned number of free resources of the given | |
1097 | * resource type that are assigned to this DPRC | |
1098 | * | |
1099 | * Return: '0' on Success; Error code otherwise. | |
1100 | */ | |
31c88965 | 1101 | int dprc_get_res_count(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1102 | u32 cmd_flags, |
1103 | u16 token, | |
31c88965 GR |
1104 | char *type, |
1105 | int *res_count) | |
1106 | { | |
1107 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
1108 | struct dprc_cmd_get_res_count *cmd_params; |
1109 | struct dprc_rsp_get_res_count *rsp_params; | |
31c88965 GR |
1110 | int err; |
1111 | ||
31c88965 GR |
1112 | /* prepare command */ |
1113 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_COUNT, | |
1ee695fa | 1114 | cmd_flags, token); |
9989b599 IR |
1115 | cmd_params = (struct dprc_cmd_get_res_count *)cmd.params; |
1116 | strncpy(cmd_params->type, type, 16); | |
1117 | cmd_params->type[15] = '\0'; | |
31c88965 GR |
1118 | |
1119 | /* send command to mc*/ | |
1120 | err = mc_send_command(mc_io, &cmd); | |
1121 | if (err) | |
1122 | return err; | |
1123 | ||
1124 | /* retrieve response parameters */ | |
9989b599 IR |
1125 | rsp_params = (struct dprc_rsp_get_res_count *)cmd.params; |
1126 | *res_count = le32_to_cpu(rsp_params->res_count); | |
31c88965 GR |
1127 | |
1128 | return 0; | |
1129 | } | |
1130 | EXPORT_SYMBOL(dprc_get_res_count); | |
1131 | ||
e9bf3f20 GR |
1132 | /** |
1133 | * dprc_get_res_ids() - Obtains IDs of free resources in the container | |
1134 | * @mc_io: Pointer to MC portal's I/O object | |
1135 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1136 | * @token: Token of DPRC object | |
1137 | * @type: pool type | |
1138 | * @range_desc: range descriptor | |
1139 | * | |
1140 | * Return: '0' on Success; Error code otherwise. | |
1141 | */ | |
31c88965 | 1142 | int dprc_get_res_ids(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1143 | u32 cmd_flags, |
1144 | u16 token, | |
31c88965 GR |
1145 | char *type, |
1146 | struct dprc_res_ids_range_desc *range_desc) | |
1147 | { | |
1148 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
1149 | struct dprc_cmd_get_res_ids *cmd_params; |
1150 | struct dprc_rsp_get_res_ids *rsp_params; | |
31c88965 GR |
1151 | int err; |
1152 | ||
1153 | /* prepare command */ | |
1154 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_RES_IDS, | |
1ee695fa | 1155 | cmd_flags, token); |
9989b599 IR |
1156 | cmd_params = (struct dprc_cmd_get_res_ids *)cmd.params; |
1157 | cmd_params->iter_status = range_desc->iter_status; | |
1158 | cmd_params->base_id = cpu_to_le32(range_desc->base_id); | |
1159 | cmd_params->last_id = cpu_to_le32(range_desc->last_id); | |
1160 | strncpy(cmd_params->type, type, 16); | |
1161 | cmd_params->type[15] = '\0'; | |
31c88965 GR |
1162 | |
1163 | /* send command to mc*/ | |
1164 | err = mc_send_command(mc_io, &cmd); | |
1165 | if (err) | |
1166 | return err; | |
1167 | ||
1168 | /* retrieve response parameters */ | |
9989b599 IR |
1169 | rsp_params = (struct dprc_rsp_get_res_ids *)cmd.params; |
1170 | range_desc->iter_status = rsp_params->iter_status; | |
1171 | range_desc->base_id = le32_to_cpu(rsp_params->base_id); | |
1172 | range_desc->last_id = le32_to_cpu(rsp_params->last_id); | |
31c88965 GR |
1173 | |
1174 | return 0; | |
1175 | } | |
1176 | EXPORT_SYMBOL(dprc_get_res_ids); | |
1177 | ||
e9bf3f20 GR |
1178 | /** |
1179 | * dprc_get_obj_region() - Get region information for a specified object. | |
1180 | * @mc_io: Pointer to MC portal's I/O object | |
1181 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1182 | * @token: Token of DPRC object | |
1183 | * @obj_type; Object type as returned in dprc_get_obj() | |
1184 | * @obj_id: Unique object instance as returned in dprc_get_obj() | |
1185 | * @region_index: The specific region to query | |
1186 | * @region_desc: Returns the requested region descriptor | |
1187 | * | |
1188 | * Return: '0' on Success; Error code otherwise. | |
1189 | */ | |
31c88965 | 1190 | int dprc_get_obj_region(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1191 | u32 cmd_flags, |
1192 | u16 token, | |
31c88965 GR |
1193 | char *obj_type, |
1194 | int obj_id, | |
ba72f25b | 1195 | u8 region_index, |
31c88965 GR |
1196 | struct dprc_region_desc *region_desc) |
1197 | { | |
1198 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
1199 | struct dprc_cmd_get_obj_region *cmd_params; |
1200 | struct dprc_rsp_get_obj_region *rsp_params; | |
31c88965 GR |
1201 | int err; |
1202 | ||
1203 | /* prepare command */ | |
1204 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_OBJ_REG, | |
1ee695fa | 1205 | cmd_flags, token); |
9989b599 IR |
1206 | cmd_params = (struct dprc_cmd_get_obj_region *)cmd.params; |
1207 | cmd_params->obj_id = cpu_to_le32(obj_id); | |
1208 | cmd_params->region_index = region_index; | |
1209 | strncpy(cmd_params->obj_type, obj_type, 16); | |
1210 | cmd_params->obj_type[15] = '\0'; | |
31c88965 GR |
1211 | |
1212 | /* send command to mc*/ | |
1213 | err = mc_send_command(mc_io, &cmd); | |
1214 | if (err) | |
1215 | return err; | |
1216 | ||
1217 | /* retrieve response parameters */ | |
9989b599 IR |
1218 | rsp_params = (struct dprc_rsp_get_obj_region *)cmd.params; |
1219 | region_desc->base_offset = le64_to_cpu(rsp_params->base_addr); | |
1220 | region_desc->size = le32_to_cpu(rsp_params->size); | |
31c88965 GR |
1221 | |
1222 | return 0; | |
1223 | } | |
1224 | EXPORT_SYMBOL(dprc_get_obj_region); | |
1225 | ||
e9bf3f20 GR |
1226 | /** |
1227 | * dprc_set_obj_label() - Set object label. | |
1228 | * @mc_io: Pointer to MC portal's I/O object | |
1229 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1230 | * @token: Token of DPRC object | |
1231 | * @obj_type: Object's type | |
1232 | * @obj_id: Object's ID | |
1233 | * @label: The required label. The maximum length is 16 chars. | |
1234 | * | |
1235 | * Return: '0' on Success; Error code otherwise. | |
1236 | */ | |
1ee695fa | 1237 | int dprc_set_obj_label(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1238 | u32 cmd_flags, |
1239 | u16 token, | |
1ee695fa GR |
1240 | char *obj_type, |
1241 | int obj_id, | |
1242 | char *label) | |
1243 | { | |
1244 | struct mc_command cmd = { 0 }; | |
9989b599 | 1245 | struct dprc_cmd_set_obj_label *cmd_params; |
1ee695fa GR |
1246 | |
1247 | /* prepare command */ | |
1248 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_SET_OBJ_LABEL, | |
1249 | cmd_flags, | |
1250 | token); | |
9989b599 IR |
1251 | cmd_params = (struct dprc_cmd_set_obj_label *)cmd.params; |
1252 | cmd_params->obj_id = cpu_to_le32(obj_id); | |
1253 | strncpy(cmd_params->label, label, 16); | |
1254 | cmd_params->label[15] = '\0'; | |
1255 | strncpy(cmd_params->obj_type, obj_type, 16); | |
1256 | cmd_params->obj_type[15] = '\0'; | |
1ee695fa GR |
1257 | |
1258 | /* send command to mc*/ | |
1259 | return mc_send_command(mc_io, &cmd); | |
1260 | } | |
1261 | EXPORT_SYMBOL(dprc_set_obj_label); | |
1262 | ||
e9bf3f20 GR |
1263 | /** |
1264 | * dprc_connect() - Connect two endpoints to create a network link between them | |
1265 | * @mc_io: Pointer to MC portal's I/O object | |
1266 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1267 | * @token: Token of DPRC object | |
1268 | * @endpoint1: Endpoint 1 configuration parameters | |
1269 | * @endpoint2: Endpoint 2 configuration parameters | |
1270 | * @cfg: Connection configuration. The connection configuration is ignored for | |
ac061998 SY |
1271 | * connections made to DPMAC objects, where rate is retrieved from the |
1272 | * MAC configuration. | |
e9bf3f20 GR |
1273 | * |
1274 | * Return: '0' on Success; Error code otherwise. | |
1275 | */ | |
31c88965 | 1276 | int dprc_connect(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1277 | u32 cmd_flags, |
1278 | u16 token, | |
31c88965 | 1279 | const struct dprc_endpoint *endpoint1, |
1ee695fa GR |
1280 | const struct dprc_endpoint *endpoint2, |
1281 | const struct dprc_connection_cfg *cfg) | |
31c88965 GR |
1282 | { |
1283 | struct mc_command cmd = { 0 }; | |
9989b599 | 1284 | struct dprc_cmd_connect *cmd_params; |
31c88965 GR |
1285 | |
1286 | /* prepare command */ | |
1287 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_CONNECT, | |
1ee695fa | 1288 | cmd_flags, |
31c88965 | 1289 | token); |
9989b599 IR |
1290 | cmd_params = (struct dprc_cmd_connect *)cmd.params; |
1291 | cmd_params->ep1_id = cpu_to_le32(endpoint1->id); | |
1292 | cmd_params->ep1_interface_id = cpu_to_le32(endpoint1->if_id); | |
1293 | cmd_params->ep2_id = cpu_to_le32(endpoint2->id); | |
1294 | cmd_params->ep2_interface_id = cpu_to_le32(endpoint2->if_id); | |
1295 | strncpy(cmd_params->ep1_type, endpoint1->type, 16); | |
1296 | cmd_params->ep1_type[15] = '\0'; | |
1297 | cmd_params->max_rate = cpu_to_le32(cfg->max_rate); | |
1298 | cmd_params->committed_rate = cpu_to_le32(cfg->committed_rate); | |
1299 | strncpy(cmd_params->ep2_type, endpoint2->type, 16); | |
1300 | cmd_params->ep2_type[15] = '\0'; | |
31c88965 GR |
1301 | |
1302 | /* send command to mc*/ | |
1303 | return mc_send_command(mc_io, &cmd); | |
1304 | } | |
1305 | ||
e9bf3f20 GR |
1306 | /** |
1307 | * dprc_disconnect() - Disconnect one endpoint to remove its network connection | |
1308 | * @mc_io: Pointer to MC portal's I/O object | |
1309 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1310 | * @token: Token of DPRC object | |
1311 | * @endpoint: Endpoint configuration parameters | |
1312 | * | |
1313 | * Return: '0' on Success; Error code otherwise. | |
1314 | */ | |
31c88965 | 1315 | int dprc_disconnect(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1316 | u32 cmd_flags, |
1317 | u16 token, | |
31c88965 GR |
1318 | const struct dprc_endpoint *endpoint) |
1319 | { | |
1320 | struct mc_command cmd = { 0 }; | |
9989b599 | 1321 | struct dprc_cmd_disconnect *cmd_params; |
31c88965 GR |
1322 | |
1323 | /* prepare command */ | |
1324 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_DISCONNECT, | |
1ee695fa | 1325 | cmd_flags, |
31c88965 | 1326 | token); |
9989b599 IR |
1327 | cmd_params = (struct dprc_cmd_disconnect *)cmd.params; |
1328 | cmd_params->id = cpu_to_le32(endpoint->id); | |
1329 | cmd_params->interface_id = cpu_to_le32(endpoint->if_id); | |
1330 | strncpy(cmd_params->type, endpoint->type, 16); | |
1331 | cmd_params->type[15] = '\0'; | |
31c88965 GR |
1332 | |
1333 | /* send command to mc*/ | |
1334 | return mc_send_command(mc_io, &cmd); | |
1335 | } | |
1336 | ||
e9bf3f20 GR |
1337 | /** |
1338 | * dprc_get_connection() - Get connected endpoint and link status if connection | |
1339 | * exists. | |
1340 | * @mc_io: Pointer to MC portal's I/O object | |
1341 | * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' | |
1342 | * @token: Token of DPRC object | |
1343 | * @endpoint1: Endpoint 1 configuration parameters | |
1344 | * @endpoint2: Returned endpoint 2 configuration parameters | |
ac061998 SY |
1345 | * @state: Returned link state: |
1346 | * 1 - link is up; | |
1347 | * 0 - link is down; | |
1348 | * -1 - no connection (endpoint2 information is irrelevant) | |
e9bf3f20 GR |
1349 | * |
1350 | * Return: '0' on Success; -ENAVAIL if connection does not exist. | |
1351 | */ | |
31c88965 | 1352 | int dprc_get_connection(struct fsl_mc_io *mc_io, |
ba72f25b GR |
1353 | u32 cmd_flags, |
1354 | u16 token, | |
1ee695fa GR |
1355 | const struct dprc_endpoint *endpoint1, |
1356 | struct dprc_endpoint *endpoint2, | |
1357 | int *state) | |
31c88965 GR |
1358 | { |
1359 | struct mc_command cmd = { 0 }; | |
9989b599 IR |
1360 | struct dprc_cmd_get_connection *cmd_params; |
1361 | struct dprc_rsp_get_connection *rsp_params; | |
31c88965 GR |
1362 | int err; |
1363 | ||
1364 | /* prepare command */ | |
1365 | cmd.header = mc_encode_cmd_header(DPRC_CMDID_GET_CONNECTION, | |
1ee695fa | 1366 | cmd_flags, |
31c88965 | 1367 | token); |
9989b599 IR |
1368 | cmd_params = (struct dprc_cmd_get_connection *)cmd.params; |
1369 | cmd_params->ep1_id = cpu_to_le32(endpoint1->id); | |
1370 | cmd_params->ep1_interface_id = cpu_to_le32(endpoint1->if_id); | |
1371 | strncpy(cmd_params->ep1_type, endpoint1->type, 16); | |
1372 | cmd_params->ep1_type[15] = '\0'; | |
31c88965 GR |
1373 | |
1374 | /* send command to mc*/ | |
1375 | err = mc_send_command(mc_io, &cmd); | |
1376 | if (err) | |
1377 | return err; | |
1378 | ||
1379 | /* retrieve response parameters */ | |
9989b599 IR |
1380 | rsp_params = (struct dprc_rsp_get_connection *)cmd.params; |
1381 | endpoint2->id = le32_to_cpu(rsp_params->ep2_id); | |
1382 | endpoint2->if_id = le32_to_cpu(rsp_params->ep2_interface_id); | |
1383 | strncpy(endpoint2->type, rsp_params->ep2_type, 16); | |
1384 | endpoint2->type[15] = '\0'; | |
1385 | *state = le32_to_cpu(rsp_params->state); | |
31c88965 GR |
1386 | |
1387 | return 0; | |
1388 | } |