1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2019-2021, 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 for Reset Domain
9  *      Management Protocol.
10  */
11 
12 #ifndef INTERNAL_SCMI_RESET_DOMAIN_H
13 #define INTERNAL_SCMI_RESET_DOMAIN_H
14 
15 #include <stdint.h>
16 
17 /*!
18  * \addtogroup GroupModules Modules
19  * \{
20  */
21 
22 /*!
23  * \defgroup GroupSCMI_RESET SCMI Reset Domain Management Protocol.
24  * \{
25  */
26 
27 #define SCMI_PROTOCOL_VERSION_RESET_DOMAIN UINT32_C(0x10000)
28 
29 #define SCMI_RESET_STATE_ARCH               (0 << 31)
30 #define SCMI_RESET_STATE_IMPL               (1 << 31)
31 
32 /*
33  * PROTOCOL_ATTRIBUTES
34  */
35 
36 struct scmi_reset_domain_protocol_attributes_p2a {
37     int32_t status;
38     uint32_t attributes;
39 };
40 
41 /* Value for scmi_reset_domain_attributes_p2a:flags */
42 #define SCMI_RESET_DOMAIN_ATTR_ASYNC    (1UL << 31)
43 #define SCMI_RESET_DOMAIN_ATTR_NOTIF    (1UL << 30)
44 
45 /* Value for scmi_reset_domain_attributes_p2a:latency */
46 #define SCMI_RESET_DOMAIN_ATTR_LATENCY_UNSUPPORTED  0xFFFFFFFF
47 
48 /* Macro for scmi_reset_domain_attributes_p2a:name */
49 #define SCMI_RESET_DOMAIN_ATTR_NAME_SZ  16
50 
51 struct scmi_reset_domain_attributes_a2p {
52     uint32_t domain_id;
53 };
54 
55 struct scmi_reset_domain_attributes_p2a {
56     int32_t status;
57     uint32_t flags;
58     uint32_t latency;
59     uint8_t name[SCMI_RESET_DOMAIN_ATTR_NAME_SZ];
60 };
61 
62 /*
63  * RESET
64  */
65 
66 /* Values for scmi_reset_domain_request_p2a:flags */
67 #define SCMI_RESET_DOMAIN_ASYNC      (1 << 2)
68 #define SCMI_RESET_DOMAIN_EXPLICIT   (1 << 1)
69 #define SCMI_RESET_DOMAIN_AUTO       (1 << 0)
70 #define SCMI_RESET_DOMAIN_FLAGS_MASK \
71     (SCMI_RESET_DOMAIN_ASYNC | SCMI_RESET_DOMAIN_EXPLICIT | \
72      SCMI_RESET_DOMAIN_AUTO)
73 
74 #define SCMI_RESET_DOMAIN_RESET_STATE_TYPE_MASK (1UL << 31)
75 #define SCMI_RESET_DOMAIN_RESET_STATE_ID_MASK UINT32_C(0x7FFFFFFF)
76 
77 struct scmi_reset_domain_request_a2p {
78     uint32_t domain_id;
79     uint32_t flags;
80     uint32_t reset_state;
81 };
82 
83 struct scmi_reset_domain_request_p2a {
84     int32_t status;
85 };
86 
87 /*
88  * RESET_NOTIFY
89  */
90 
91 /* Values for scmi_reset_notify_p2a:flags */
92 #define SCMI_RESET_DOMAIN_DO_NOTIFY  (1 << 0)
93 
94 struct scmi_reset_domain_notify_a2p {
95     uint32_t domain_id;
96     uint32_t notify_enable;
97 };
98 
99 struct scmi_reset_domain_notify_p2a {
100     int32_t status;
101 };
102 
103 /*
104  * RESET_COMPLETE
105  */
106 
107 struct scmi_reset_domain_complete_p2a {
108     int32_t status;
109     uint32_t domain_id;
110 };
111 
112 /*
113  * RESET_ISSUED
114  */
115 
116 struct scmi_reset_domain_issued_p2a {
117     uint32_t agent_id;
118     uint32_t domain_id;
119     uint32_t reset_state;
120 };
121 
122 /*!
123  * \}
124  */
125 
126 /*!
127  * \}
128  */
129 
130 #endif /* INTERNAL_SCMI_RESET_DOMAIN_H */
131