1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2020-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  * Description:
8  *     System Control and Management Interface (SCMI) support.
9  */
10 
11 #ifndef MOD_SCMI_STD_H
12 #define MOD_SCMI_STD_H
13 
14 /*!
15  * \addtogroup GroupModules Modules
16  * \{
17  */
18 
19 /*!
20  * \defgroup GroupSCMI System Control & Management Interface (SCMI)
21  * \{
22  */
23 
24 /*!
25  * \brief SCMI identifier of the platform.
26  */
27 #define MOD_SCMI_PLATFORM_ID 0
28 
29 /*!
30  * \brief Maximum value for an agent identifier. The limit is derived from the
31  *      the base protocol's "PROTOCOL_ATTRIBUTES" command. This command returns
32  *      a 32-bits "attributes" value which, in turn, contains an 8-bit field
33  *      giving the number of agents in the system.
34  */
35 #define MOD_SCMI_AGENT_ID_MAX 0xFF
36 
37 /*! Maximum value of an SCMI protocol identifier */
38 #define MOD_SCMI_PROTOCOL_ID_MAX 0xFF
39 
40 /*! Minimum Protocol ID reserved for vendor or platform-specific extensions */
41 #define MOD_SCMI_PLATFORM_PROTOCOL_ID_MIN 0x80
42 /*! Maximum Protocol ID reserved for vendor or platform-specific extensions */
43 #define MOD_SCMI_PLATFORM_PROTOCOL_ID_MAX MOD_SCMI_PROTOCOL_ID_MAX
44 
45 /*!
46  * \brief SCMI error codes.
47  */
48 enum scmi_error {
49     SCMI_SUCCESS = 0,
50     SCMI_NOT_SUPPORTED = -1,
51     SCMI_INVALID_PARAMETERS = -2,
52     SCMI_DENIED = -3,
53     SCMI_NOT_FOUND = -4,
54     SCMI_OUT_OF_RANGE = -5,
55     SCMI_BUSY = -6,
56     SCMI_COMMS_ERROR = -7,
57     SCMI_GENERIC_ERROR = -8,
58     SCMI_HARDWARE_ERROR = -9,
59     SCMI_PROTOCOL_ERROR = -10,
60 };
61 
62 /*!
63  * \brief Common command identifiers.
64  */
65 enum scmi_command_id {
66     MOD_SCMI_PROTOCOL_VERSION = 0x000,
67     MOD_SCMI_PROTOCOL_ATTRIBUTES = 0x001,
68     MOD_SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x002
69 };
70 
71 /*!
72  * \brief Definitions of the SCMI Protocol Identifiers and the command
73  *      identifiers for each protocol.
74  */
75 
76 /*!
77  * \brief SCMI Base Protocol
78  */
79 #define MOD_SCMI_PROTOCOL_ID_BASE UINT32_C(0x10)
80 
81 /*!
82  * \brief SCMI Base Protocol Message IDs
83  */
84 enum scmi_base_command_id {
85     MOD_SCMI_BASE_DISCOVER_VENDOR = 0x003,
86     MOD_SCMI_BASE_DISCOVER_SUB_VENDOR = 0x004,
87     MOD_SCMI_BASE_DISCOVER_IMPLEMENTATION_VERSION = 0x005,
88     MOD_SCMI_BASE_DISCOVER_LIST_PROTOCOLS = 0x006,
89     MOD_SCMI_BASE_DISCOVER_AGENT = 0x007,
90     MOD_SCMI_BASE_NOTIFY_ERRORS = 0x008,
91     MOD_SCMI_BASE_SET_DEVICE_PERMISSIONS = 0x009,
92     MOD_SCMI_BASE_SET_PROTOCOL_PERMISSIONS = 0x00A,
93     MOD_SCMI_BASE_RESET_AGENT_CONFIG = 0x00B,
94     MOD_SCMI_BASE_COMMAND_COUNT,
95 };
96 
97 /*!
98  * \brief SCMI Power Domain Protocol
99  */
100 #define MOD_SCMI_PROTOCOL_ID_POWER_DOMAIN UINT32_C(0x11)
101 
102 /*!
103  * \brief SCMI Power Domain Protocol Message IDs
104  */
105 enum scmi_pd_command_id {
106     MOD_SCMI_PD_POWER_DOMAIN_ATTRIBUTES = 0x03,
107     MOD_SCMI_PD_POWER_STATE_SET = 0x04,
108     MOD_SCMI_PD_POWER_STATE_GET = 0x05,
109     MOD_SCMI_PD_POWER_STATE_NOTIFY = 0x06,
110     MOD_SCMI_PD_POWER_STATE_CHANGE_REQUESTED_NOTIFY = 0x07,
111     MOD_SCMI_PD_POWER_COMMAND_COUNT,
112 };
113 
114 /*!
115  * \brief SCMI System Power Protocol
116  */
117 #define MOD_SCMI_PROTOCOL_ID_SYS_POWER UINT32_C(0x12)
118 
119 /*!
120  * \brief SCMI System Power Protocol Message IDs
121  */
122 enum scmi_sys_power_command_id {
123     MOD_SCMI_SYS_POWER_STATE_SET = 0x003,
124     MOD_SCMI_SYS_POWER_STATE_GET = 0x004,
125     MOD_SCMI_SYS_POWER_STATE_NOTIFY = 0x005,
126     MOD_SCMI_SYS_POWER_COMMAND_COUNT,
127 };
128 
129 /*!
130  * \brief SCMI Performance Protocol
131  */
132 #define MOD_SCMI_PROTOCOL_ID_PERF UINT32_C(0x13)
133 
134 /*!
135  * \brief SCMI Performance Protocol Message IDs
136  */
137 enum scmi_perf_command_id {
138     MOD_SCMI_PERF_DOMAIN_ATTRIBUTES = 0x003,
139     MOD_SCMI_PERF_DESCRIBE_LEVELS = 0x004,
140     MOD_SCMI_PERF_LIMITS_SET = 0x005,
141     MOD_SCMI_PERF_LIMITS_GET = 0x006,
142     MOD_SCMI_PERF_LEVEL_SET = 0x007,
143     MOD_SCMI_PERF_LEVEL_GET = 0x008,
144     MOD_SCMI_PERF_NOTIFY_LIMITS = 0x009,
145     MOD_SCMI_PERF_NOTIFY_LEVEL = 0x00A,
146     MOD_SCMI_PERF_DESCRIBE_FAST_CHANNEL = 0x00B,
147     MOD_SCMI_PERF_COMMAND_COUNT,
148 };
149 
150 /*!
151  * \brief SCMI Clock Protocol
152  */
153 #define MOD_SCMI_PROTOCOL_ID_CLOCK UINT32_C(0x14)
154 
155 /*!
156  * \brief SCMI Clock Protocol Message IDs
157  */
158 enum scmi_clock_command_id {
159     MOD_SCMI_CLOCK_ATTRIBUTES = 0x003,
160     MOD_SCMI_CLOCK_DESCRIBE_RATES = 0x004,
161     MOD_SCMI_CLOCK_RATE_SET = 0x005,
162     MOD_SCMI_CLOCK_RATE_GET = 0x006,
163     MOD_SCMI_CLOCK_CONFIG_SET = 0x007,
164     MOD_SCMI_CLOCK_COMMAND_COUNT,
165 };
166 
167 /*!
168  * \brief SCMI Sensor Protocol
169  */
170 #define MOD_SCMI_PROTOCOL_ID_SENSOR UINT32_C(0x15)
171 
172 /*!
173  * \brief SCMI Sensor Protocol Message IDs
174  */
175 enum scmi_sensor_command_id {
176     MOD_SCMI_SENSOR_DESCRIPTION_GET = 0x003,
177     MOD_SCMI_SENSOR_TRIP_POINT_NOTIFY = 0x004,
178     MOD_SCMI_SENSOR_TRIP_POINT_CONFIG = 0x005,
179     MOD_SCMI_SENSOR_READING_GET = 0x006,
180 #ifdef BUILD_HAS_SCMI_SENSOR_V2
181     MOD_SCMI_SENSOR_AXIS_DESCRIPTION_GET = 0x007,
182 #endif
183     MOD_SCMI_SENSOR_COMMAND_COUNT,
184 };
185 
186 /*!
187  * \brief SCMI Reset Domain Protocol
188  */
189 #define MOD_SCMI_PROTOCOL_ID_RESET_DOMAIN UINT32_C(0x16)
190 
191 /*!
192  * \brief SCMI Reset Domain Management Protocol Message IDs
193  */
194 enum scmi_reset_domain_command_id {
195     MOD_SCMI_RESET_DOMAIN_ATTRIBUTES = 0x03,
196     MOD_SCMI_RESET_REQUEST = 0x04,
197     MOD_SCMI_RESET_NOTIFY = 0x05,
198     MOD_SCMI_RESET_COMMAND_COUNT,
199 };
200 
201 /*!
202  * \brief SCMI Reset Domain Management Protocol Response IDs.
203  */
204 enum scmi_reset_domain_response_id {
205     MOD_SCMI_RESET_ISSUED = 0x00,
206     MOD_SCMI_RESET_COMPLETE = 0x04,
207 };
208 
209 /*!
210  * \brief SCMI Voltage Domain Protocol
211  */
212 #define MOD_SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN UINT32_C(0x17)
213 
214 /*!
215  * \brief SCMI Voltage Domain Protocol Message IDs
216  */
217 enum scmi_voltd_command_id {
218     MOD_SCMI_VOLTD_DOMAIN_ATTRIBUTES = 0x003,
219     MOD_SCMI_VOLTD_DESCRIBE_LEVELS = 0x004,
220     MOD_SCMI_VOLTD_CONFIG_SET = 0x005,
221     MOD_SCMI_VOLTD_CONFIG_GET = 0x006,
222     MOD_SCMI_VOLTD_LEVEL_SET = 0x007,
223     MOD_SCMI_VOLTD_LEVEL_GET = 0x008,
224     MOD_SCMI_VOLTD_COMMAND_COUNT,
225 };
226 
227 /*!
228  * \}
229  */
230 
231 /*!
232  * \}
233  */
234 
235 #endif /* MOD_SCMI_STD_H */
236