xref: /rk3399_rockchip-uboot/include/fsl-mc/fsl_dpmng.h (revision 7b3bd9a7988a8b4c8ba22a52b4927e8e59819b12)
1*7b3bd9a7SJ. German Rivera /* Copyright 2014 Freescale Semiconductor Inc.
2*7b3bd9a7SJ. German Rivera  *
3*7b3bd9a7SJ. German Rivera  * SPDX-License-Identifier:	GPL-2.0+
4*7b3bd9a7SJ. German Rivera  */
5*7b3bd9a7SJ. German Rivera /*!
6*7b3bd9a7SJ. German Rivera  *  @file    fsl_dpmng.h
7*7b3bd9a7SJ. German Rivera  *  @brief   Management Complex General API
8*7b3bd9a7SJ. German Rivera  */
9*7b3bd9a7SJ. German Rivera 
10*7b3bd9a7SJ. German Rivera #ifndef __FSL_DPMNG_H
11*7b3bd9a7SJ. German Rivera #define __FSL_DPMNG_H
12*7b3bd9a7SJ. German Rivera 
13*7b3bd9a7SJ. German Rivera /*!
14*7b3bd9a7SJ. German Rivera  * @Group grp_dpmng	Management Complex General API
15*7b3bd9a7SJ. German Rivera  *
16*7b3bd9a7SJ. German Rivera  * @brief	Contains general API for the Management Complex firmware
17*7b3bd9a7SJ. German Rivera  * @{
18*7b3bd9a7SJ. German Rivera  */
19*7b3bd9a7SJ. German Rivera 
20*7b3bd9a7SJ. German Rivera struct fsl_mc_io;
21*7b3bd9a7SJ. German Rivera 
22*7b3bd9a7SJ. German Rivera /**
23*7b3bd9a7SJ. German Rivera  * @brief	Management Complex firmware version information
24*7b3bd9a7SJ. German Rivera  */
25*7b3bd9a7SJ. German Rivera #define MC_VER_MAJOR 4
26*7b3bd9a7SJ. German Rivera #define MC_VER_MINOR 0
27*7b3bd9a7SJ. German Rivera 
28*7b3bd9a7SJ. German Rivera struct mc_version {
29*7b3bd9a7SJ. German Rivera 	uint32_t major;
30*7b3bd9a7SJ. German Rivera 	/*!< Major version number: incremented on API compatibility changes */
31*7b3bd9a7SJ. German Rivera 	uint32_t minor;
32*7b3bd9a7SJ. German Rivera 	/*!< Minor version number: incremented on API additions (that are
33*7b3bd9a7SJ. German Rivera 	 * backward compatible); reset when major version is incremented
34*7b3bd9a7SJ. German Rivera 	 */
35*7b3bd9a7SJ. German Rivera 	uint32_t revision;
36*7b3bd9a7SJ. German Rivera 	/*!< Internal revision number: incremented on implementation changes
37*7b3bd9a7SJ. German Rivera 	 * and/or bug fixes that have no impact on API
38*7b3bd9a7SJ. German Rivera 	 */
39*7b3bd9a7SJ. German Rivera };
40*7b3bd9a7SJ. German Rivera 
41*7b3bd9a7SJ. German Rivera /**
42*7b3bd9a7SJ. German Rivera  * @brief	Retrieves the Management Complex firmware version information
43*7b3bd9a7SJ. German Rivera  *
44*7b3bd9a7SJ. German Rivera  * @param[in]	mc_io		Pointer to opaque I/O object
45*7b3bd9a7SJ. German Rivera  * @param[out]	mc_ver_info	Pointer to version information structure
46*7b3bd9a7SJ. German Rivera  *
47*7b3bd9a7SJ. German Rivera  * @returns	'0' on Success; Error code otherwise.
48*7b3bd9a7SJ. German Rivera  */
49*7b3bd9a7SJ. German Rivera int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info);
50*7b3bd9a7SJ. German Rivera 
51*7b3bd9a7SJ. German Rivera /**
52*7b3bd9a7SJ. German Rivera  * @brief	Resets an AIOP tile
53*7b3bd9a7SJ. German Rivera  *
54*7b3bd9a7SJ. German Rivera  * @param[in]	mc_io		Pointer to opaque I/O object
55*7b3bd9a7SJ. German Rivera  * @param[in]	container_id	AIOP container ID
56*7b3bd9a7SJ. German Rivera  * @param[in]	aiop_tile_id	AIOP tile ID to reset
57*7b3bd9a7SJ. German Rivera  *
58*7b3bd9a7SJ. German Rivera  * @returns	'0' on Success; Error code otherwise.
59*7b3bd9a7SJ. German Rivera  */
60*7b3bd9a7SJ. German Rivera int dpmng_reset_aiop(struct fsl_mc_io	*mc_io,
61*7b3bd9a7SJ. German Rivera 		     int		container_id,
62*7b3bd9a7SJ. German Rivera 		     int		aiop_tile_id);
63*7b3bd9a7SJ. German Rivera 
64*7b3bd9a7SJ. German Rivera /**
65*7b3bd9a7SJ. German Rivera  * @brief	Loads an image to AIOP tile
66*7b3bd9a7SJ. German Rivera  *
67*7b3bd9a7SJ. German Rivera  * @param[in]	mc_io		Pointer to opaque I/O object
68*7b3bd9a7SJ. German Rivera  * @param[in]	container_id	AIOP container ID
69*7b3bd9a7SJ. German Rivera  * @param[in]	aiop_tile_id	AIOP tile ID to reset
70*7b3bd9a7SJ. German Rivera  * @param[in]	img_iova	I/O virtual address of AIOP ELF image
71*7b3bd9a7SJ. German Rivera  * @param[in]	img_size	Size of AIOP ELF image in memory (in bytes)
72*7b3bd9a7SJ. German Rivera  *
73*7b3bd9a7SJ. German Rivera  * @returns	'0' on Success; Error code otherwise.
74*7b3bd9a7SJ. German Rivera  */
75*7b3bd9a7SJ. German Rivera int dpmng_load_aiop(struct fsl_mc_io	*mc_io,
76*7b3bd9a7SJ. German Rivera 		    int			container_id,
77*7b3bd9a7SJ. German Rivera 		    int			aiop_tile_id,
78*7b3bd9a7SJ. German Rivera 		    uint64_t		img_iova,
79*7b3bd9a7SJ. German Rivera 		    uint32_t		img_size);
80*7b3bd9a7SJ. German Rivera 
81*7b3bd9a7SJ. German Rivera /**
82*7b3bd9a7SJ. German Rivera  * @brief	AIOP run configuration
83*7b3bd9a7SJ. German Rivera  */
84*7b3bd9a7SJ. German Rivera struct dpmng_aiop_run_cfg {
85*7b3bd9a7SJ. German Rivera 	uint32_t cores_mask;
86*7b3bd9a7SJ. German Rivera 	/*!< Mask of AIOP cores to run (core 0 in most significant bit) */
87*7b3bd9a7SJ. German Rivera 	uint64_t options;
88*7b3bd9a7SJ. German Rivera 	/*!< Execution options (currently none defined) */
89*7b3bd9a7SJ. German Rivera };
90*7b3bd9a7SJ. German Rivera 
91*7b3bd9a7SJ. German Rivera /**
92*7b3bd9a7SJ. German Rivera  * @brief	Starts AIOP tile execution
93*7b3bd9a7SJ. German Rivera  *
94*7b3bd9a7SJ. German Rivera  * @param[in]	mc_io		Pointer to MC portal's I/O object
95*7b3bd9a7SJ. German Rivera  * @param[in]	container_id	AIOP container ID
96*7b3bd9a7SJ. German Rivera  * @param[in]	aiop_tile_id	AIOP tile ID to reset
97*7b3bd9a7SJ. German Rivera  * @param[in]	cfg		AIOP run configuration
98*7b3bd9a7SJ. German Rivera  *
99*7b3bd9a7SJ. German Rivera  * @returns	'0' on Success; Error code otherwise.
100*7b3bd9a7SJ. German Rivera  */
101*7b3bd9a7SJ. German Rivera int dpmng_run_aiop(struct fsl_mc_io			*mc_io,
102*7b3bd9a7SJ. German Rivera 		   int					container_id,
103*7b3bd9a7SJ. German Rivera 		   int					aiop_tile_id,
104*7b3bd9a7SJ. German Rivera 		   const struct dpmng_aiop_run_cfg	*cfg);
105*7b3bd9a7SJ. German Rivera 
106*7b3bd9a7SJ. German Rivera /**
107*7b3bd9a7SJ. German Rivera  * @brief	Resets MC portal
108*7b3bd9a7SJ. German Rivera  *
109*7b3bd9a7SJ. German Rivera  * This function closes all object handles (tokens) that are currently
110*7b3bd9a7SJ. German Rivera  * open in the MC portal on which the command is submitted. This allows
111*7b3bd9a7SJ. German Rivera  * cleanup of stale handles that belong to non-functional user processes.
112*7b3bd9a7SJ. German Rivera  *
113*7b3bd9a7SJ. German Rivera  * @param[in]	mc_io	Pointer to MC portal's I/O object
114*7b3bd9a7SJ. German Rivera  *
115*7b3bd9a7SJ. German Rivera  * @returns	'0' on Success; Error code otherwise.
116*7b3bd9a7SJ. German Rivera  */
117*7b3bd9a7SJ. German Rivera int dpmng_reset_mc_portal(struct fsl_mc_io *mc_io);
118*7b3bd9a7SJ. German Rivera 
119*7b3bd9a7SJ. German Rivera /** @} */
120*7b3bd9a7SJ. German Rivera 
121*7b3bd9a7SJ. German Rivera #endif /* __FSL_DPMNG_H */
122