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