]>
Commit | Line | Data |
---|---|---|
559a07d8 JB |
1 | /** @file\r |
2 | \r | |
063f8483 | 3 | Copyright (c) 2017-2021, Arm Limited. All rights reserved.\r |
559a07d8 | 4 | \r |
4059386c | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
559a07d8 JB |
6 | \r |
7 | System Control and Management Interface V1.0\r | |
8 | http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/\r | |
9 | DEN0056A_System_Control_and_Management_Interface.pdf\r | |
10 | **/\r | |
11 | \r | |
12 | #ifndef ARM_SCMI_CLOCK2_PROTOCOL_H_\r | |
13 | #define ARM_SCMI_CLOCK2_PROTOCOL_H_\r | |
14 | \r | |
15 | #include <Protocol/ArmScmi.h>\r | |
16 | #include <Protocol/ArmScmiClockProtocol.h>\r | |
17 | \r | |
429309e0 | 18 | #define ARM_SCMI_CLOCK2_PROTOCOL_GUID {\\r |
559a07d8 JB |
19 | 0xb8d8caf2, 0x9e94, 0x462c, { 0xa8, 0x34, 0x6c, 0x99, 0xfc, 0x05, 0xef, 0xcf } \\r |
20 | }\r | |
21 | \r | |
429309e0 | 22 | extern EFI_GUID gArmScmiClock2ProtocolGuid;\r |
559a07d8 | 23 | \r |
429309e0 | 24 | #define SCMI_CLOCK2_PROTOCOL_VERSION 1\r |
559a07d8 JB |
25 | \r |
26 | typedef struct _SCMI_CLOCK2_PROTOCOL SCMI_CLOCK2_PROTOCOL;\r | |
27 | \r | |
28 | // Protocol Interface functions.\r | |
29 | \r | |
30 | /** Return version of the clock management protocol supported by SCP firmware.\r | |
31 | \r | |
32 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
33 | \r | |
34 | @param[out] Version Version of the supported SCMI Clock management protocol.\r | |
35 | \r | |
36 | @retval EFI_SUCCESS The version is returned.\r | |
37 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
38 | @retval !(EFI_SUCCESS) Other errors.\r | |
39 | **/\r | |
40 | typedef\r | |
41 | EFI_STATUS\r | |
429309e0 | 42 | (EFIAPI *SCMI_CLOCK2_GET_VERSION)(\r |
559a07d8 JB |
43 | IN SCMI_CLOCK2_PROTOCOL *This,\r |
44 | OUT UINT32 *Version\r | |
45 | );\r | |
46 | \r | |
47 | /** Return total number of clock devices supported by the clock management\r | |
48 | protocol.\r | |
49 | \r | |
50 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
51 | \r | |
52 | @param[out] TotalClocks Total number of clocks supported.\r | |
53 | \r | |
54 | @retval EFI_SUCCESS Total number of clocks supported is returned.\r | |
55 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
56 | @retval !(EFI_SUCCESS) Other errors.\r | |
57 | **/\r | |
58 | typedef\r | |
59 | EFI_STATUS\r | |
429309e0 | 60 | (EFIAPI *SCMI_CLOCK2_GET_TOTAL_CLOCKS)(\r |
559a07d8 JB |
61 | IN SCMI_CLOCK2_PROTOCOL *This,\r |
62 | OUT UINT32 *TotalClocks\r | |
63 | );\r | |
64 | \r | |
65 | /** Return attributes of a clock device.\r | |
66 | \r | |
67 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
68 | @param[in] ClockId Identifier for the clock device.\r | |
69 | \r | |
70 | @param[out] Enabled If TRUE, the clock device is enabled.\r | |
71 | @param[out] ClockAsciiName A NULL terminated ASCII string with the clock\r | |
72 | name, of up to 16 bytes.\r | |
73 | \r | |
74 | @retval EFI_SUCCESS Clock device attributes are returned.\r | |
75 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
76 | @retval !(EFI_SUCCESS) Other errors.\r | |
77 | **/\r | |
78 | typedef\r | |
79 | EFI_STATUS\r | |
429309e0 | 80 | (EFIAPI *SCMI_CLOCK2_GET_CLOCK_ATTRIBUTES)(\r |
559a07d8 JB |
81 | IN SCMI_CLOCK2_PROTOCOL *This,\r |
82 | IN UINT32 ClockId,\r | |
83 | OUT BOOLEAN *Enabled,\r | |
84 | OUT CHAR8 *ClockAsciiName\r | |
85 | );\r | |
86 | \r | |
87 | /** Return list of rates supported by a given clock device.\r | |
88 | \r | |
89 | @param[in] This A pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
90 | @param[in] ClockId Identifier for the clock device.\r | |
91 | \r | |
063f8483 | 92 | @param[out] Format ScmiClockRateFormatDiscrete: Clock device\r |
559a07d8 JB |
93 | supports range of clock rates which are non-linear.\r |
94 | \r | |
063f8483 | 95 | ScmiClockRateFormatLinear: Clock device supports\r |
559a07d8 JB |
96 | range of linear clock rates from Min to Max in steps.\r |
97 | \r | |
98 | @param[out] TotalRates Total number of rates.\r | |
99 | \r | |
100 | @param[in,out] RateArraySize Size of the RateArray.\r | |
101 | \r | |
102 | @param[out] RateArray List of clock rates.\r | |
103 | \r | |
104 | @retval EFI_SUCCESS List of clock rates are returned.\r | |
105 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
106 | @retval EFI_BUFFER_TOO_SMALL RateArraySize is too small for the result.\r | |
107 | It has been updated to the size needed.\r | |
108 | @retval !(EFI_SUCCESS) Other errors.\r | |
109 | **/\r | |
110 | typedef\r | |
111 | EFI_STATUS\r | |
429309e0 | 112 | (EFIAPI *SCMI_CLOCK2_DESCRIBE_RATES)(\r |
559a07d8 JB |
113 | IN SCMI_CLOCK2_PROTOCOL *This,\r |
114 | IN UINT32 ClockId,\r | |
115 | OUT SCMI_CLOCK_RATE_FORMAT *Format,\r | |
116 | OUT UINT32 *TotalRates,\r | |
117 | IN OUT UINT32 *RateArraySize,\r | |
118 | OUT SCMI_CLOCK_RATE *RateArray\r | |
119 | );\r | |
120 | \r | |
121 | /** Get clock rate.\r | |
122 | \r | |
123 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
124 | @param[in] ClockId Identifier for the clock device.\r | |
125 | \r | |
126 | @param[out] Rate Clock rate.\r | |
127 | \r | |
128 | @retval EFI_SUCCESS Clock rate is returned.\r | |
129 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
130 | @retval !(EFI_SUCCESS) Other errors.\r | |
131 | **/\r | |
132 | typedef\r | |
133 | EFI_STATUS\r | |
429309e0 | 134 | (EFIAPI *SCMI_CLOCK2_RATE_GET)(\r |
559a07d8 JB |
135 | IN SCMI_CLOCK2_PROTOCOL *This,\r |
136 | IN UINT32 ClockId,\r | |
137 | OUT UINT64 *Rate\r | |
138 | );\r | |
139 | \r | |
140 | /** Set clock rate.\r | |
141 | \r | |
142 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
143 | @param[in] ClockId Identifier for the clock device.\r | |
144 | @param[in] Rate Clock rate.\r | |
145 | \r | |
146 | @retval EFI_SUCCESS Clock rate set success.\r | |
147 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
148 | @retval !(EFI_SUCCESS) Other errors.\r | |
149 | **/\r | |
150 | typedef\r | |
151 | EFI_STATUS\r | |
429309e0 | 152 | (EFIAPI *SCMI_CLOCK2_RATE_SET)(\r |
559a07d8 JB |
153 | IN SCMI_CLOCK2_PROTOCOL *This,\r |
154 | IN UINT32 ClockId,\r | |
155 | IN UINT64 Rate\r | |
156 | );\r | |
157 | \r | |
158 | /** Enable/Disable specified clock.\r | |
159 | Function is only available under gArmScmiClock2ProtocolGuid\r | |
160 | \r | |
161 | @param[in] This A Pointer to SCMI_CLOCK2_PROTOCOL Instance.\r | |
162 | @param[in] ClockId Identifier for the clock device.\r | |
163 | @param[in] Enable TRUE to enable, FALSE to disable.\r | |
164 | \r | |
165 | @retval EFI_SUCCESS Clock enable/disable successful.\r | |
166 | @retval EFI_DEVICE_ERROR SCP returns an SCMI error.\r | |
167 | @retval !(EFI_SUCCESS) Other errors.\r | |
168 | **/\r | |
169 | typedef\r | |
170 | EFI_STATUS\r | |
429309e0 | 171 | (EFIAPI *SCMI_CLOCK2_ENABLE)(\r |
559a07d8 JB |
172 | IN SCMI_CLOCK2_PROTOCOL *This,\r |
173 | IN UINT32 ClockId,\r | |
174 | IN BOOLEAN Enable\r | |
175 | );\r | |
176 | \r | |
177 | typedef struct _SCMI_CLOCK2_PROTOCOL {\r | |
429309e0 MK |
178 | SCMI_CLOCK2_GET_VERSION GetVersion;\r |
179 | SCMI_CLOCK2_GET_TOTAL_CLOCKS GetTotalClocks;\r | |
180 | SCMI_CLOCK2_GET_CLOCK_ATTRIBUTES GetClockAttributes;\r | |
181 | SCMI_CLOCK2_DESCRIBE_RATES DescribeRates;\r | |
182 | SCMI_CLOCK2_RATE_GET RateGet;\r | |
183 | SCMI_CLOCK2_RATE_SET RateSet;\r | |
559a07d8 JB |
184 | \r |
185 | // Extension to original ClockProtocol, added here so SCMI_CLOCK2_PROTOCOL\r | |
186 | // can be cast to SCMI_CLOCK_PROTOCOL\r | |
429309e0 MK |
187 | UINTN Version; // For future expandability\r |
188 | SCMI_CLOCK2_ENABLE Enable;\r | |
559a07d8 JB |
189 | } SCMI_CLOCK2_PROTOCOL;\r |
190 | \r | |
191 | #endif /* ARM_SCMI_CLOCK2_PROTOCOL_H_ */\r |