1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *     SCMI Agent Support
9  */
10 
11 #ifndef MOD_SCMI_AGENT_H
12 #define MOD_SCMI_AGENT_H
13 
14 #include <fwk_id.h>
15 
16 #include <stdint.h>
17 
18 /*!
19  * \addtogroup GroupN1SDPModule N1SDP Product Modules
20  * \{
21  */
22 
23 /*!
24  * \defgroup GroupN1SDPScmiAgent SCMI Agent Support
25  * \{
26  */
27 
28 /*!
29  * \brief SCMI agent - Management protocol ID definition.
30  */
31 #define SCMI_PROTOCOL_ID_MANAGEMENT      UINT32_C(0x89)
32 /*!
33  * \brief SCMI agent - Management protocol version definition.
34  */
35 #define SCMI_PROTOCOL_VERSION_MANAGEMENT UINT32_C(0x10000)
36 
37 /*!
38  * \brief SCMI agent - Management protocol message IDs.
39  */
40 enum scmi_management_message_id {
41     /*! Message ID for getting protocol version */
42     SCMI_MANAGEMENT_PROTOCOL_VERSION_GET    = 0x0,
43     /*! Message ID for getting protocol attributes */
44     SCMI_MANAGEMENT_PROTOCOL_ATTRIBUTES_GET = 0x1,
45     /*! Message ID for getting message attributes */
46     SCMI_MANAGEMENT_MESSAGE_ATTRIBUTES_GET  = 0x2,
47     /*! Message ID for getting clock status */
48     SCMI_MANAGEMENT_CLOCK_STATUS_GET        = 0x3,
49     /*! Message ID for getting chip ID information */
50     SCMI_MANAGEMENT_CHIPID_INFO_GET         = 0x4,
51 };
52 
53 /*!
54  * \brief SCMI agent configuration data.
55  */
56 struct mod_scmi_agent_config {
57     /*!
58      * \brief Identifier of the transport entity.
59      */
60     fwk_id_t transport_id;
61 
62     /*!
63      * \brief Identifier of the API of the transport entity.
64      */
65     fwk_id_t transport_api_id;
66 };
67 
68 /*!
69  * \brief SCMI Management Agent API Interface
70  *
71  * \details Interface used for MCP System -> SCMI Agent.
72  */
73 struct mod_scmi_agent_api {
74     /*!
75      * \brief Get the management protocol version from SCP
76      *
77      * \param agent_id Agent identifier
78      * \param[out] version Protocol version.
79      *
80      * \retval ::FWK_SUCCESS The operation succeeded.
81      * \return One of the standard error codes for implementation-defined
82      *      errors.
83      */
84     int (*get_protocol_version)(fwk_id_t agent_id, uint32_t *version);
85 
86     /*!
87      * \brief Get the PLL clock status from SCP
88      *
89      * \param agent_id Agent identifier
90      * \param[out] clock_status SCP clock status.
91      *
92      * \retval ::FWK_SUCCESS The operation succeeded.
93      * \return One of the standard error codes for implementation-defined
94      *      errors.
95      */
96     int (*get_clock_status)(fwk_id_t agent_id, uint32_t *clock_status);
97 
98     /*!
99      * \brief Get the chip ID information from SCP
100      *
101      * \param agent_id Agent identifier
102      * \param[out] multichip_mode Multi-chip mode value.
103      * \param[out] chipid Chip ID value.
104      *
105      * \retval ::FWK_SUCCESS The operation succeeded.
106      * \return One of the standard error codes for implementation-defined
107      *      errors.
108      */
109     int (*get_chipid_info)(fwk_id_t agent_id, uint8_t *multichip_mode,
110                            uint8_t *chipid);
111 };
112 
113 /*!
114  * \brief API types exposed by SCMI agent module.
115  */
116 enum mod_scmi_agent_api_idx {
117     /*! API ID to be binded by system module */
118     MOD_SCMI_AGENT_API_IDX_SYSTEM,
119     /*! API ID count */
120     MOD_SCMI_AGENT_API_IDX_COUNT,
121 };
122 
123 /*!
124  * \}
125  */
126 
127 /*!
128  * \}
129  */
130 
131 #endif /* MOD_SCMI_AGENT_H */
132