xref: /optee_os/core/drivers/scmi-msg/reset_domain.h (revision 5b25c76ac40f830867e3d60800120ffd7874e8dc)
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2015-2019, Arm Limited and Contributors. All rights reserved.
4  * Copyright (c) 2019, Linaro Limited
5  */
6 #ifndef SCMI_MSG_RESET_DOMAIN_H
7 #define SCMI_MSG_RESET_DOMAIN_H
8 
9 #include <compiler.h>
10 #include <stdbool.h>
11 #include <stdint.h>
12 #include <types_ext.h>
13 #include <util.h>
14 
15 #define SCMI_PROTOCOL_VERSION_RESET_DOMAIN	0x10000
16 
17 #define SCMI_RESET_STATE_ARCH			BIT(31)
18 #define SCMI_RESET_STATE_IMPL			0
19 
20 /*
21  * Identifiers of the SCMI Reset Domain Management Protocol commands
22  */
23 enum scmi_reset_domain_command_id {
24 	SCMI_RESET_DOMAIN_ATTRIBUTES = 0x03,
25 	SCMI_RESET_DOMAIN_REQUEST = 0x04,
26 	SCMI_RESET_DOMAIN_NOTIFY = 0x05,
27 };
28 
29 /*
30  * Identifiers of the SCMI Reset Domain Management Protocol responses
31  */
32 enum scmi_reset_domain_response_id {
33 	SCMI_RESET_ISSUED = 0x00,
34 	SCMI_RESET_COMPLETE = 0x04,
35 };
36 
37 /*
38  * PROTOCOL_ATTRIBUTES
39  */
40 
41 #define SCMI_RESET_DOMAIN_COUNT_MASK		GENMASK_32(15, 0)
42 
43 struct scmi_reset_domain_protocol_attributes_p2a {
44 	int32_t status;
45 	uint32_t attributes;
46 };
47 
48 /* Value for scmi_reset_domain_attributes_p2a:flags */
49 #define SCMI_RESET_DOMAIN_ATTR_ASYNC		BIT(31)
50 #define SCMI_RESET_DOMAIN_ATTR_NOTIF		BIT(30)
51 
52 /* Value for scmi_reset_domain_attributes_p2a:latency */
53 #define SCMI_RESET_DOMAIN_ATTR_UNK_LAT		0x7fffffff
54 #define SCMI_RESET_DOMAIN_ATTR_MAX_LAT		0x7ffffffe
55 
56 /* Macro for scmi_reset_domain_attributes_p2a:name */
57 #define SCMI_RESET_DOMAIN_ATTR_NAME_SZ		16
58 
59 struct scmi_reset_domain_attributes_a2p {
60 	uint32_t domain_id;
61 };
62 
63 struct scmi_reset_domain_attributes_p2a {
64 	int32_t status;
65 	uint32_t flags;
66 	uint32_t latency;
67 	char name[SCMI_RESET_DOMAIN_ATTR_NAME_SZ];
68 };
69 
70 /*
71  * RESET
72  */
73 
74 /* Values for scmi_reset_domain_request_a2p:flags */
75 #define SCMI_RESET_DOMAIN_ASYNC			BIT(2)
76 #define SCMI_RESET_DOMAIN_EXPLICIT		BIT(1)
77 #define SCMI_RESET_DOMAIN_AUTO			BIT(0)
78 
79 struct scmi_reset_domain_request_a2p {
80 	uint32_t domain_id;
81 	uint32_t flags;
82 	uint32_t reset_state;
83 };
84 
85 struct scmi_reset_domain_request_p2a {
86 	int32_t status;
87 };
88 
89 /*
90  * RESET_NOTIFY
91  */
92 
93 /* Values for scmi_reset_notify_p2a:flags */
94 #define SCMI_RESET_DOMAIN_DO_NOTIFY		BIT(0)
95 
96 struct scmi_reset_domain_notify_a2p {
97 	uint32_t domain_id;
98 	uint32_t notify_enable;
99 };
100 
101 struct scmi_reset_domain_notify_p2a {
102 	int32_t status;
103 };
104 
105 /*
106  * RESET_COMPLETE
107  */
108 
109 struct scmi_reset_domain_complete_p2a {
110 	int32_t status;
111 	uint32_t domain_id;
112 };
113 
114 /*
115  * RESET_ISSUED
116  */
117 
118 struct scmi_reset_domain_issued_p2a {
119 	uint32_t domain_id;
120 	uint32_t reset_state;
121 };
122 
123 #endif /* SCMI_MSG_RESET_DOMAIN_H */
124