]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Include/Protocol/ArmScmiClock2Protocol.h
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Include / Protocol / ArmScmiClock2Protocol.h
CommitLineData
559a07d8
JB
1/** @file\r
2\r
3 Copyright (c) 2017-2018, Arm Limited. All rights reserved.\r
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
18#define ARM_SCMI_CLOCK2_PROTOCOL_GUID { \\r
19 0xb8d8caf2, 0x9e94, 0x462c, { 0xa8, 0x34, 0x6c, 0x99, 0xfc, 0x05, 0xef, 0xcf } \\r
20 }\r
21\r
22extern EFI_GUID gArmScmiClock2ProtocolGuid;\r
23\r
24#define SCMI_CLOCK2_PROTOCOL_VERSION 1\r
25\r
26typedef 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
40typedef\r
41EFI_STATUS\r
42(EFIAPI *SCMI_CLOCK2_GET_VERSION) (\r
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
58typedef\r
59EFI_STATUS\r
60(EFIAPI *SCMI_CLOCK2_GET_TOTAL_CLOCKS) (\r
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
78typedef\r
79EFI_STATUS\r
80(EFIAPI *SCMI_CLOCK2_GET_CLOCK_ATTRIBUTES) (\r
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
92 @param[out] Format SCMI_CLOCK_RATE_FORMAT_DISCRETE: Clock device\r
93 supports range of clock rates which are non-linear.\r
94\r
95 SCMI_CLOCK_RATE_FORMAT_LINEAR: Clock device supports\r
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
110typedef\r
111EFI_STATUS\r
112(EFIAPI *SCMI_CLOCK2_DESCRIBE_RATES) (\r
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
132typedef\r
133EFI_STATUS\r
134(EFIAPI *SCMI_CLOCK2_RATE_GET) (\r
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
150typedef\r
151EFI_STATUS\r
152(EFIAPI *SCMI_CLOCK2_RATE_SET) (\r
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
169typedef\r
170EFI_STATUS\r
171(EFIAPI *SCMI_CLOCK2_ENABLE) (\r
172 IN SCMI_CLOCK2_PROTOCOL *This,\r
173 IN UINT32 ClockId,\r
174 IN BOOLEAN Enable\r
175 );\r
176\r
177typedef struct _SCMI_CLOCK2_PROTOCOL {\r
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
184\r
185 // Extension to original ClockProtocol, added here so SCMI_CLOCK2_PROTOCOL\r
186 // can be cast to SCMI_CLOCK_PROTOCOL\r
187 UINTN Version; // For future expandability\r
188 SCMI_CLOCK2_ENABLE Enable;\r
189} SCMI_CLOCK2_PROTOCOL;\r
190\r
191#endif /* ARM_SCMI_CLOCK2_PROTOCOL_H_ */\r