1
2
3
4
5#include <fsl-mc/fsl_mc_sys.h>
6#include <fsl-mc/fsl_mc_cmd.h>
7#include <fsl-mc/fsl_dpmng.h>
8#include "fsl_dpmng_cmd.h"
9
10int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
11{
12 struct mc_command cmd = { 0 };
13 int err;
14
15
16 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
17 MC_CMD_PRI_LOW, 0);
18
19
20 err = mc_send_command(mc_io, &cmd);
21 if (err)
22 return err;
23
24
25 DPMNG_RSP_GET_VERSION(cmd, mc_ver_info);
26
27 return 0;
28}
29
30int dpmng_reset_aiop(struct fsl_mc_io *mc_io, int container_id,
31 int aiop_tile_id)
32{
33 struct mc_command cmd = { 0 };
34
35
36 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_RESET_AIOP,
37 MC_CMD_PRI_LOW, 0);
38 DPMNG_CMD_RESET_AIOP(cmd, container_id, aiop_tile_id);
39
40
41 return mc_send_command(mc_io, &cmd);
42}
43
44int dpmng_load_aiop(struct fsl_mc_io *mc_io,
45 int container_id,
46 int aiop_tile_id,
47 uint64_t img_iova,
48 uint32_t img_size)
49{
50 struct mc_command cmd = { 0 };
51
52
53 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_LOAD_AIOP,
54 MC_CMD_PRI_LOW,
55 0);
56 DPMNG_CMD_LOAD_AIOP(cmd, container_id, aiop_tile_id, img_size,
57 img_iova);
58
59
60 return mc_send_command(mc_io, &cmd);
61}
62
63int dpmng_run_aiop(struct fsl_mc_io *mc_io,
64 int container_id,
65 int aiop_tile_id,
66 const struct dpmng_aiop_run_cfg *cfg)
67{
68 struct mc_command cmd = { 0 };
69
70
71 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_RUN_AIOP,
72 MC_CMD_PRI_LOW,
73 0);
74 DPMNG_CMD_RUN_AIOP(cmd, container_id, aiop_tile_id, cfg);
75
76
77 return mc_send_command(mc_io, &cmd);
78}
79
80int dpmng_reset_mc_portal(struct fsl_mc_io *mc_io)
81{
82 struct mc_command cmd = { 0 };
83
84
85 cmd.header = mc_encode_cmd_header(DPMNG_CMDID_RESET_MC_PORTAL,
86 MC_CMD_PRI_LOW,
87 0);
88
89
90 return mc_send_command(mc_io, &cmd);
91}
92