]> git.ipfire.org Git - thirdparty/u-boot.git/blob - include/scmi_protocols.h
firmware: scmi: implement SCMI base protocol
[thirdparty/u-boot.git] / include / scmi_protocols.h
1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /*
3 * Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved.
4 * Copyright (C) 2019-2020, Linaro Limited
5 */
6 #ifndef _SCMI_PROTOCOLS_H
7 #define _SCMI_PROTOCOLS_H
8
9 #include <linux/bitops.h>
10 #include <asm/types.h>
11
12 /*
13 * Subset the SCMI protocols definition
14 * based on SCMI specification v2.0 (DEN0056B)
15 * https://developer.arm.com/docs/den0056/b
16 */
17
18 enum scmi_std_protocol {
19 SCMI_PROTOCOL_ID_BASE = 0x10,
20 SCMI_PROTOCOL_ID_POWER_DOMAIN = 0x11,
21 SCMI_PROTOCOL_ID_SYSTEM = 0x12,
22 SCMI_PROTOCOL_ID_PERF = 0x13,
23 SCMI_PROTOCOL_ID_CLOCK = 0x14,
24 SCMI_PROTOCOL_ID_SENSOR = 0x15,
25 SCMI_PROTOCOL_ID_RESET_DOMAIN = 0x16,
26 SCMI_PROTOCOL_ID_VOLTAGE_DOMAIN = 0x17,
27 };
28
29 enum scmi_status_code {
30 SCMI_SUCCESS = 0,
31 SCMI_NOT_SUPPORTED = -1,
32 SCMI_INVALID_PARAMETERS = -2,
33 SCMI_DENIED = -3,
34 SCMI_NOT_FOUND = -4,
35 SCMI_OUT_OF_RANGE = -5,
36 SCMI_BUSY = -6,
37 SCMI_COMMS_ERROR = -7,
38 SCMI_GENERIC_ERROR = -8,
39 SCMI_HARDWARE_ERROR = -9,
40 SCMI_PROTOCOL_ERROR = -10,
41 };
42
43 /*
44 * Generic message IDs
45 */
46 enum scmi_discovery_id {
47 SCMI_PROTOCOL_VERSION = 0x0,
48 SCMI_PROTOCOL_ATTRIBUTES = 0x1,
49 SCMI_PROTOCOL_MESSAGE_ATTRIBUTES = 0x2,
50 };
51
52 /*
53 * SCMI Base Protocol
54 */
55 #define SCMI_BASE_PROTOCOL_VERSION 0x20000
56
57 enum scmi_base_message_id {
58 SCMI_BASE_DISCOVER_VENDOR = 0x3,
59 SCMI_BASE_DISCOVER_SUB_VENDOR = 0x4,
60 SCMI_BASE_DISCOVER_IMPL_VERSION = 0x5,
61 SCMI_BASE_DISCOVER_LIST_PROTOCOLS = 0x6,
62 SCMI_BASE_DISCOVER_AGENT = 0x7,
63 SCMI_BASE_NOTIFY_ERRORS = 0x8,
64 SCMI_BASE_SET_DEVICE_PERMISSIONS = 0x9,
65 SCMI_BASE_SET_PROTOCOL_PERMISSIONS = 0xa,
66 SCMI_BASE_RESET_AGENT_CONFIGURATION = 0xb,
67 };
68
69 #define SCMI_BASE_NAME_LENGTH_MAX 16
70
71 /**
72 * struct scmi_protocol_version_out - Response for SCMI_PROTOCOL_VERSION
73 * command
74 * @status: SCMI command status
75 * @version: Protocol version
76 */
77 struct scmi_protocol_version_out {
78 s32 status;
79 u32 version;
80 };
81
82 /**
83 * struct scmi_protocol_attrs_out - Response for SCMI_PROTOCOL_ATTRIBUTES
84 * command
85 * @status: SCMI command status
86 * @attributes: Protocol attributes or implementation details
87 */
88 struct scmi_protocol_attrs_out {
89 s32 status;
90 u32 attributes;
91 };
92
93 #define SCMI_PROTOCOL_ATTRS_NUM_AGENTS(attributes) \
94 (((attributes) & GENMASK(15, 8)) >> 8)
95 #define SCMI_PROTOCOL_ATTRS_NUM_PROTOCOLS(attributes) \
96 ((attributes) & GENMASK(7, 0))
97
98 /**
99 * struct scmi_protocol_msg_attrs_out - Response for
100 * SCMI_PROTOCOL_MESSAGE_ATTRIBUTES command
101 * @status: SCMI command status
102 * @attributes: Message-specific attributes
103 */
104 struct scmi_protocol_msg_attrs_out {
105 s32 status;
106 u32 attributes;
107 };
108
109 /**
110 * struct scmi_base_discover_vendor_out - Response for
111 * SCMI_BASE_DISCOVER_VENDOR or
112 * SCMI_BASE_DISCOVER_SUB_VENDOR command
113 * @status: SCMI command status
114 * @vendor_identifier: Name of vendor or sub-vendor in string
115 */
116 struct scmi_base_discover_vendor_out {
117 s32 status;
118 u8 vendor_identifier[SCMI_BASE_NAME_LENGTH_MAX];
119 };
120
121 /**
122 * struct scmi_base_discover_impl_version_out - Response for
123 * SCMI_BASE_DISCOVER_IMPL_VERSION command
124 * @status: SCMI command status
125 * @impl_version: Vendor-specific implementation version
126 */
127 struct scmi_base_discover_impl_version_out {
128 s32 status;
129 u32 impl_version;
130 };
131
132 /**
133 * struct scmi_base_discover_list_protocols_out - Response for
134 * SCMI_BASE_DISCOVER_LIST_PROTOCOLS command
135 * @status: SCMI command status
136 * @num_protocols: Number of SCMI protocols in @protocol
137 * @protocols: Array of packed SCMI protocol ID's
138 */
139 struct scmi_base_discover_list_protocols_out {
140 s32 status;
141 u32 num_protocols;
142 u32 protocols[3];
143 };
144
145 /**
146 * struct scmi_base_discover_agent_out - Response for
147 * SCMI_BASE_DISCOVER_AGENT command
148 * @status: SCMI command status
149 * @agent_id: SCMI agent ID
150 * @name: Name of agent in string
151 */
152 struct scmi_base_discover_agent_out {
153 s32 status;
154 u32 agent_id;
155 u8 name[SCMI_BASE_NAME_LENGTH_MAX];
156 };
157
158 #define SCMI_BASE_NOTIFY_ERRORS_ENABLE BIT(0)
159
160 /**
161 * struct scmi_base_set_device_permissions_in - Parameters for
162 * SCMI_BASE_SET_DEVICE_PERMISSIONS command
163 * @agent_id: SCMI agent ID
164 * @device_id: device ID
165 * @flags: A set of flags
166 */
167 struct scmi_base_set_device_permissions_in {
168 u32 agent_id;
169 u32 device_id;
170 u32 flags;
171 };
172
173 #define SCMI_BASE_SET_DEVICE_PERMISSIONS_ACCESS BIT(0)
174
175 /**
176 * struct scmi_base_set_protocol_permissions_in - Parameters for
177 * SCMI_BASE_SET_PROTOCOL_PERMISSIONS command
178 * @agent_id: SCMI agent ID
179 * @device_id: device ID
180 * @command_id: command ID
181 * @flags: A set of flags
182 */
183 struct scmi_base_set_protocol_permissions_in {
184 u32 agent_id;
185 u32 device_id;
186 u32 command_id;
187 u32 flags;
188 };
189
190 #define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_COMMAND GENMASK(7, 0)
191 #define SCMI_BASE_SET_PROTOCOL_PERMISSIONS_ACCESS BIT(0)
192
193 /**
194 * struct scmi_base_reset_agent_configuration_in - Parameters for
195 * SCMI_BASE_RESET_AGENT_CONFIGURATION command
196 * @agent_id: SCMI agent ID
197 * @flags: A set of flags
198 */
199 struct scmi_base_reset_agent_configuration_in {
200 u32 agent_id;
201 u32 flags;
202 };
203
204 #define SCMI_BASE_RESET_ALL_ACCESS_PERMISSIONS BIT(0)
205
206 /**
207 * struct scmi_base_ops - SCMI base protocol interfaces
208 */
209 struct scmi_base_ops {
210 /**
211 * protocol_version - get Base protocol version
212 * @dev: SCMI protocol device
213 * @version: Pointer to SCMI protocol version
214 *
215 * Obtain the protocol version number in @version for Base protocol.
216 *
217 * Return: 0 on success, error code on failure
218 */
219 int (*protocol_version)(struct udevice *dev, u32 *version);
220 /**
221 * protocol_attrs - get protocol attributes
222 * @dev: SCMI protocol device
223 * @num_agents: Number of SCMI agents
224 * @num_protocols: Number of SCMI protocols
225 *
226 * Obtain the protocol attributes, the number of agents and the number
227 * of protocols, in @num_agents and @num_protocols respectively, that
228 * the device provides.
229 *
230 * Return: 0 on success, error code on failure
231 */
232 int (*protocol_attrs)(struct udevice *dev, u32 *num_agents,
233 u32 *num_protocols);
234 /**
235 * protocol_message_attrs - get message-specific attributes
236 * @dev: SCMI protocol device
237 * @message_id: SCMI message ID
238 * @attributes: Message-specific attributes
239 *
240 * Obtain the message-specific attributes in @attributes.
241 * This command succeeds if the message is implemented and available.
242 *
243 * Return: 0 on success, error code on failure
244 */
245 int (*protocol_message_attrs)(struct udevice *dev, u32 message_id,
246 u32 *attributes);
247 /**
248 * base_discover_vendor - get vendor name
249 * @dev: SCMI protocol device
250 * @vendor: Pointer to vendor name
251 *
252 * Obtain the vendor's name in @vendor.
253 * It is a caller's responsibility to free @vendor.
254 *
255 * Return: 0 on success, error code on failure
256 */
257 int (*base_discover_vendor)(struct udevice *dev, u8 **vendor);
258 /**
259 * base_discover_sub_vendor - get sub-vendor name
260 * @dev: SCMI protocol device
261 * @sub_vendor: Pointer to sub-vendor name
262 *
263 * Obtain the sub-vendor's name in @sub_vendor.
264 * It is a caller's responsibility to free @sub_vendor.
265 *
266 * Return: 0 on success, error code on failure
267 */
268 int (*base_discover_sub_vendor)(struct udevice *dev, u8 **sub_vendor);
269 /**
270 * base_discover_impl_version - get implementation version
271 * @dev: SCMI protocol device
272 * @impl_version: Pointer to implementation version
273 *
274 * Obtain the implementation version number in @impl_version.
275 *
276 * Return: 0 on success, error code on failure
277 */
278 int (*base_discover_impl_version)(struct udevice *dev,
279 u32 *impl_version);
280 /**
281 * base_discover_list_protocols - get list of protocols
282 * @dev: SCMI protocol device
283 * @protocols: Pointer to array of SCMI protocols
284 *
285 * Obtain the list of protocols provided in @protocols.
286 * The number of elements in @protocols always match to the number of
287 * protocols returned by smci_protocol_attrs() when this function
288 * succeeds.
289 * It is a caller's responsibility to free @protocols.
290 *
291 * Return: the number of protocols in @protocols on success,
292 * error code on failure
293 */
294 int (*base_discover_list_protocols)(struct udevice *dev,
295 u8 **protocols);
296 /**
297 * base_discover_agent - identify agent
298 * @dev: SCMI protocol device
299 * @agent_id: SCMI agent ID
300 * @ret_agent_id: Pointer to SCMI agent ID
301 * @name: Pointer to SCMI agent name
302 *
303 * Obtain the agent's name in @name. If @agent_id is equal to
304 * 0xffffffff, * this function returns the caller's agent id in
305 * @ret_agent_id.
306 * It is a caller's responsibility to free @name.
307 *
308 * Return: 0 on success, error code on failure
309 */
310 int (*base_discover_agent)(struct udevice *dev, u32 agent_id,
311 u32 *ret_agent_id, u8 **name);
312 /**
313 * base_notify_errors - configure error notification
314 * @dev: SCMI protocol device
315 * @enable: Operation
316 *
317 * Enable or disable error notification from SCMI firmware.
318 *
319 * Return: 0 on success, error code on failure
320 */
321 int (*base_notify_errors)(struct udevice *dev, u32 enable);
322 /**
323 * base_set_device_permissions - configure access permission to device
324 * @dev: SCMI protocol device
325 * @agent_id: SCMI agent ID
326 * @device_id: ID of device to access
327 * @flags: A set of flags
328 *
329 * Ask for allowing or denying access permission to the device,
330 * @device_id. The meaning of @flags is defined in SCMI specification.
331 *
332 * Return: 0 on success, error code on failure
333 */
334 int (*base_set_device_permissions)(struct udevice *dev, u32 agent_id,
335 u32 device_id, u32 flags);
336 /**
337 * base_set_protocol_permissions - configure access permission to
338 * protocol on device
339 * @dev: SCMI protocol device
340 * @agent_id: SCMI agent ID
341 * @device_id: ID of device to access
342 * @command_id: command ID
343 * @flags: A set of flags
344 *
345 * Ask for allowing or denying access permission to the protocol,
346 * @command_id, on the device, @device_id.
347 * The meaning of @flags is defined in SCMI specification.
348 *
349 * Return: 0 on success, error code on failure
350 */
351 int (*base_set_protocol_permissions)(struct udevice *dev, u32 agent_id,
352 u32 device_id, u32 command_id,
353 u32 flags);
354 /**
355 * base_reset_agent_configuration - reset resource settings
356 * @dev: SCMI protocol device
357 * @agent_id: SCMI agent ID
358 * @flags: A set of flags
359 *
360 * Reset all the resource settings against @agent_id.
361 * The meaning of @flags is defined in SCMI specification.
362 *
363 * Return: 0 on success, error code on failure
364 */
365 int (*base_reset_agent_configuration)(struct udevice *dev, u32 agent_id,
366 u32 flags);
367 };
368
369 /**
370 * scmi_generic_protocol_version - get protocol version
371 * @dev: SCMI protocol device
372 * @id: SCMI protocol ID
373 * @version: Pointer to SCMI protocol version
374 *
375 * Obtain the protocol version number in @version.
376 *
377 * Return: 0 on success, error code on failure
378 */
379 int scmi_generic_protocol_version(struct udevice *dev,
380 enum scmi_std_protocol id, u32 *version);
381
382 /**
383 * scmi_base_protocol_version - get Base protocol version
384 * @dev: SCMI protocol device
385 * @version: Pointer to SCMI protocol version
386 *
387 * Obtain the protocol version number in @version for Base protocol.
388 *
389 * Return: 0 on success, error code on failure
390 */
391 int scmi_base_protocol_version(struct udevice *dev, u32 *version);
392
393 /**
394 * scmi_protocol_attrs - get protocol attributes
395 * @dev: SCMI protocol device
396 * @num_agents: Number of SCMI agents
397 * @num_protocols: Number of SCMI protocols
398 *
399 * Obtain the protocol attributes, the number of agents and the number
400 * of protocols, in @num_agents and @num_protocols respectively, that
401 * the device provides.
402 *
403 * Return: 0 on success, error code on failure
404 */
405 int scmi_base_protocol_attrs(struct udevice *dev, u32 *num_agents,
406 u32 *num_protocols);
407
408 /**
409 * scmi_protocol_message_attrs - get message-specific attributes
410 * @dev: SCMI protocol device
411 * @message_id: SCMI message ID
412 * @attributes: Message-specific attributes
413 *
414 * Obtain the message-specific attributes in @attributes.
415 * This command succeeds if the message is implemented and available.
416 *
417 * Return: 0 on success, error code on failure
418 */
419 int scmi_base_protocol_message_attrs(struct udevice *dev, u32 message_id,
420 u32 *attributes);
421
422 /**
423 * scmi_base_discover_vendor - get vendor name
424 * @dev: SCMI protocol device
425 * @vendor: Pointer to vendor name
426 *
427 * Obtain the vendor's name in @vendor.
428 * It is a caller's responsibility to free @vendor.
429 *
430 * Return: 0 on success, error code on failure
431 */
432 int scmi_base_discover_vendor(struct udevice *dev, u8 **vendor);
433
434 /**
435 * scmi_base_discover_sub_vendor - get sub-vendor name
436 * @dev: SCMI protocol device
437 * @sub_vendor: Pointer to sub-vendor name
438 *
439 * Obtain the sub-vendor's name in @sub_vendor.
440 * It is a caller's responsibility to free @sub_vendor.
441 *
442 * Return: 0 on success, error code on failure
443 */
444 int scmi_base_discover_sub_vendor(struct udevice *dev, u8 **sub_vendor);
445
446 /**
447 * scmi_base_discover_impl_version - get implementation version
448 * @dev: SCMI protocol device
449 * @impl_version: Pointer to implementation version
450 *
451 * Obtain the implementation version number in @impl_version.
452 *
453 * Return: 0 on success, error code on failure
454 */
455 int scmi_base_discover_impl_version(struct udevice *dev, u32 *impl_version);
456
457 /**
458 * scmi_base_discover_list_protocols - get list of protocols
459 * @dev: SCMI protocol device
460 * @protocols: Pointer to array of SCMI protocols
461 *
462 * Obtain the list of protocols provided in @protocols.
463 * The number of elements in @protocols always match to the number of
464 * protocols returned by smci_protocol_attrs() when this function succeeds.
465 * It is a caller's responsibility to free @protocols.
466 *
467 * Return: the number of protocols in @protocols on success, error code on
468 * failure
469 */
470 int scmi_base_discover_list_protocols(struct udevice *dev, u8 **protocols);
471
472 /**
473 * scmi_base_discover_agent - identify agent
474 * @dev: SCMI protocol device
475 * @agent_id: SCMI agent ID
476 * @ret_agent_id: Pointer to SCMI agent ID
477 * @name: Pointer to SCMI agent name
478 *
479 * Obtain the agent's name in @name. If @agent_id is equal to 0xffffffff,
480 * this function returns the caller's agent id in @ret_agent_id.
481 * It is a caller's responsibility to free @name.
482 *
483 * Return: 0 on success, error code on failure
484 */
485 int scmi_base_discover_agent(struct udevice *dev, u32 agent_id,
486 u32 *ret_agent_id, u8 **name);
487
488 /**
489 * scmi_base_notify_errors - configure error notification
490 * @dev: SCMI protocol device
491 * @enable: Operation
492 *
493 * Enable or disable error notification from SCMI firmware.
494 *
495 * Return: 0 on success, error code on failure
496 */
497 int scmi_base_notify_errors(struct udevice *dev, u32 enable);
498
499 /**
500 * scmi_base_set_device_permissions - configure access permission to device
501 * @dev: SCMI protocol device
502 * @agent_id: SCMI agent ID
503 * @device_id: ID of device to access
504 * @flags: A set of flags
505 *
506 * Ask for allowing or denying access permission to the device, @device_id.
507 * The meaning of @flags is defined in SCMI specification.
508 *
509 * Return: 0 on success, error code on failure
510 */
511 int scmi_base_set_device_permissions(struct udevice *dev, u32 agent_id,
512 u32 device_id, u32 flags);
513
514 /**
515 * scmi_base_set_protocol_permissions - configure access permission to
516 * protocol on device
517 * @dev: SCMI protocol device
518 * @agent_id: SCMI agent ID
519 * @device_id: ID of device to access
520 * @command_id: SCMI command ID
521 * @flags: A set of flags
522 *
523 * Ask for allowing or denying access permission to the protocol, @command_id,
524 * on the device, @device_id.
525 * The meaning of @flags is defined in SCMI specification.
526 *
527 * Return: 0 on success, error code on failure
528 */
529 int scmi_base_set_protocol_permissions(struct udevice *dev,
530 u32 agent_id, u32 device_id,
531 u32 command_id, u32 flags);
532
533 /**
534 * scmi_base_reset_agent_configuration - reset resource settings
535 * @dev: SCMI protocol device
536 * @agent_id: SCMI agent ID
537 * @flags: A set of flags
538 *
539 * Reset all the resource settings against @agent_id.
540 * The meaning of @flags is defined in SCMI specification.
541 *
542 * Return: 0 on success, error code on failure
543 */
544 int scmi_base_reset_agent_configuration(struct udevice *dev, u32 agent_id,
545 u32 flags);
546
547 /*
548 * SCMI Clock Protocol
549 */
550
551 enum scmi_clock_message_id {
552 SCMI_CLOCK_ATTRIBUTES = 0x3,
553 SCMI_CLOCK_RATE_SET = 0x5,
554 SCMI_CLOCK_RATE_GET = 0x6,
555 SCMI_CLOCK_CONFIG_SET = 0x7,
556 };
557
558 #define SCMI_CLK_PROTO_ATTR_COUNT_MASK GENMASK(15, 0)
559 #define SCMI_CLK_RATE_ASYNC_NOTIFY BIT(0)
560 #define SCMI_CLK_RATE_ASYNC_NORESP (BIT(0) | BIT(1))
561 #define SCMI_CLK_RATE_ROUND_DOWN 0
562 #define SCMI_CLK_RATE_ROUND_UP BIT(2)
563 #define SCMI_CLK_RATE_ROUND_CLOSEST BIT(3)
564
565 #define SCMI_CLOCK_NAME_LENGTH_MAX 16
566
567 /**
568 * struct scmi_clk_get_nb_out - Response for SCMI_PROTOCOL_ATTRIBUTES command
569 * @status: SCMI command status
570 * @attributes: Attributes of the clock protocol, mainly number of clocks exposed
571 */
572 struct scmi_clk_protocol_attr_out {
573 s32 status;
574 u32 attributes;
575 };
576
577 /**
578 * struct scmi_clk_attribute_in - Message payload for SCMI_CLOCK_ATTRIBUTES command
579 * @clock_id: SCMI clock ID
580 */
581 struct scmi_clk_attribute_in {
582 u32 clock_id;
583 };
584
585 /**
586 * struct scmi_clk_get_nb_out - Response payload for SCMI_CLOCK_ATTRIBUTES command
587 * @status: SCMI command status
588 * @attributes: clock attributes
589 * @clock_name: name of the clock
590 */
591 struct scmi_clk_attribute_out {
592 s32 status;
593 u32 attributes;
594 char clock_name[SCMI_CLOCK_NAME_LENGTH_MAX];
595 };
596
597 /**
598 * struct scmi_clk_state_in - Message payload for CLOCK_CONFIG_SET command
599 * @clock_id: SCMI clock ID
600 * @attributes: Attributes of the targets clock state
601 */
602 struct scmi_clk_state_in {
603 u32 clock_id;
604 u32 attributes;
605 };
606
607 /**
608 * struct scmi_clk_state_out - Response payload for CLOCK_CONFIG_SET command
609 * @status: SCMI command status
610 */
611 struct scmi_clk_state_out {
612 s32 status;
613 };
614
615 /**
616 * struct scmi_clk_state_in - Message payload for CLOCK_RATE_GET command
617 * @clock_id: SCMI clock ID
618 * @attributes: Attributes of the targets clock state
619 */
620 struct scmi_clk_rate_get_in {
621 u32 clock_id;
622 };
623
624 /**
625 * struct scmi_clk_rate_get_out - Response payload for CLOCK_RATE_GET command
626 * @status: SCMI command status
627 * @rate_lsb: 32bit LSB of the clock rate in Hertz
628 * @rate_msb: 32bit MSB of the clock rate in Hertz
629 */
630 struct scmi_clk_rate_get_out {
631 s32 status;
632 u32 rate_lsb;
633 u32 rate_msb;
634 };
635
636 /**
637 * struct scmi_clk_state_in - Message payload for CLOCK_RATE_SET command
638 * @flags: Flags for the clock rate set request
639 * @clock_id: SCMI clock ID
640 * @rate_lsb: 32bit LSB of the clock rate in Hertz
641 * @rate_msb: 32bit MSB of the clock rate in Hertz
642 */
643 struct scmi_clk_rate_set_in {
644 u32 flags;
645 u32 clock_id;
646 u32 rate_lsb;
647 u32 rate_msb;
648 };
649
650 /**
651 * struct scmi_clk_rate_set_out - Response payload for CLOCK_RATE_SET command
652 * @status: SCMI command status
653 */
654 struct scmi_clk_rate_set_out {
655 s32 status;
656 };
657
658 /*
659 * SCMI Reset Domain Protocol
660 */
661
662 enum scmi_reset_domain_message_id {
663 SCMI_RESET_DOMAIN_ATTRIBUTES = 0x3,
664 SCMI_RESET_DOMAIN_RESET = 0x4,
665 };
666
667 #define SCMI_RD_NAME_LEN 16
668
669 #define SCMI_RD_ATTRIBUTES_FLAG_ASYNC BIT(31)
670 #define SCMI_RD_ATTRIBUTES_FLAG_NOTIF BIT(30)
671
672 #define SCMI_RD_RESET_FLAG_ASYNC BIT(2)
673 #define SCMI_RD_RESET_FLAG_ASSERT BIT(1)
674 #define SCMI_RD_RESET_FLAG_CYCLE BIT(0)
675
676 /**
677 * struct scmi_rd_attr_in - Payload for RESET_DOMAIN_ATTRIBUTES message
678 * @domain_id: SCMI reset domain ID
679 */
680 struct scmi_rd_attr_in {
681 u32 domain_id;
682 };
683
684 /**
685 * struct scmi_rd_attr_out - Payload for RESET_DOMAIN_ATTRIBUTES response
686 * @status: SCMI command status
687 * @attributes: Retrieved attributes of the reset domain
688 * @latency: Reset cycle max lantency
689 * @name: Reset domain name
690 */
691 struct scmi_rd_attr_out {
692 s32 status;
693 u32 attributes;
694 u32 latency;
695 char name[SCMI_RD_NAME_LEN];
696 };
697
698 /**
699 * struct scmi_rd_reset_in - Message payload for RESET command
700 * @domain_id: SCMI reset domain ID
701 * @flags: Flags for the reset request
702 * @reset_state: Reset target state
703 */
704 struct scmi_rd_reset_in {
705 u32 domain_id;
706 u32 flags;
707 u32 reset_state;
708 };
709
710 /**
711 * struct scmi_rd_reset_out - Response payload for RESET command
712 * @status: SCMI command status
713 */
714 struct scmi_rd_reset_out {
715 s32 status;
716 };
717
718 /*
719 * SCMI Voltage Domain Protocol
720 */
721
722 enum scmi_voltage_domain_message_id {
723 SCMI_VOLTAGE_DOMAIN_ATTRIBUTES = 0x3,
724 SCMI_VOLTAGE_DOMAIN_CONFIG_SET = 0x5,
725 SCMI_VOLTAGE_DOMAIN_CONFIG_GET = 0x6,
726 SCMI_VOLTAGE_DOMAIN_LEVEL_SET = 0x7,
727 SCMI_VOLTAGE_DOMAIN_LEVEL_GET = 0x8,
728 };
729
730 #define SCMI_VOLTD_NAME_LEN 16
731
732 #define SCMI_VOLTD_CONFIG_MASK GENMASK(3, 0)
733 #define SCMI_VOLTD_CONFIG_OFF 0
734 #define SCMI_VOLTD_CONFIG_ON 0x7
735
736 /**
737 * struct scmi_voltd_attr_in - Payload for VOLTAGE_DOMAIN_ATTRIBUTES message
738 * @domain_id: SCMI voltage domain ID
739 */
740 struct scmi_voltd_attr_in {
741 u32 domain_id;
742 };
743
744 /**
745 * struct scmi_voltd_attr_out - Payload for VOLTAGE_DOMAIN_ATTRIBUTES response
746 * @status: SCMI command status
747 * @attributes: Retrieved attributes of the voltage domain
748 * @name: Voltage domain name
749 */
750 struct scmi_voltd_attr_out {
751 s32 status;
752 u32 attributes;
753 char name[SCMI_VOLTD_NAME_LEN];
754 };
755
756 /**
757 * struct scmi_voltd_config_set_in - Message payload for VOLTAGE_CONFIG_SET cmd
758 * @domain_id: SCMI voltage domain ID
759 * @config: Configuration data of the voltage domain
760 */
761 struct scmi_voltd_config_set_in {
762 u32 domain_id;
763 u32 config;
764 };
765
766 /**
767 * struct scmi_voltd_config_set_out - Response for VOLTAGE_CONFIG_SET command
768 * @status: SCMI command status
769 */
770 struct scmi_voltd_config_set_out {
771 s32 status;
772 };
773
774 /**
775 * struct scmi_voltd_config_get_in - Message payload for VOLTAGE_CONFIG_GET cmd
776 * @domain_id: SCMI voltage domain ID
777 */
778 struct scmi_voltd_config_get_in {
779 u32 domain_id;
780 };
781
782 /**
783 * struct scmi_voltd_config_get_out - Response for VOLTAGE_CONFIG_GET command
784 * @status: SCMI command status
785 * @config: Configuration data of the voltage domain
786 */
787 struct scmi_voltd_config_get_out {
788 s32 status;
789 u32 config;
790 };
791
792 /**
793 * struct scmi_voltd_level_set_in - Message payload for VOLTAGE_LEVEL_SET cmd
794 * @domain_id: SCMI voltage domain ID
795 * @flags: Parameter flags for configuring target level
796 * @voltage_level: Target voltage level in microvolts (uV)
797 */
798 struct scmi_voltd_level_set_in {
799 u32 domain_id;
800 u32 flags;
801 s32 voltage_level;
802 };
803
804 /**
805 * struct scmi_voltd_level_set_out - Response for VOLTAGE_LEVEL_SET command
806 * @status: SCMI command status
807 */
808 struct scmi_voltd_level_set_out {
809 s32 status;
810 };
811
812 /**
813 * struct scmi_voltd_level_get_in - Message payload for VOLTAGE_LEVEL_GET cmd
814 * @domain_id: SCMI voltage domain ID
815 */
816 struct scmi_voltd_level_get_in {
817 u32 domain_id;
818 };
819
820 /**
821 * struct scmi_voltd_level_get_out - Response for VOLTAGE_LEVEL_GET command
822 * @status: SCMI command status
823 * @voltage_level: Voltage level in microvolts (uV)
824 */
825 struct scmi_voltd_level_get_out {
826 s32 status;
827 s32 voltage_level;
828 };
829
830 #endif /* _SCMI_PROTOCOLS_H */